int rtems_rtl_chain_count (rtems_chain_control* chain) { int count = 0; rtems_rtl_chain_iterate (chain, rtems_rtl_count_iterator, &count); return count; }
static int rtems_rtl_shell_status (rtems_rtl_data_t* rtl, int argc, char *argv[]) { rtems_rtl_obj_summary_t summary; size_t total_memory; summary.count = 0; summary.exec = 0; summary.symbols = 0; rtems_rtl_chain_iterate (&rtl->objects, rtems_rtl_obj_summary_iterator, &summary); /* * Currently does not include the name strings in the obj struct. */ total_memory = sizeof (*rtl) + (summary.count * sizeof (rtems_rtl_obj_t)) + summary.exec + summary.symbols; printf ("Runtime Linker Status:\n"); printf (" paths: %s\n", rtl->paths); printf (" objects: %d\n", summary.count); printf (" total memory: %zi\n", total_memory); printf (" exec memory: %zi\n", summary.exec); printf (" sym memory: %zi\n", summary.symbols); printf (" symbols: %d\n", rtems_rtl_count_symbols (rtl)); return 0; }
rtems_rtl_obj_sect_t* rtems_rtl_obj_find_section_by_index (rtems_rtl_obj_t* obj, int index) { rtems_rtl_obj_sect_finder_t match; match.sect = NULL; match.index = index; rtems_rtl_chain_iterate (&obj->sections, rtems_rtl_obj_sect_match_index, &match); return match.sect; }
rtems_rtl_obj_sect_t* rtems_rtl_obj_find_section (rtems_rtl_obj_t* obj, const char* name) { rtems_rtl_obj_sect_finder_t match; match.sect = NULL; match.name = name; rtems_rtl_chain_iterate (&obj->sections, rtems_rtl_obj_sect_match_name, &match); return match.sect; }
static size_t rtems_rtl_obj_section_alignment (rtems_rtl_obj_t* obj, uint32_t mask) { rtems_rtl_obj_sect_aligner_t aligner; aligner.mask = mask; aligner.alignment = 0; rtems_rtl_chain_iterate (&obj->sections, rtems_rtl_obj_sect_aligner, &aligner); return aligner.alignment; }
static size_t rtems_rtl_obj_section_size (rtems_rtl_obj_t* obj, uint32_t mask) { rtems_rtl_obj_sect_summer_t summer; summer.mask = mask; summer.size = 0; rtems_rtl_chain_iterate (&obj->sections, rtems_rtl_obj_sect_summer, &summer); return summer.size; }
static int rtems_rtl_shell_list (rtems_rtl_data_t* rtl, int argc, char *argv[]) { rtems_rtl_obj_print_t print; print.rtl = rtl; print.indent = 1; print.oname = true; print.names = true; print.memory_map = true; print.symbols = rtems_rtl_symbols_arg (argc, argv); print.base = false; rtems_rtl_chain_iterate (&rtl->objects, rtems_rtl_obj_print_iterator, &print); return 0; }
static int rtems_rtl_shell_sym (rtems_rtl_data_t* rtl, int argc, char *argv[]) { rtems_rtl_obj_print_t print; print.rtl = rtl; print.indent = 1; print.oname = true; print.names = false; print.memory_map = false; print.symbols = true; print.base = rtems_rtl_base_arg (argc, argv); rtems_rtl_chain_iterate (&rtl->objects, rtems_rtl_obj_print_iterator, &print); printf ("Unresolved:\n"); rtems_rtl_unresolved_interate (rtems_rtl_unresolved_printer, &print); return 0; }