From: <cp...@sg...> - 2005-11-10 13:42:38
|
Many of the printf's in dwarfextract.c are wrong after the initial submittal of the code. This patch fixes them all. Signed-off-by: Cliff Wickman <cp...@sg...> --- --- 7.X.X/lkcdutils/dwarf/dwarfdump/dwarfextract.bad +++ 7.X.X/lkcdutils/dwarf/dwarfdump/dwarfextract.c @@ -482,7 +482,7 @@ main(int argc, char *argv[]) close (infd); if (rflag) { - printf ("tested 0 dies; deepest nesting: 0\n", + printf ("tested 0 dies; deepest nesting: 0\n", tested_dies, deepest_nesting); } @@ -494,7 +494,7 @@ main(int argc, char *argv[]) close (outfd); if (Pflag) { gettimeofday(&tv, &tz); - printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); + printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); } exit(0); } @@ -510,7 +510,7 @@ open_as_elf(int fd, char *file_name) cmd = ELF_C_READ; elf = elf_begin(fd, cmd, (Elf *) 0); if (elf_kind(elf) == ELF_K_AR) { - printf (" is an archive; aborting\n", file_name); + printf (" is an archive; aborting\n", file_name); exit(1); } @@ -521,11 +521,11 @@ open_as_elf(int fd, char *file_name) eh64 = elf64_getehdr(elf); is_64_bit++; if (!eh64) { - printf (" is neither 32 nor 64-bit\n", file_name); + printf (" is neither 32 nor 64-bit\n", file_name); exit(1); } else { if (debug) { - printf ("process the file \n", + printf ("process the file \n", file_name); } producer_flags = DW_DLC_SIZE_64; @@ -534,7 +534,7 @@ open_as_elf(int fd, char *file_name) is_32_bit++; /* a 32-bit obj */ if (debug) { - printf ("process the file \n", file_name); + printf ("process the file \n", file_name); } producer_flags = DW_DLC_SIZE_32; } @@ -553,7 +553,7 @@ process_one_file(Elf * elf, int fd) dres = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &dbg, &error); if (dres == DW_DLV_NO_ENTRY) { - printf("No DWARF information present in \n", in_file_name); + printf("No DWARF information present in \n", in_file_name); return 0; } if (dres != DW_DLV_OK) { @@ -568,7 +568,7 @@ process_one_file(Elf * elf, int fd) exit(1); } if (debug) { - printf ("newdbg created at 0\n", newdbg); + printf ("newdbg created at 0\n", newdbg); } common_base_type_die = (Dwarf_P_Die)0; @@ -580,10 +580,10 @@ process_one_file(Elf * elf, int fd) } walk_cus(dbg, fd); if (pflag) { - printf ("0 types in tree\n", tree_base->avl_count); + printf ("0 types in tree\n", tree_base->avl_count); } if (debug) { - printf ("total new dies created 0\n", total_newdies); + printf ("total new dies created 0\n", total_newdies); } do_reference_translations(); @@ -598,16 +598,16 @@ process_one_file(Elf * elf, int fd) write_output_file(); if (!sflag) { - printf ("input file:\t\t\t\t\n", in_file_name); - printf ("compilation units:\t\t0\n", total_cus); - printf ("structures captured:\t\t0\n", total_structs); - printf ("output file:\t\t\t\t\n", out_file_name); + printf ("input file:\t\t\t\t\n", in_file_name); + printf ("compilation units:\t\t0\n", total_cus); + printf ("structures captured:\t\t0\n", total_structs); + printf ("output file:\t\t\t\t\n", out_file_name); } if (debug) { printf ("final space usages:\n"); - printf ("num_refchecks: 0\n", num_refchecks); - printf ("num_aliases: 0\n", num_aliases); - printf ("num_debug_pieces: 0\n", num_debug_pieces); + printf ("num_refchecks: 0\n", num_refchecks); + printf ("num_aliases: 0\n", num_aliases); + printf ("num_debug_pieces: 0\n", num_debug_pieces); } return 0; } @@ -629,7 +629,7 @@ process_concat_file(Elf * elf, char *fil dres = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &concat_dbg, &error); if (dres == DW_DLV_NO_ENTRY) { - printf("No DWARF information present in \n", filename); + printf("No DWARF information present in \n", filename); return 0; } if (dres != DW_DLV_OK) { @@ -638,7 +638,7 @@ process_concat_file(Elf * elf, char *fil } if (!sflag) { - printf ("0/0, concatenating file \n", + printf ("0/0, concatenating file \n", filenumber+1, num_cfiles, filename); } @@ -646,11 +646,11 @@ process_concat_file(Elf * elf, char *fil * Iterate through dwarf and extract all type info. */ if (debug) { - printf ("walking the CUs tree for \n", filename); + printf ("walking the CUs tree for \n", filename); } walk_cus(concat_dbg, fd); if (debug) { - printf ("total new dies created 0\n", total_newdies); + printf ("total new dies created 0\n", total_newdies); } if (needs_old == 0) { @@ -661,9 +661,9 @@ process_concat_file(Elf * elf, char *fil } if (!sflag) { - printf (" compilation units:\t\t0\n", total_cus); - printf (" structures captured:\t\t0\n", total_structs); - printf (" types in tree:\t\t0\n", tree_base->avl_count); + printf (" compilation units:\t\t0\n", total_cus); + printf (" structures captured:\t\t0\n", total_structs); + printf (" types in tree:\t\t0\n", tree_base->avl_count); } return 0; } @@ -684,14 +684,14 @@ write_output_file() /* coffset = lseek(outfd, 0, SEEK_CUR); */ if ((i = write(outfd, &outelfhdr, sizeof(outelfhdr))) != sizeof(outelfhdr)) { - printf ("cannot write elf header to ; abort\n", + printf ("cannot write elf header to ; abort\n", in_place ? in_file_name : out_file_name); exit(1); } if (pflag) { printf ("transforming to disk form and "); - printf("writing file \n", + printf("writing file \n", in_place ? in_file_name : out_file_name); } numsections = dwarf_transform_to_disk_form (newdbg, &error); @@ -701,14 +701,14 @@ write_output_file() } if (debug) { - printf ("transformed 0 disk image pieces\n", numsections); + printf ("transformed 0 disk image pieces\n", numsections); } gres = (Dwarf_Ptr)1; section = 0; while (gres) { if (debug) { printf ( - "calling dwarf_get_section_bytes for section 0\n", + "calling dwarf_get_section_bytes for section 0\n", section); } @@ -717,7 +717,7 @@ write_output_file() if (gres == NULL) { if (debug) { printf ( - "dwarf_get_section_bytes returned NULL at 0\n", + "dwarf_get_section_bytes returned NULL at 0\n", section); } if ((num_abbrev_pieces < 1) || @@ -731,9 +731,9 @@ write_output_file() /* we may get each section a piece at a time; we'll have to save an array of starts and lengths */ if (debug) { - printf ("dwarf_get_section_bytes index:0 ", + printf ("dwarf_get_section_bytes index:0 ", elf_section_index); - printf ("length:0\n", length); + printf ("length:0\n", length); } if (elf_section_index == SECTION_DEBUGABBREV) { save_abbrev_piece((char *)gres, length); @@ -743,7 +743,7 @@ write_output_file() save_reldebug_piece((char *)gres, length); } else { printf ( - "dwarf_get_section_bytes returned unexpected section number 0\n", + "dwarf_get_section_bytes returned unexpected section number 0\n", elf_section_index); exit(1); } @@ -822,7 +822,7 @@ write_output_file() sh_size = NUM_SECTIONS * sizeof(SECTION_HEADER); if (debug) { coffset = lseek(outfd, 0, SEEK_CUR); - printf ("writing section header at 0 of (size 0)\n", + printf ("writing section header at 0 of (size 0)\n", coffset, out_file_name, sh_size); } @@ -835,22 +835,22 @@ write_output_file() shp1 = base_shp; printf ("output Section header table:\n"); for (i=0; i<NUM_SECTIONS; i++, shp1++) { - printf (" section 0:\n", i); - printf (" sh_name:0 ()\n", shp1->sh_name, + printf (" section 0:\n", i); + printf (" sh_name:0 ()\n", shp1->sh_name, in_string_buffer + shp1->sh_name); - printf (" sh_type:0\n", shp1->sh_type); - printf (" sh_flags:0\n", shp1->sh_flags); - printf (" sh_addr:0\n", shp1->sh_addr); - printf (" sh_offset:0\n", shp1->sh_offset); - printf (" sh_size:0\n", shp1->sh_size); - printf (" sh_entsize:0\n", shp1->sh_entsize); + printf (" sh_type:0\n", shp1->sh_type); + printf (" sh_flags:0\n", shp1->sh_flags); + printf (" sh_addr:0\n", shp1->sh_addr); + printf (" sh_offset:0\n", shp1->sh_offset); + printf (" sh_size:0\n", shp1->sh_size); + printf (" sh_entsize:0\n", shp1->sh_entsize); } } /* [1] write the abbrev section */ if (debug) { coffset = lseek(outfd, 0, SEEK_CUR); - printf ("writing abbrev section at 0 of (size 0)\n", + printf ("writing abbrev section at 0 of (size 0)\n", coffset, out_file_name, abbrev_size); } for (i=0; i<num_abbrev_pieces; i++) { @@ -864,7 +864,7 @@ write_output_file() /* [2] write the debug_info section */ if (debug) { coffset = lseek(outfd, 0, SEEK_CUR); - printf ("writing debug_info section at 0 of (size 0)\n", + printf ("writing debug_info section at 0 of (size 0)\n", coffset, out_file_name, debug_size); } for (i=0; i<num_debug_pieces; i++) { @@ -879,7 +879,7 @@ write_output_file() if (debug) { coffset = lseek(outfd, 0, SEEK_CUR); printf ( - "writing rel.debug_info section at 0 of (size 0)\n", + "writing rel.debug_info section at 0 of (size 0)\n", coffset, out_file_name, reldebug_size); } for (i=0; i<num_reldebug_pieces; i++) { @@ -893,7 +893,7 @@ write_output_file() /* [4] write the string section (just what we had on input) */ if (debug) { coffset = lseek(outfd, 0, SEEK_CUR); - printf ("writing string section at 0 of (size 0)\n", + printf ("writing string section at 0 of (size 0)\n", coffset, out_file_name, out_string_size); } if ((i = write(outfd, in_string_buffer, out_string_size)) != @@ -912,7 +912,7 @@ save_abbrev_piece(char *address, Dwarf_U if (num_abbrev_pieces >= size_abbrev_pieces) { num_abbrev_pieces = num_abbrev_pieces + (num_abbrev_pieces/2); if (pflag) { - printf ("bump num_abbrev_pieces to 0 and realloc\n", + printf ("bump num_abbrev_pieces to 0 and realloc\n", num_abbrev_pieces); } if ((abbrev_addrp = (char **)realloc((void *)abbrev_addrp, @@ -947,7 +947,7 @@ save_debug_piece(char *address, Dwarf_Un if (num_debug_pieces >= size_debug_pieces) { size_debug_pieces = size_debug_pieces + (size_debug_pieces/2); if (pflag) { - printf ("bump size_debug_pieces to 0 and realloc\n", + printf ("bump size_debug_pieces to 0 and realloc\n", size_debug_pieces); } if ((debug_addrp = (char **)realloc((void *)debug_addrp, @@ -983,7 +983,7 @@ save_reldebug_piece(char *address, Dwarf size_reldebug_pieces = size_reldebug_pieces + (size_reldebug_pieces/2); if (pflag) { - printf ("bump size_reldebug_pieces to 0 and realloc\n", + printf ("bump size_reldebug_pieces to 0 and realloc\n", size_reldebug_pieces); } @@ -1022,7 +1022,7 @@ add_to_proto_list(Dwarf_Off offset, Dwar if (num_protos >= size_protos) { size_protos = size_protos + (size_protos/2); if (pflag) { - printf ("bump size_protos to 0 and realloc\n", + printf ("bump size_protos to 0 and realloc\n", size_protos); } if ((struct_protop = (Dwarf_Off *) @@ -1095,7 +1095,7 @@ walk_cus(Dwarf_Debug dbg, int fd) /*get "first" die of the CU (this is not a sibling)*/ get_sibling(dbg, NULL, &cu_die); if (debug) { - printf ("first CU die: 0 offset:0\n", + printf ("first CU die: 0 offset:0\n", cu_die, current_offset(cu_die)); } /* convert the first CU to the root of our new tree */ @@ -1110,8 +1110,8 @@ walk_cus(Dwarf_Debug dbg, int fd) &error); if (dres != 0) { printf ( - "dwarf_add_die_to_debug failed (0)\n",dres); - printf ("DW_DLV_NOCOUNT is 0\n", + "dwarf_add_die_to_debug failed (0)\n",dres); + printf ("DW_DLV_NOCOUNT is 0\n", DW_DLV_NOCOUNT); exit(1); } @@ -1130,7 +1130,7 @@ walk_cus(Dwarf_Debug dbg, int fd) if (pflag && current_file_number==1 && (total_cus % 10 == 0)) { /* this progress item is only confusion for a -c or -C file */ - printf ("CU: 0\n", total_cus); + printf ("CU: 0\n", total_cus); } /* get the die of the CU */ @@ -1140,7 +1140,7 @@ walk_cus(Dwarf_Debug dbg, int fd) of the CU as a sibling of this first child */ if (get_child(cu_die, &child)) { if (debug) { - printf ("walking children of \n", + printf ("walking children of \n", name_of_die(cu_die)); } @@ -1149,7 +1149,7 @@ walk_cus(Dwarf_Debug dbg, int fd) begin at level 1 */ if (debug) { printf ( - "walk CUs die: 0 offset:0\n", + "walk CUs die: 0 offset:0\n", cu_die, current_offset(cu_die)); } walk_die_and_children(dbg, child, root_p_die); @@ -1187,7 +1187,7 @@ walk_die_and_children(Dwarf_Debug dbg, D Dwarf_Attribute attr; if (debug) { - printf ("walk_die_and_children entered, tree_level:0 CU:0\n", + printf ("walk_die_and_children entered, tree_level:0 CU:0\n", tree_level, total_cus); } /* if we don't create a p_die at this level, inherit the parent */ @@ -1202,18 +1202,18 @@ walk_die_and_children(Dwarf_Debug dbg, D a -c or -C file */ if (total_dies % 100000 == 0) { printf ( - "dies: 0 aliases:0 saved structures:0\n", + "dies: 0 aliases:0 saved structures:0\n", total_dies, num_aliases, total_structs); } } do_this_one = is_type_we_want(dbg, die, &declaration); if (debug) { - printf (": is_type_we_want:0\n", + printf (": is_type_we_want:0\n", name_of_die(die), do_this_one); } if (do_this_one) { if (debug) { - printf ("begin die , offset 0 <0>\n", + printf ("begin die , offset 0 <0>\n", name_of_die(die), current_offset(die), current_offset(die)); } @@ -1254,7 +1254,7 @@ walk_die_and_children(Dwarf_Debug dbg, D do_this_one = 0; if (debug) { printf ( - "duplicate: members:0 size:0 hash:0\n", + "duplicate: members:0 size:0 hash:0\n", namep, members, size, hash); } /* add this to the alias - something may @@ -1279,7 +1279,7 @@ walk_die_and_children(Dwarf_Debug dbg, D } } if (debug) { - printf (": after lookups, do this one:0\n", + printf (": after lookups, do this one:0\n", name_of_die(die), do_this_one); } if (do_this_one) { @@ -1321,7 +1321,7 @@ walk_die_and_children(Dwarf_Debug dbg, D /* this is a child; link it to its parent */ if (debug) { - printf ("link pdie 0 to parent 0\n", + printf ("link pdie 0 to parent 0\n", new_p_die, parent_p_die); } producer_p_die = dwarf_die_link(new_p_die, @@ -1339,13 +1339,13 @@ walk_die_and_children(Dwarf_Debug dbg, D addtosavedtypes(namep, members, hash, new_p_die, die, size, tag, declaration); if (debug) { - printf ("add to saved types\n", + printf ("add to saved types\n", namep); } } else { if (debug) { printf ( - " not added to saved types, level 0\n", + " not added to saved types, level 0\n", namep, tree_level); } } @@ -1357,7 +1357,7 @@ walk_die_and_children(Dwarf_Debug dbg, D depth-first walk */ if (get_child(die, &child)) { if (debug) { - printf ("walking children of \n", + printf ("walking children of \n", name_of_die(die)); } walk_die_and_children(dbg, child, new_p_die); @@ -1371,7 +1371,7 @@ walk_die_and_children(Dwarf_Debug dbg, D die = sibling; if (debug) { printf ( - "found sibling \n", name_of_die(sibling)); + "found sibling \n", name_of_die(sibling)); } } else { die = NULL; @@ -1390,7 +1390,7 @@ add_to_needs_ptr_list(Dwarf_Off typeoffs if (num_needptrs >= size_needptrs) { size_needptrs = size_needptrs + (size_needptrs/2); if (pflag) { - printf ("bump size_needptrs to 0 and realloc\n", + printf ("bump size_needptrs to 0 and realloc\n", size_needptrs); } if ((needptr_refp = (Dwarf_Off *)realloc((void *)needptr_refp, @@ -1421,7 +1421,7 @@ add_to_needs_ptr_list(Dwarf_Off typeoffs *(needptr_typep + num_needptrs) = 0; if (debug) { printf ( - "adding offset 0 die 0 to need_pointer list, slot 0\n", + "adding offset 0 die 0 to need_pointer list, slot 0\n", typeoffset, pdie, num_needptrs); } num_needptrs++; @@ -1435,7 +1435,7 @@ add_to_needs_arr_list(Dwarf_Debug dbg, D if (num_needarrs >= size_needarrs) { size_needarrs = size_needarrs + (size_needarrs/2); if (pflag) { - printf ("bump size_needarrs to 0 and realloc\n", + printf ("bump size_needarrs to 0 and realloc\n", size_needarrs); } if ((needarr_refp = (Dwarf_Off *)realloc((void *)needarr_refp, @@ -1478,7 +1478,7 @@ add_to_needs_arr_list(Dwarf_Debug dbg, D *(needarr_origp + num_needarrs) = this_offset; if (debug) { printf ( - "adding offset 0 die 0 to need_array list, slot 0\n", + "adding offset 0 die 0 to need_array list, slot 0\n", typeoffset, pdie, num_needarrs); } needs_old++; /* remember to leave this file open */ @@ -1556,13 +1556,13 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d dietag == DW_TAG_enumeration_type || dietag == DW_TAG_typedef || dietag == DW_TAG_union_type) { - printf (" \n", die_type(die), name_of_die(die)); + printf (" \n", die_type(die), name_of_die(die)); } return; } /* -a means display all types */ if (aflag) { - printf ("\n", name_of_die(die)); + printf ("\n", name_of_die(die)); return; } /* -H means display just structures, with a hash total */ @@ -1576,7 +1576,7 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d } get_type_values(dbg, die, &die_name, &hash, &members, &size, &tag, &globaloffset, &isptr); - printf (" 0\n", die_name, hash); + printf (" 0\n", die_name, hash); return; } /* -S means display just structures, with their size */ @@ -1596,21 +1596,21 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d bytesize = 0; } if (bytesize) { - printf (" 0\n", die_name, bytesize); + printf (" 0\n", die_name, bytesize); } else { - printf (" unknown-size\n", die_name); + printf (" unknown-size\n", die_name); } return; } strcpy(indentation_string, indentation_spaces); indentation_string[(tree_level)*2] = '\0'; - printf ("", indentation_string); + printf ("", indentation_string); - printf ("type: ", die_type(die)); + printf ("type: ", die_type(die)); die_name = name_of_die(die); - printf ("name: ", die_name); + printf ("name: ", die_name); result = dwarf_bytesize(die, &bytesize, &err); if (result == DW_DLV_ERROR) { @@ -1620,7 +1620,7 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d bytesize = 0; } if (bytesize) { - printf ("bytesize:0 ", bytesize); + printf ("bytesize:0 ", bytesize); } result = dwarf_bitsize(die, &bitsize, &err); @@ -1631,7 +1631,7 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d exit(1); } if (bitsize) { - printf ("bitsize:0 ", bitsize); + printf ("bitsize:0 ", bitsize); } get_tag(die, &tag); @@ -1645,12 +1645,12 @@ print_a_die(Dwarf_Debug dbg, Dwarf_Die d } */ - printf ("own_offset:0 ", globaloffset); + printf ("own_offset:0 ", globaloffset); if (!Tflag) { get_type_values(dbg, die, &die_name, &hash, &members, &size, &tag, &globaloffset, &isptr); - printf ("hash:0 members:0 ", hash, members); + printf ("hash:0 members:0 ", hash, members); printf ("\n"); } @@ -1745,8 +1745,8 @@ show_structure(Dwarf_Debug dbg, Dwarf_Di die_name = name_of_die(die); strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); - printf (" \n", die_type(die), die_name, name); + printf ("", indentation_string); + printf (" \n", die_type(die), die_name, name); level++; /* walk the children: */ @@ -1777,8 +1777,8 @@ show_union(Dwarf_Debug dbg, Dwarf_Die di die_name = name_of_die(die); strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); - printf (" \n", die_type(die), die_name, name); + printf ("", indentation_string); + printf (" \n", die_type(die), die_name, name); level++; /* walk the children (overlapping members of this union) */ @@ -1836,8 +1836,8 @@ show_typedef(Dwarf_Debug dbg, Dwarf_Die } strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); - printf (" 0 0\n", + printf ("", indentation_string); + printf (" 0 0\n", die_type(die), die_name, name, die_type(type_die), typedie_name, parent_offset, parent_offset); if (has_children) { @@ -1877,8 +1877,8 @@ show_enum(Dwarf_Debug dbg, Dwarf_Die die strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); - printf (" 0 0\n", die_type(die), + printf ("", indentation_string); + printf (" 0 0\n", die_type(die), die_name, name, parent_offset, parent_offset); level++; @@ -1909,8 +1909,8 @@ show_array(Dwarf_Debug dbg, Dwarf_Die di strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); - printf (" ", name, die_type(die)); + printf ("", indentation_string); + printf (" ", name, die_type(die)); level++; /* walk the children: */ @@ -1918,7 +1918,7 @@ show_array(Dwarf_Debug dbg, Dwarf_Die di this_die = child_die; bound = get_bound(this_die); if (bound) { - printf ("[0] ", bound+1); + printf ("[0] ", bound+1); } else { printf ("void "); } @@ -1926,7 +1926,7 @@ show_array(Dwarf_Debug dbg, Dwarf_Die di this_die = sibling_die; bound = get_bound(this_die); if (bound) { - printf ("[0] ", bound+1); + printf ("[0] ", bound+1); } else { printf ("void "); } @@ -1934,8 +1934,8 @@ show_array(Dwarf_Debug dbg, Dwarf_Die di } else { printf ("unknown array bounds"); } - printf ("of ", get_reftype(die, dbg)); /* type or name */ - printf ("0 0", parent_offset, parent_offset); + printf ("of ", get_reftype(die, dbg)); /* type or name */ + printf ("0 0", parent_offset, parent_offset); printf ("\n"); return; } @@ -2037,17 +2037,17 @@ show_die_offset(Dwarf_Debug dbg, Dwarf_D } else if (type_tag == DW_TAG_array_type) { show_array(dbg, type_die, die_name, level, offset); } else { - printf("unexpected type die 0\n", type_die); + printf("unexpected type die 0\n", type_die); exit(1); } } else { strcpy(indentation_string, indentation_spaces); indentation_string[level*4] = '\0'; - printf ("", indentation_string); + printf ("", indentation_string); if (tf) { - printf (" 0 0\n", die_name, offset, offset); + printf (" 0 0\n", die_name, offset, offset); } else { - printf (" \n", die_name); + printf (" \n", die_name); } } return; @@ -2068,7 +2068,7 @@ test_a_die(Dwarf_Debug dbg, Dwarf_Die di tested_dies++; if (verbose && (tested_dies % 10000 == 0)) { offset = current_offset(die); - printf ("tested 0 dies, offset: 0\n", tested_dies, offset); + printf ("tested 0 dies, offset: 0\n", tested_dies, offset); } next_die = die; count = 0; @@ -2240,7 +2240,7 @@ Cfilenames(char *Cfilename) infile = fopen (Cfilename, "r"); if (!infile) { - printf ( "open error on \n", Cfilename); + printf ( "open error on \n", Cfilename); exit (1); } @@ -2256,7 +2256,7 @@ Cfilenames(char *Cfilename) fclose (infile); if (numlines > FMAX) { /* shouldn't happen; not logically allowed */ - printf ("There are 0 filenames in the -C file; exceeds FMAX", + printf ("There are 0 filenames in the -C file; exceeds FMAX", numlines); exit (1); } @@ -2295,24 +2295,24 @@ usage() { fprintf (stderr, "to extract type information from a file "); fprintf (stderr, "with several CU (compile units):\n"); - fprintf (stderr, " [-v][-p] in_file_name out_file_name\n", + fprintf (stderr, " [-v][-p] in_file_name out_file_name\n", program_name); fprintf (stderr, " -p show progress (CUs and dies)\n"); fprintf (stderr, " -P show elapsed times\n"); fprintf (stderr, " -v verbose output\n"); fprintf (stderr, " -s silent (no summary)\n\n"); fprintf (stderr, "or to add more types to an existing output:\n"); - fprintf (stderr, " in_file_name -c file1,file2,file3\n", + fprintf (stderr, " in_file_name -c file1,file2,file3\n", program_name); fprintf (stderr, - "or in_file_name -c file1,file2,file3 out_file_name\n", + "or in_file_name -c file1,file2,file3 out_file_name\n", program_name); fprintf (stderr, " -c file1,file2,... concatenate the types in files "); - fprintf (stderr, "file1,file2,...\n (up to 0) ", NUMCFILES); + fprintf (stderr, "file1,file2,...\n (up to 0) ", NUMCFILES); fprintf (stderr, "to those in in_file_name;\n"); fprintf (stderr, - "or in_file_name -C file1 out_file_name\n", + "or in_file_name -C file1 out_file_name\n", program_name); fprintf (stderr, " where file1 contains a list of file names "); fprintf (stderr, "(no limit)\n"); @@ -2323,7 +2323,7 @@ usage() fprintf (stderr, " can update in_file_name or write file out_file_name\n"); fprintf (stderr, "\nor to show the types in a file:\n"); - fprintf (stderr, " -t|-T|-g in_file_name\n", program_name); + fprintf (stderr, " -t|-T|-g in_file_name\n", program_name); fprintf (stderr, " -t detailed trace all the components of the file\n"); fprintf (stderr, @@ -2345,17 +2345,17 @@ usage() fprintf (stderr, " -z show this usage\n"); fprintf (stderr, "\n"); fprintf (stderr, "example:\n"); - fprintf (stderr, " -s vmlinux.pp42 Kerntypes.pp42\n", program_name); + fprintf (stderr, " -s vmlinux.pp42 Kerntypes.pp42\n", program_name); fprintf (stderr, - " -s Kerntypes.pp42 -c module1.o,module2.o\n", program_name); - fprintf (stderr, " -g Kerntypes.pp42\n"); + " -s Kerntypes.pp42 -c module1.o,module2.o\n", program_name); + fprintf (stderr, " -g Kerntypes.pp42\n"); } void open_files (char *in_file_name, char *out_file_name) { if ((infd = open(in_file_name, O_RDONLY)) < 0) { - printf (": open of failed\n", program_name, in_file_name); + printf (": open of failed\n", program_name, in_file_name); exit(1); } @@ -2366,7 +2366,7 @@ open_files (char *in_file_name, char *ou if ((outfd = open(out_file_name, O_RDONLY)) < 0) { if ((outfd = open(out_file_name, O_RDWR| O_CREAT, 0600)) < 0) { - printf (": creation of failed\n", + printf (": creation of failed\n", program_name, out_file_name); exit(1); } @@ -2375,7 +2375,7 @@ open_files (char *in_file_name, char *ou close (outfd); if ((outfd = open(out_file_name, O_RDWR|O_CREAT|O_TRUNC, 0600)) < 0) { - printf (": creation of failed\n", + printf (": creation of failed\n", program_name, out_file_name); exit(1); } @@ -2402,7 +2402,7 @@ alloc_pdie_list(int size) if ((listptr = (Dwarf_P_Die *)malloc(size * sizeof(Dwarf_P_Die))) == NULL) { - printf ("cannot allocate space for 0 Dwarf_P_Die pointers\n", + printf ("cannot allocate space for 0 Dwarf_P_Die pointers\n", size); exit(1); } @@ -2416,7 +2416,7 @@ alloc_offset_list(int size) if ((listptr = (Dwarf_Off *)malloc(size * sizeof(Dwarf_Off))) == NULL) { - printf ("cannot allocate space for 0 Dwarf_Off offsets\n", + printf ("cannot allocate space for 0 Dwarf_Off offsets\n", size); exit(1); } @@ -2430,7 +2430,7 @@ alloc_namep_list(int size) if ((listptr = (char **)malloc(size * sizeof(char *))) == NULL) { - printf ("cannot allocate space for 0 name pointers\n", size); + printf ("cannot allocate space for 0 name pointers\n", size); exit(1); } return listptr; @@ -2443,7 +2443,7 @@ alloc_type_list(int size) if ((listptr = (struct typenode **)malloc(size * sizeof(struct typenode *))) == NULL) { - printf ("cannot allocate space for 0 typenode pointers\n", + printf ("cannot allocate space for 0 typenode pointers\n", size); exit(1); } @@ -2457,7 +2457,7 @@ alloc_dbg_list(int size) if ((listptr = (Dwarf_Debug *)malloc(size * sizeof(Dwarf_Debug))) == NULL) { - printf ("cannot allocate space for 0 Dwarf_Debug\n", + printf ("cannot allocate space for 0 Dwarf_Debug\n", size); exit(1); } @@ -2589,7 +2589,7 @@ addtosavedtypes(char *typenamep, int mem if (debug) { printf ( - "added to the saved types list, offset 0 (0> hash:0\n", + "added to the saved types list, offset 0 (0> hash:0\n", typenamep, offset, offset, member_hash_total); } total_types++; @@ -2599,7 +2599,7 @@ addtosavedtypes(char *typenamep, int mem after = tv.tv_usec; addtime += after-before; if (addcnt % 1000 == 0) { - printf ("adds to 0: 0.000000 usec\n", addcnt, addtime); + printf ("adds to 0: 0.000000 usec\n", addcnt, addtime); addtime = 0.0; } #endif @@ -2629,7 +2629,7 @@ NewtypeNode(int members, unsigned long l node->ptrto = NULL; node->arrto = NULL; if (debug) { - printf ("insert name , die:0 type node:0 offset:0\n", + printf ("insert name , die:0 type node:0 offset:0\n", namep, node->pdie, node, node->offset); } return(node); @@ -2730,7 +2730,7 @@ lookupexit: after = tv.tv_usec; lookuptime += after-before; if (lookupcnt % 1000 == 0) { - printf ("lookups to 0: 0.000000 usec\n", lookupcnt, lookuptime); + printf ("lookups to 0: 0.000000 usec\n", lookupcnt, lookuptime); lookuptime = 0.0; } #endif @@ -2855,7 +2855,7 @@ ref_summary() printf ("/nreferences summary:\n"); for (i=0, dp=ref_diep, rp=ref_refp; i < num_refchecks; i++, dp++, rp++) { - printf ("die:0 ref:0\n", *dp, *rp); + printf ("die:0 ref:0\n", *dp, *rp); } } @@ -2882,17 +2882,17 @@ producer_callback(char *name, int size, section_number = SECTION_RELDEBUGINFO; } else { printf ( - "WARNING: producer_callback received unexpected section name \n", + "WARNING: producer_callback received unexpected section name \n", name); } /* values for .e.g. e_flags */ if (debug) { - printf ("producer_callback: called for \n", name); - printf (" size:0 type:0 flags:0 link:0 info:0\n", + printf ("producer_callback: called for \n", name); + printf (" size:0 type:0 flags:0 link:0 info:0\n", size, type, flags, link, info); printf (" not setting sect_name_index\n"); - printf (" returning section number 0\n", section_number); + printf (" returning section number 0\n", section_number); } return section_number; } @@ -2913,7 +2913,7 @@ read_elf_header(ELF_HEADER *elfp, int fd int i; if (i = lseek(fd, 0, 0) < 0) { - printf ("cannot seek to 0 fd 0\n", fd); + printf ("cannot seek to 0 fd 0\n", fd); exit(1); } if (i = read(fd, elfp, sizeof(ELF_HEADER)) != sizeof(ELF_HEADER)) { @@ -2937,24 +2937,24 @@ setup_input_file() if (verbose) { printf ("input ELF header:\n"); - printf (" e_ident: \n", inelfhdr.e_ident); - printf (" e_machine: 0\n", inelfhdr.e_machine); - printf (" e_phoff: 0\n", inelfhdr.e_phoff); - printf (" e_shoff: 0\n", inelfhdr.e_shoff); - printf (" e_flags: 0\n", inelfhdr.e_flags); - printf (" e_ehsize: 0\n", inelfhdr.e_ehsize); - printf (" e_phentsize: 0\n", inelfhdr.e_phentsize); - printf (" e_phnum: 0\n", inelfhdr.e_phnum); - printf (" e_shentsize: 0\n", inelfhdr.e_shentsize); - printf (" e_shnum: 0\n", inelfhdr.e_shnum); - printf (" e_shstrndx: 0\n", inelfhdr.e_shstrndx); + printf (" e_ident: \n", inelfhdr.e_ident); + printf (" e_machine: 0\n", inelfhdr.e_machine); + printf (" e_phoff: 0\n", inelfhdr.e_phoff); + printf (" e_shoff: 0\n", inelfhdr.e_shoff); + printf (" e_flags: 0\n", inelfhdr.e_flags); + printf (" e_ehsize: 0\n", inelfhdr.e_ehsize); + printf (" e_phentsize: 0\n", inelfhdr.e_phentsize); + printf (" e_phnum: 0\n", inelfhdr.e_phnum); + printf (" e_shentsize: 0\n", inelfhdr.e_shentsize); + printf (" e_shnum: 0\n", inelfhdr.e_shnum); + printf (" e_shstrndx: 0\n", inelfhdr.e_shstrndx); } /* get the section header table */ base_shp = (SECTION_HEADER *)malloc(inelfhdr.e_shnum * inelfhdr.e_shentsize); if (i = lseek(infd, inelfhdr.e_shoff, 0) < 0) { - fprintf(stderr,": cannot seek to 0\n", + fprintf(stderr,": cannot seek to 0\n", program_name, inelfhdr.e_shoff); exit(1); } @@ -2970,15 +2970,15 @@ setup_input_file() if (verbose) { printf ("input Section header table:\n"); for (i=0, shp1=base_shp; i<inelfhdr.e_shnum; i++, shp1++) { - printf (" section 0:\n", i); - printf (" sh_name: 0 ()\n", + printf (" section 0:\n", i); + printf (" sh_name: 0 ()\n", shp1->sh_name, strp+shp1->sh_name); - printf (" sh_type: 0\n", shp1->sh_type); - printf (" sh_flags: 0\n", shp1->sh_flags); - printf (" sh_addr: 0\n", shp1->sh_addr); - printf (" sh_offset: 0\n", shp1->sh_offset); - printf (" sh_size: 0\n", shp1->sh_size); - printf (" sh_entsize: 0\n", shp1->sh_entsize); + printf (" sh_type: 0\n", shp1->sh_type); + printf (" sh_flags: 0\n", shp1->sh_flags); + printf (" sh_addr: 0\n", shp1->sh_addr); + printf (" sh_offset: 0\n", shp1->sh_offset); + printf (" sh_size: 0\n", shp1->sh_size); + printf (" sh_entsize: 0\n", shp1->sh_entsize); } } @@ -3014,17 +3014,17 @@ setup_input_file() if (verbose) { printf ("output ELF header:\n"); - printf (" e_ident: \n", outelfhdr.e_ident); - printf (" e_machine: 0\n", outelfhdr.e_machine); - printf (" e_phoff: 0\n", outelfhdr.e_phoff); - printf (" e_shoff: 0\n", outelfhdr.e_shoff); - printf (" e_flags: 0\n", outelfhdr.e_flags); - printf (" e_ehsize: 0\n", outelfhdr.e_ehsize); - printf (" e_phentsize: 0\n", outelfhdr.e_phentsize); - printf (" e_phnum: 0\n", outelfhdr.e_phnum); - printf (" e_shentsize: 0\n", outelfhdr.e_shentsize); - printf (" e_shnum: 0\n", outelfhdr.e_shnum); - printf (" e_shstrndx: 0\n", outelfhdr.e_shstrndx); + printf (" e_ident: \n", outelfhdr.e_ident); + printf (" e_machine: 0\n", outelfhdr.e_machine); + printf (" e_phoff: 0\n", outelfhdr.e_phoff); + printf (" e_shoff: 0\n", outelfhdr.e_shoff); + printf (" e_flags: 0\n", outelfhdr.e_flags); + printf (" e_ehsize: 0\n", outelfhdr.e_ehsize); + printf (" e_phentsize: 0\n", outelfhdr.e_phentsize); + printf (" e_phnum: 0\n", outelfhdr.e_phnum); + printf (" e_shentsize: 0\n", outelfhdr.e_shentsize); + printf (" e_shnum: 0\n", outelfhdr.e_shnum); + printf (" e_shstrndx: 0\n", outelfhdr.e_shstrndx); } return; @@ -3045,25 +3045,25 @@ trace_input_elf_file(int fd, char *filen if (tflag) { printf ("input ELF header:\n"); - printf (" e_ident: \n", inelfhdr.e_ident); - printf (" e_typ: 0\n", inelfhdr.e_type); - printf (" e_machine: 0\n", inelfhdr.e_machine); - printf (" e_phoff: 0\n", inelfhdr.e_phoff); - printf (" e_shoff: 0\n", inelfhdr.e_shoff); - printf (" e_flags: 0\n", inelfhdr.e_flags); - printf (" e_ehsize: 0\n", inelfhdr.e_ehsize); - printf (" e_phentsize: 0\n", inelfhdr.e_phentsize); - printf (" e_phnum: 0\n", inelfhdr.e_phnum); - printf (" e_shentsize: 0\n", inelfhdr.e_shentsize); - printf (" e_shnum: 0\n", inelfhdr.e_shnum); - printf (" e_shstrndx: 0\n", inelfhdr.e_shstrndx); + printf (" e_ident: \n", inelfhdr.e_ident); + printf (" e_typ: 0\n", inelfhdr.e_type); + printf (" e_machine: 0\n", inelfhdr.e_machine); + printf (" e_phoff: 0\n", inelfhdr.e_phoff); + printf (" e_shoff: 0\n", inelfhdr.e_shoff); + printf (" e_flags: 0\n", inelfhdr.e_flags); + printf (" e_ehsize: 0\n", inelfhdr.e_ehsize); + printf (" e_phentsize: 0\n", inelfhdr.e_phentsize); + printf (" e_phnum: 0\n", inelfhdr.e_phnum); + printf (" e_shentsize: 0\n", inelfhdr.e_shentsize); + printf (" e_shnum: 0\n", inelfhdr.e_shnum); + printf (" e_shstrndx: 0\n", inelfhdr.e_shstrndx); } /* get the section header table */ base_shp = (SECTION_HEADER *)malloc(inelfhdr.e_shnum * inelfhdr.e_shentsize); if (i = lseek(fd, inelfhdr.e_shoff, 0) < 0) { - fprintf(stderr,": cannot seek to 0\n", + fprintf(stderr,": cannot seek to 0\n", program_name, inelfhdr.e_shoff); exit(1); } @@ -3080,15 +3080,15 @@ trace_input_elf_file(int fd, char *filen if (tflag) { printf ("input Section header table:\n"); for (i=0, shp1=base_shp; i<inelfhdr.e_shnum; i++, shp1++) { - printf (" section 0:\n", i); - printf (" sh_name: 0 ()\n", + printf (" section 0:\n", i); + printf (" sh_name: 0 ()\n", shp1->sh_name, strp+shp1->sh_name); - printf (" sh_type: 0\n", shp1->sh_type); - printf (" sh_flags: 0\n", shp1->sh_flags); - printf (" sh_addr: 0\n", shp1->sh_addr); - printf (" sh_offset: 0\n", shp1->sh_offset); - printf (" sh_size: 0\n", shp1->sh_size); - printf (" sh_entsize: 0\n", shp1->sh_entsize); + printf (" sh_type: 0\n", shp1->sh_type); + printf (" sh_flags: 0\n", shp1->sh_flags); + printf (" sh_addr: 0\n", shp1->sh_addr); + printf (" sh_offset: 0\n", shp1->sh_offset); + printf (" sh_size: 0\n", shp1->sh_size); + printf (" sh_entsize: 0\n", shp1->sh_entsize); } } @@ -3107,7 +3107,7 @@ trace_input_elf_file(int fd, char *filen } } if (debug_idx == -1) { - printf ("no debug info found in ; aborted\n", + printf ("no debug info found in ; aborted\n", in_file_name); printf ("(could this be a 2.4 kernel and gcc version 3.2?)\n"); printf ("(for 2.6 we switch from stabs to dwarf debugging)\n"); @@ -3115,7 +3115,7 @@ trace_input_elf_file(int fd, char *filen } if (abbrev_idx == -1) { - printf ("no abbrev info found in ; aborted\n", + printf ("no abbrev info found in ; aborted\n", in_file_name); exit(1); } @@ -3214,7 +3214,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf exit(1); } if (debug) { - printf ("converted die named (at 0) to new die 0\n", + printf ("converted die named (at 0) to new die 0\n", name_of_die(olddie), olddie, newdie); } @@ -3275,7 +3275,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf formtype != DW_FORM_ref2 && formtype != DW_FORM_ref4 && formtype != DW_FORM_ref8) { - printf ("attribute is form 0, not REF\n", + printf ("attribute is form 0, not REF\n", formtype); exit(1); } @@ -3291,7 +3291,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf if (!isptr) { addtoreflist(newdie, globaloffset); if (debug) { - printf("die: made reference to 0 <0>\n", + printf("die: made reference to 0 <0>\n", name_of_die(olddie), globaloffset, globaloffset); } @@ -3452,7 +3452,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf default: { if (debug) { - printf ("die:: ", name_of_die(olddie)); + printf ("die:: ", name_of_die(olddie)); } if (attr_val == DW_AT_stmt_list) { if (debug) @@ -3494,7 +3494,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf if (debug) printf ("ignoring DW_AT_MIPS_linkage_name\n"); } else { - printf (": attribute 0 not converted\n", + printf (": attribute 0 not converted\n", die_name, attr_val); printf ("aborting\n"); exit(1); @@ -3535,7 +3535,7 @@ convert_to_new(Dwarf_Debug olddbg, Dwarf exit(1); } if (debug) { - printf ("kludge: type given to typedef \n", + printf ("kludge: type given to typedef \n", die_name); } } @@ -3558,7 +3558,7 @@ addtoreflist(Dwarf_P_Die die, Dwarf_Off if (num_refchecks >= size_refchecks) { size_refchecks = size_refchecks + (size_refchecks/2); if (pflag) { - printf ("bump size_refchecks to 0 and realloc\n", + printf ("bump size_refchecks to 0 and realloc\n", size_refchecks); } if ((ref_refp = (Dwarf_Off *)realloc((void *)ref_refp, @@ -3581,7 +3581,7 @@ addtoreflist(Dwarf_P_Die die, Dwarf_Off *(ref_refp + num_refchecks) = ref*FMAX + current_file_number; if (debug) { printf( - "adding die 0 reference to 0 to be resolved\n", + "adding die 0 reference to 0 to be resolved\n", die, ref); } @@ -3610,23 +3610,23 @@ do_reference_translations() if (Pflag) { gettimeofday(&tv, &tz); - printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); + printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); } if (verbose || pflag) { if (num_refchecks > INITIAL_REFERENCE) { - printf ("NOTE: increase INITIAL_REFERENCE above 0\n", + printf ("NOTE: increase INITIAL_REFERENCE above 0\n", num_refchecks); } if (num_protos > INITIAL_STRUCTPROTOS) { - printf ("NOTE: increase INITIAL_STRUCTPROTOS above 0\n", + printf ("NOTE: increase INITIAL_STRUCTPROTOS above 0\n", num_protos); } if (num_needptrs > INITIAL_NEEDPOINTERS) { - printf ("NOTE: increase INITIAL_NEEDPOINTERS above 0\n", + printf ("NOTE: increase INITIAL_NEEDPOINTERS above 0\n", num_needptrs); } if (num_needarrs > INITIAL_NEEDARRAYS) { - printf ("NOTE: increase INITIAL_NEEDARRAYS above 0\n", + printf ("NOTE: increase INITIAL_NEEDARRAYS above 0\n", num_needarrs); } } @@ -3635,7 +3635,7 @@ do_reference_translations() } if (pflag) { - printf ("sorting lists of 0, 0 and 0\n", + printf ("sorting lists of 0, 0 and 0\n", num_refchecks, num_needptrs, num_needarrs); } sort_references(); @@ -3676,7 +3676,7 @@ do_reference_translations() make_types_name_ref_hash(); if (pflag) { - printf ("translating references to 0 prototype structures\n", + printf ("translating references to 0 prototype structures\n", num_protos); } /* The protos is a list of all the structure prototypes (by their @@ -3728,10 +3728,10 @@ else { printf ("not found\n"); } } if (Pflag) { gettimeofday(&tv, &tz); - printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); + printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); } if (pflag) { - printf ("re-sorting list of 0\n", num_refchecks); + printf ("re-sorting list of 0\n", num_refchecks); } /* the updated alternate lists become the future lists */ free (ref_refp); @@ -3763,7 +3763,7 @@ else { printf ("not found\n"); } /* fill in the typenode pointer in the list of dies needing a pointer created */ if (pflag) { - printf ("resolving 0 dies needing pointers\n", num_needptrs); + printf ("resolving 0 dies needing pointers\n", num_needptrs); } for (i=0; i<num_needptrs; i++) { fnd = 0; @@ -3785,7 +3785,7 @@ else { printf ("not found\n"); } fnd = 1; } else { printf ( - "needptr slot 0: offset 0 cannot be resolved; ABORT\n\n", + "needptr slot 0: offset 0 cannot be resolved; ABORT\n\n", i, offset); exit(1); } @@ -3835,7 +3835,7 @@ else { printf ("not found\n"); } /* fill in the typenode pointer in the list of dies needing an array link created */ if (pflag) { - printf ("resolving 0 dies needing array links\n",num_needarrs); + printf ("resolving 0 dies needing array links\n",num_needarrs); } for (i=0; i<num_needarrs; i++) { fnd = 0; @@ -3851,7 +3851,7 @@ else { printf ("not found\n"); } fnd = 1; } else { printf ( - "needarr: offset 0 cannot be resolved; ABORT\n\n", + "needarr: offset 0 cannot be resolved; ABORT\n\n", offset); exit(1); } @@ -3881,12 +3881,12 @@ else { printf ("not found\n"); } if (Pflag) { gettimeofday(&tv, &tz); - printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); + printf ("elapsed time: 0 seconds\n", tv.tv_sec-startsec); } /* we've saved pointers to all the dies needing a reference, */ /* along with the global reference number (offset) */ if (pflag) { - printf ("translating 0 type references\n", num_refchecks); + printf ("translating 0 type references\n", num_refchecks); } for (i=0; i<num_refchecks; i++) { /* the die, and what it needs to reference: */ @@ -3894,11 +3894,11 @@ else { printf ("not found\n"); } rp1 = *(ref_refp + i); if (pflag) { if (i > 0 && i % 10000 == 0) { - printf ("0 translated\n", i); + printf ("0 translated\n", i); } } if (debug) { - printf ("translating offset 0 <0>\n", rp1, rp1); + printf ("translating offset 0 <0>\n", rp1, rp1); } /* walk our tree of saved types for a match of what @@ -3912,7 +3912,7 @@ else { printf ("not found\n"); } fnd = 1; dp2 = typep->pdie; if (debug) { - printf ("tree yielded pdie:0\n", dp2); + printf ("tree yielded pdie:0\n", dp2); } } else { if (debug) { @@ -3925,7 +3925,7 @@ else { printf ("not found\n"); } typep = aliasp->typep; dp2 = typep->pdie; if (debug) { - printf ("aliases yielded pdie:0\n", + printf ("aliases yielded pdie:0\n", dp2); } fnd = 1; @@ -3944,8 +3944,8 @@ else { printf ("not found\n"); } /* on this warning, better check the types we choose in is_type_we_want */ printf ( - "cannot translate reference to 0 (0 file 0); ", - rp1, rp1/FMAX, rp1 0.000000MAX); + "cannot translate reference to 0 (0 file 0); ", + rp1, rp1/FMAX, rp1 0.000000MAX); printf ("making it reference long int\n"); aresult = dwarf_add_AT_reference(newdbg, dp1, DW_AT_type, common_base_type_die, @@ -4027,13 +4027,13 @@ convert_subrange(Dwarf_Debug olddbg, Dwa } if (debug) { printf ( - "subrange: converted die named (at 0) to new die 0\n", + "subrange: converted die named (at 0) to new die 0\n", name_of_die(olddie), olddie, newdie); } if (errv == DW_DLV_NO_ENTRY) { /* there were no entries; no list was allocated */ if (debug) { - printf ("warning: no attributes on subrange at 0\n", + printf ("warning: no attributes on subrange at 0\n", current_offset(olddie)); } return newdie; @@ -4068,8 +4068,8 @@ convert_subrange(Dwarf_Debug olddbg, Dwa default: { if (debug) { - printf ("die:: ", name_of_die(olddie)); - printf ("ignoring attribute 0\n", attr_val); + printf ("die:: ", name_of_die(olddie)); + printf ("ignoring attribute 0\n", attr_val); } } } /* end of switch */ @@ -4234,7 +4234,7 @@ trace_file(Elf * elf, int fd) dres = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &dbg, &error); if (dres == DW_DLV_NO_ENTRY) { - printf("No DWARF information present in \n", in_file_name); + printf("No DWARF information present in \n", in_file_name); return; } if (dres != DW_DLV_OK) { @@ -4270,14 +4270,14 @@ trace_file(Elf * elf, int fd) } } if (tflag || Tflag) { - printf ("Compile Unit 0\n", total_cus); - printf (" CU: abbrev offset: 0\n", abbrev_offset); - printf (" CU: address size: 0\n", address_size); - printf (" CU: next cu offset: 0\n", next_cu_offset); + printf ("Compile Unit 0\n", total_cus); + printf (" CU: abbrev offset: 0\n", abbrev_offset); + printf (" CU: address size: 0\n", address_size); + printf (" CU: next cu offset: 0\n", next_cu_offset); } if (debug) { - printf(" CU: header length: 0\n", cu_header_length); - printf(" CU: version stamp: 0\n", version_stamp); + printf(" CU: header length: 0\n", cu_header_length); + printf(" CU: version stamp: 0\n", version_stamp); } tree_level = -1; @@ -4285,7 +4285,7 @@ trace_file(Elf * elf, int fd) /* get first die of the cu */ get_sibling(dbg, NULL, &cu_die); if (tflag || Tflag) { - printf (" CU: name: \n", + printf (" CU: name: \n", name_of_die(cu_die)); } @@ -4336,7 +4336,7 @@ display_die_and_children(Dwarf_Debug dbg test_a_die(dbg, in_die); } else { if (debug) { - printf ("call print_a_die for \n", + printf ("call print_a_die for \n", name_of_die(in_die)); } print_a_die(dbg, in_die); @@ -4434,7 +4434,7 @@ is_type_we_want(Dwarf_Debug dbg, Dwarf_D { if (debug) { printf ( - "is_type_we_want: die 0 named , type 0 rejected\n", + "is_type_we_want: die 0 named , type 0 rejected\n", die, name_of_die(die), tag); } return 0; @@ -4546,7 +4546,7 @@ list_attributes(Dwarf_Debug dbg, Dwarf_D basic information about the die */ if (!Tflag && atcnt > 0) { /* assume it's still set up by print_a_die */ - printf (" attributes: ", indentation_string); + printf (" attributes: ", indentation_string); } /* walk thru the attributes */ for (i=0; i<atcnt; i++) { @@ -4583,7 +4583,7 @@ print_reference(Dwarf_Debug dbg, Dwarf_A Dwarf_Off cuoffset, globaloffset; if (!Tflag) { - printf ("0 ", attr_val); + printf ("0 ", attr_val); } if (attr_val == DW_AT_sibling || attr_val == DW_AT_type) { @@ -4592,24 +4592,24 @@ print_reference(Dwarf_Debug dbg, Dwarf_A /* no need to generate sibling attributes */ } else { if (Tflag) { - printf ("type:0 ", globaloffset); + printf ("type:0 ", globaloffset); } else { - printf ("DW_AT_type ref_offset:0 <0> ", + printf ("DW_AT_type ref_offset:0 <0> ", globaloffset, globaloffset); } } } if (attr_val == DW_AT_data_member_location) { offset = get_offset(dbg, attr, attr_val); - printf ("member_offset:0 <0> ", offset, offset); + printf ("member_offset:0 <0> ", offset, offset); } if (attr_val == DW_AT_location) { offset = get_offset(dbg, attr, attr_val); - printf ("member_location:0 <0> ", offset, offset); + printf ("member_location:0 <0> ", offset, offset); } if (attr_val == DW_AT_upper_bound) { offset = get_upper_bound(attr); - printf ("bound:0 <0> ", offset); + printf ("bound:0 <0> ", offset); } return; @@ -4843,7 +4843,7 @@ get_refoffset(Dwarf_Attribute attr, Dwar result = dwarf_global_formref(attr, offsetp, &err); if (result != DW_DLV_OK) { printf("getref_offset: dwarf_global_fromref error\n"); - printf(" result: 0\n", result); + printf(" result: 0\n", result); exit(1); } return; @@ -5016,7 +5016,7 @@ get_offset(Dwarf_Debug dbg, Dwarf_Attrib dwarf_dealloc(dbg, ptr_blk, DW_DLA_BLOCK); if (debug) { if (attr_val == DW_AT_data_member_location) { - printf ("DW_AT_data_member_location offset:0 <0>\n", + printf ("DW_AT_data_member_location offset:0 <0>\n", offset, offset); } } @@ -5048,7 +5048,7 @@ concatenate (Elf *elf, int fd) dres = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &dbg, &error); if (dres == DW_DLV_NO_ENTRY) { - printf("No DWARF information present in \n", in_file_name); + printf("No DWARF information present in \n", in_file_name); return; } if (dres != DW_DLV_OK) { @@ -5063,7 +5063,7 @@ concatenate (Elf *elf, int fd) exit(1); } if (debug) { - printf ("newdbg created at 0\n", newdbg); + printf ("newdbg created at 0\n", newdbg); } common_base_type_die = (Dwarf_P_Die)0; @@ -5071,15 +5071,15 @@ concatenate (Elf *elf, int fd) * Iterate through dwarf of main input file and extract all type info. */ if (pflag) { - printf ("digesting the base types in \n", + printf ("digesting the base types in \n", in_file_name); } if (debug) { - printf ("walking the CUs tree of \n", in_file_name); + printf ("walking the CUs tree of \n", in_file_name); } walk_cus(dbg, fd); if (debug) { - printf ("total new dies created 0\n", total_newdies); + printf ("total new dies created 0\n", total_newdies); } /* do not release this dbg, we need the name for comparison @@ -5091,9 +5091,9 @@ concatenate (Elf *elf, int fd) } if (!sflag) { - printf ("input file:\t\t\t\t\n", in_file_name); - printf ("compilation units:\t\t0\n", total_cus); - printf ("structures captured:\t\t0\n", total_structs); + printf ("input file:\t\t\t\t\n", in_file_name); + printf ("compilation units:\t\t0\n", total_cus); + printf ("structures captured:\t\t0\n", total_structs); } for (filenumber=0; filenumber<num_cfiles; filenumber++) { @@ -5101,7 +5101,7 @@ concatenate (Elf *elf, int fd) make them unique by file */ filename = cfilep[filenumber]; if ((concat_fd = open(filename, O_RDONLY)) < 0) { - printf ("cannot open \n", filename); + printf ("cannot open \n", filename); perror("Open failed"); exit(1); } @@ -5128,7 +5128,7 @@ concatenate (Elf *elf, int fd) close (infd); if ((outfd = open(in_file_name, O_RDWR|O_CREAT|O_TRUNC, 0600)) < 0) { - printf (": overwrite of failed\n", + printf (": overwrite of failed\n", program_name, in_file_name); exit(1); } @@ -5136,7 +5136,7 @@ concatenate (Elf *elf, int fd) write_output_file(); if (!sflag) { - printf ("output file:\t\t\t\t\n", + printf ("output file:\t\t\t\t\n", in_place ? in_file_name : out_file_name); } @@ -5164,22 +5164,22 @@ get_strings(int adjust) } in_string_buffer = (char *)malloc(in_string_size + reldebug_strlen); if (debug) { - printf ("allocated 0 bytes for string section\n", + printf ("allocated 0 bytes for string section\n", in_string_size); } if (tflag) { - printf ("allocated 0 bytes for string section\n", + printf ("allocated 0 bytes for string section\n", in_string_size + reldebug_strlen); } if (i = lseek(infd, string_shp->sh_offset, 0) < 0) { - fprintf(stderr,": cannot seek to 0\n", + fprintf(stderr,": cannot seek to 0\n", program_name, string_shp->sh_offset); exit(1); } if (tflag) { - printf ("seek to 0 for string section okay\n", + printf ("seek to 0 for string section okay\n", string_shp->sh_offset); - printf ("will read 0 bytes of string section\n", + printf ("will read 0 bytes of string section\n", in_string_size); } if (i = read(infd,in_string_buffer,in_string_size) != in_string_size) { @@ -5213,7 +5213,7 @@ get_strings_basic(int fd, SECTION_HEADER size = string_shp->sh_size; buffer = (char *)malloc(size); if (i = lseek(fd, string_shp->sh_offset, 0) < 0) { - fprintf(stderr,": cannot seek to 0\n", + fprintf(stderr,": cannot seek to 0\n", program_name, string_shp->sh_offset); exit(1); } @@ -5237,7 +5237,7 @@ get_debug_sectionhead(int fd, SECTION_HE first = (SECTION_HEADER *)malloc(num * size); if (i = lseek(fd, off, 0) < 0) { - fprintf(stderr,": cannot seek to 0\n", program_name, off); + fprintf(stderr,": cannot seek to 0\n", program_name, off); exit(1); } if (i = read(fd, first, num*size) != num*size) { @@ -5442,7 +5442,7 @@ byte_get_big_endian (unsigned char *fiel | (((bfd_vma) (field[0])) << 56); #endif default: - printf("Unhandled data length: 0\n", size); + printf("Unhandled data length: 0\n", size); exit(1); } } @@ -5472,7 +5472,7 @@ byte_put_big_endian (unsigned char *fiel field[0] = value & 0xff; break; default: - printf("Unhandled data length: 0\n", size); + printf("Unhandled data length: 0\n", size); exit (1); } } @@ -5517,7 +5517,7 @@ byte_get_little_endian (unsigned char *f | (((bfd_vma) (field[7])) << 56); #endif default: - printf ("Unhandled data length: 0\n", size); + printf ("Unhandled data length: 0\n", size); exit (1); } } @@ -5544,7 +5544,7 @@ byte_put_little_endian (unsigned char *f break; default: - printf ("Unhandled data length: 0\n", size); + printf ("Unhandled data length: 0\n", size); exit(1); } } @@ -5626,7 +5626,7 @@ get_data (void *var, int fd, long offset } if (i = lseek(fd, offset, 0) < 0) { - printf ("cannot seek to 0 in fd 0\n", offset, fd); + printf ("cannot seek to 0 in fd 0\n", offset, fd); exit(1); } @@ -5634,13 +5634,13 @@ get_data (void *var, int fd, long offset if (mvar == NULL) { mvar = malloc (size); if (mvar == NULL) { - printf("Out of memory allocating 0x0 bytes\n", size); + printf("Out of memory allocating 0x0 bytes\n", size); return NULL; } } if (i = read(fd, mvar, size) != size) { - printf("Unable to read in 0x0 bytes\n", size); + printf("Unable to read in 0x0 bytes\n", size); if (mvar != var) { free (mvar); } @@ -6050,10 +6050,10 @@ printTree(struct avl_table *tree) avl_t_init(&my_trav, tree); node = (struct typenode *)avl_t_first(&my_trav, tree); while (node) { - printf ("0: (0)(0)(0)(0)()", + printf ("0: (0)(0)(0)(0)()", node,node->members,node->hash,node->size, node->tag,node->namep); - printf ("ref:0\n", node->offset); + printf ("ref:0\n", node->offset); node = (struct typenode *)avl_t_next(&my_trav); } return; @@ -6077,9 +6077,9 @@ printTree(struct typenode *node) printTree(node->left); cp = node->namep; - printf ("0: (0)(0)(0)(0)()", + printf ("0: (0)(0)(0)(0)()", node,node->members,node->hash,node->size,node->tag,node->namep); - printf ("ref:0 left:0 right:0 ", + printf ("ref:0 left:0 right:0 ", node->offset,node->left,node->right); printTree(node->right); } @@ -6222,7 +6222,7 @@ lookup_type_name(char *namep, struct typ if (num_ndecl > 1) { if (verbose) { printf( - "Warning: ambiguous name \n", + "Warning: ambiguous name \n", namep); } } |