From: Fred Fish Date: Mon, 23 May 2005 17:44:55 +0000 (+0000) Subject: Approved by nickc@redhat.com X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4ab527b0538fcb65673a93dc775c39a2e7ccb6d7;p=binutils-gdb.git Approved by nickc@redhat.com 2005-05-23 Fred Fish * dwarf2.c (struct dwarf2_debug): Add inliner_chain member. (struct funcinfo): Add caller_func, caller_file, caller_line. tag, and nesting_level members. (lookup_address_in_function_table): Change first passed parameter from "struct funcinfo *" to "struct comp_unit *". (lookup_address_in_function_table): Dereference unit to find function table. (lookup_address_in_function_table): Traverse the function list to create a chain of inlined functions back to the first non inlined function. (scan_unit_for_functions): Remember tag and nesting level. Handle DW_AT_call_file and DW_AT_call_line. (comp_unit_find_nearest_line): Adjust lookup_address_in_function_table call to pass unit pointer instead of function table pointer. For inlined functions, save pointer to the inliner chain. (_bfd_dwarf2_find_nearest_line): Initialize inliner_chain to NULL. (_bfd_dwarf2_find_inliner_info): New function that returns information from the inliner chain after a call to bfd_find_nearest_line. * bfd.c (bfd_find_inliner_info): Define using BFD_SEND. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Add entry for NAME##_find_inliner_info. (bfd_target): Add _bfd_find_inliner_info. * bfd-in2.h: Regenerate. * libbfd-in.h (_bfd_nosymbols_find_inliner_info): Define as macro that always returns bfd_false. (_bfd_dwarf2_find_inliner_info): Declare. * libbfd.h: Regenerate. * elf32-arm.c (elf32_arm_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. (bfd_elf32_find_inliner_info): Define to elf32_arm_find_inliner_info. * elfxx-mips.c (_bfd_mips_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elfxx-mips.h (_bfd_mips_elf_find_inliner_info): Declare. * elfn32-mips.c (bfd_elf32_find_inliner_info): Define to _bfd_mips_elf_find_inliner_info. * elf64-mips.c (bfd_elf64_find_inliner_info): Ditto. * elf32-mips.c (bfd_elf32_find_inliner_info): Ditto. * elf.c (_bfd_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elf-bfd.h (_bfd_elf_find_inliner_info): Declare. * elfxx-target.h (bfd_elfNN_find_inliner_info): Define to _bfd_elf_find_inliner_info. * coffgen.c (coff_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * libcoff-in.h (coff_find_inliner_info): Declare. * libcoff.h: Regenerate. * coff-rs6000.c (rs6000coff_vec): Add coff_find_inliner_info. (pmac_xcoff_vec) Ditto. * coff64-rs6000.c (rs6000coff64_vec): Ditto. (aix5coff64_vec): Ditto. * aout-target.h (MY_find_inliner_info): Define as _bfd_nosymbols_find_inliner_info. * aout-tic30.c (MY_find_inliner_info): Ditto. * binary.c (binary_find_inliner_info): Ditto. * i386msdos.c (msdos_find_inliner_info): Ditto. * ihex.c (ihex_find_inliner_info): Ditto. * libaout.h (aout_32_find_inliner_info): Ditto. * libecoff.h (_bfd_ecoff_find_inliner_info): Ditto. * mach-o.c (bfd_mach_o_find_inliner_info): Ditto. * mmo.c (mmo_find_inliner_info): Ditto. * nlm-target.h (nlm_find_inliner_info): Ditto. * pef.c (bfd_pef_find_inliner_info): Ditto. * ppcboot.c (ppcboot_find_inliner_info): Ditto. * srec.c (srec_find_inliner_info): Ditto. * tekhex.c (tekhex_find_inliner_info): Ditto. * versados.c (versados_find_inliner_info): Ditto. * xsym.c (bfd_sym_find_inliner_info): Ditto. * ieee.c (ieee_find_inliner_info): New function that always returns FALSE. * oasys.c (oasys_find_inliner_info): Ditto. * vms.c (vms_find_inliner_info): Ditto. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 78035203681..8dd00fce5d7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,85 @@ +2005-05-23 Fred Fish + + * dwarf2.c (struct dwarf2_debug): Add inliner_chain member. + (struct funcinfo): Add caller_func, caller_file, caller_line. + tag, and nesting_level members. + (lookup_address_in_function_table): Change first passed parameter + from "struct funcinfo *" to "struct comp_unit *". + (lookup_address_in_function_table): Dereference unit to find function + table. + (lookup_address_in_function_table): Traverse the function list to + create a chain of inlined functions back to the first non inlined + function. + (scan_unit_for_functions): Remember tag and nesting level. Handle + DW_AT_call_file and DW_AT_call_line. + (comp_unit_find_nearest_line): Adjust lookup_address_in_function_table + call to pass unit pointer instead of function table pointer. For + inlined functions, save pointer to the inliner chain. + (_bfd_dwarf2_find_nearest_line): Initialize inliner_chain to NULL. + (_bfd_dwarf2_find_inliner_info): New function that returns information + from the inliner chain after a call to bfd_find_nearest_line. + + * bfd.c (bfd_find_inliner_info): Define using BFD_SEND. + * targets.c (BFD_JUMP_TABLE_SYMBOLS): Add entry for + NAME##_find_inliner_info. + (bfd_target): Add _bfd_find_inliner_info. + * bfd-in2.h: Regenerate. + + * libbfd-in.h (_bfd_nosymbols_find_inliner_info): Define as + macro that always returns bfd_false. + (_bfd_dwarf2_find_inliner_info): Declare. + * libbfd.h: Regenerate. + + * elf32-arm.c (elf32_arm_find_inliner_info): New function + that calls _bfd_dwarf2_find_inliner_info. + (bfd_elf32_find_inliner_info): Define to elf32_arm_find_inliner_info. + + * elfxx-mips.c (_bfd_mips_elf_find_inliner_info): New function + that calls _bfd_dwarf2_find_inliner_info. + * elfxx-mips.h (_bfd_mips_elf_find_inliner_info): Declare. + * elfn32-mips.c (bfd_elf32_find_inliner_info): Define to + _bfd_mips_elf_find_inliner_info. + * elf64-mips.c (bfd_elf64_find_inliner_info): Ditto. + * elf32-mips.c (bfd_elf32_find_inliner_info): Ditto. + + * elf.c (_bfd_elf_find_inliner_info): New function that calls + _bfd_dwarf2_find_inliner_info. + * elf-bfd.h (_bfd_elf_find_inliner_info): Declare. + * elfxx-target.h (bfd_elfNN_find_inliner_info): Define to + _bfd_elf_find_inliner_info. + + * coffgen.c (coff_find_inliner_info): New function that + calls _bfd_dwarf2_find_inliner_info. + * libcoff-in.h (coff_find_inliner_info): Declare. + * libcoff.h: Regenerate. + * coff-rs6000.c (rs6000coff_vec): Add coff_find_inliner_info. + (pmac_xcoff_vec) Ditto. + * coff64-rs6000.c (rs6000coff64_vec): Ditto. + (aix5coff64_vec): Ditto. + + * aout-target.h (MY_find_inliner_info): Define as + _bfd_nosymbols_find_inliner_info. + * aout-tic30.c (MY_find_inliner_info): Ditto. + * binary.c (binary_find_inliner_info): Ditto. + * i386msdos.c (msdos_find_inliner_info): Ditto. + * ihex.c (ihex_find_inliner_info): Ditto. + * libaout.h (aout_32_find_inliner_info): Ditto. + * libecoff.h (_bfd_ecoff_find_inliner_info): Ditto. + * mach-o.c (bfd_mach_o_find_inliner_info): Ditto. + * mmo.c (mmo_find_inliner_info): Ditto. + * nlm-target.h (nlm_find_inliner_info): Ditto. + * pef.c (bfd_pef_find_inliner_info): Ditto. + * ppcboot.c (ppcboot_find_inliner_info): Ditto. + * srec.c (srec_find_inliner_info): Ditto. + * tekhex.c (tekhex_find_inliner_info): Ditto. + * versados.c (versados_find_inliner_info): Ditto. + * xsym.c (bfd_sym_find_inliner_info): Ditto. + + * ieee.c (ieee_find_inliner_info): New function that always + returns FALSE. + * oasys.c (oasys_find_inliner_info): Ditto. + * vms.c (vms_find_inliner_info): Ditto. + 2005-05-24 Alan Modra * elf32-ppc.c (ppc_elf_check_relocs): For old gcc -fPIC code diff --git a/bfd/aout-target.h b/bfd/aout-target.h index b12be65791f..5a30eda7414 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -462,6 +462,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) #ifndef MY_find_nearest_line #define MY_find_nearest_line NAME (aout, find_nearest_line) #endif +#ifndef MY_find_inliner_info +#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info +#endif #ifndef MY_sizeof_headers #define MY_sizeof_headers NAME (aout, sizeof_headers) #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 532c99d2090..0feb99decb1 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -904,6 +904,9 @@ tic30_aout_set_arch_mach (bfd *abfd, #ifndef MY_find_nearest_line #define MY_find_nearest_line NAME (aout, find_nearest_line) #endif +#ifndef MY_find_inliner_info +#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info +#endif #ifndef MY_sizeof_headers #define MY_sizeof_headers NAME (aout, sizeof_headers) #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index b1664758c11..f4b82b8bb22 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -4307,6 +4307,10 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); BFD_SEND (abfd, _bfd_find_nearest_line, \ (abfd, sec, syms, off, file, func, line)) +#define bfd_find_inliner_info(abfd, file, func, line) \ + BFD_SEND (abfd, _bfd_find_inliner_info, \ + (abfd, file, func, line)) + #define bfd_debug_info_start(abfd) \ BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) @@ -4643,6 +4647,7 @@ typedef struct bfd_target NAME##_bfd_is_target_special_symbol, \ NAME##_get_lineno, \ NAME##_find_nearest_line, \ + NAME##_find_inliner_info, \ NAME##_bfd_make_debug_symbol, \ NAME##_read_minisymbols, \ NAME##_minisymbol_to_symbol @@ -4664,6 +4669,8 @@ typedef struct bfd_target bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, const char **, const char **, unsigned int *); + bfd_boolean (*_bfd_find_inliner_info) + (bfd *, const char **, const char **, unsigned int *); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ diff --git a/bfd/bfd.c b/bfd/bfd.c index 8c6ca924cd9..f62411b7f27 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1161,6 +1161,10 @@ DESCRIPTION . BFD_SEND (abfd, _bfd_find_nearest_line, \ . (abfd, sec, syms, off, file, func, line)) . +.#define bfd_find_inliner_info(abfd, file, func, line) \ +. BFD_SEND (abfd, _bfd_find_inliner_info, \ +. (abfd, file, func, line)) +. .#define bfd_debug_info_start(abfd) \ . BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) . diff --git a/bfd/binary.c b/bfd/binary.c index b9a4d348d92..458626f02a3 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -216,6 +216,7 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name #define binary_get_lineno _bfd_nosymbols_get_lineno #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line +#define binary_find_inliner_info _bfd_nosymbols_find_inliner_info #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define binary_read_minisymbols _bfd_generic_read_minisymbols #define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 3d37c186ae9..e921e98e844 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -4166,6 +4166,7 @@ const bfd_target rs6000coff_vec = coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -4413,6 +4414,7 @@ const bfd_target pmac_xcoff_vec = coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 066723054d6..a0b22946267 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2713,6 +2713,7 @@ const bfd_target rs6000coff64_vec = coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -2961,6 +2962,7 @@ const bfd_target aix5coff64_vec = coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 35ec85a1d69..c541e6a590e 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2223,6 +2223,20 @@ coff_find_nearest_line (bfd *abfd, return TRUE; } +bfd_boolean +coff_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + &coff_data(abfd)->dwarf2_find_line_info); + return (found); +} + int coff_sizeof_headers (bfd *abfd, bfd_boolean reloc) { diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 365758a2c49..32f0b4443d0 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -118,6 +118,12 @@ struct dwarf2_debug /* Length of the loaded .debug_ranges section. */ unsigned long dwarf_ranges_size; + + /* If the most recent call to bfd_find_nearest_line was given an + address in an inlined function, preserve a pointer into the + calling chain for subsequent calls to bfd_find_inliner_info to + use. */ + struct funcinfo *inliner_chain; }; struct arange @@ -680,9 +686,19 @@ struct line_info_table struct line_info* lcl_head; /* local head; used in 'add_line_info' */ }; +/* Remember some information about each function. If the function is + inlined (DW_TAG_inlined_subroutine) it may have two additional + attributes, DW_AT_call_file and DW_AT_call_line, which specify the + source code location where this function was inlined. */ + struct funcinfo { - struct funcinfo *prev_func; + struct funcinfo *prev_func; /* Pointer to previous function in list of all functions */ + struct funcinfo *caller_func; /* Pointer to function one scope higher */ + char *caller_file; /* Source location file name where caller_func inlines this func */ + int caller_line; /* Source location line number where caller_func inlines this func */ + int tag; + int nesting_level; char *name; struct arange arange; }; @@ -1340,7 +1356,7 @@ read_debug_ranges (struct comp_unit *unit) depending upon them being ordered in TABLE by increasing range. */ static bfd_boolean -lookup_address_in_function_table (struct funcinfo *table, +lookup_address_in_function_table (struct comp_unit *unit, bfd_vma addr, struct funcinfo **function_ptr, const char **functionname_ptr) @@ -1349,7 +1365,7 @@ lookup_address_in_function_table (struct funcinfo *table, struct funcinfo* best_fit = NULL; struct arange *arange; - for (each_func = table; + for (each_func = unit->function_table; each_func; each_func = each_func->prev_func) { @@ -1368,8 +1384,28 @@ lookup_address_in_function_table (struct funcinfo *table, if (best_fit) { + struct funcinfo* curr_func = best_fit; + *functionname_ptr = best_fit->name; *function_ptr = best_fit; + + /* If we found a match and it is a function that was inlined, + traverse the function list looking for the function at the + next higher scope and save a pointer to it for future use. + Note that because of the way the DWARF info is generated, and + the way we build the function list, the first function at the + next higher level is the one we want. */ + + for (each_func = best_fit -> prev_func; + each_func && (curr_func->tag == DW_TAG_inlined_subroutine); + each_func = each_func->prev_func) + { + if (each_func->nesting_level < curr_func->nesting_level) + { + curr_func->caller_func = each_func; + curr_func = each_func; + } + } return TRUE; } else @@ -1508,6 +1544,8 @@ scan_unit_for_functions (struct comp_unit *unit) { bfd_size_type amt = sizeof (struct funcinfo); func = bfd_zalloc (abfd, amt); + func->tag = abbrev->tag; + func->nesting_level = nesting_level; func->prev_func = unit->function_table; unit->function_table = func; } @@ -1522,6 +1560,14 @@ scan_unit_for_functions (struct comp_unit *unit) { switch (attr.name) { + case DW_AT_call_file: + func->caller_file = concat_filename (unit->line_table, attr.u.val); + break; + + case DW_AT_call_line: + func->caller_line = attr.u.val; + break; + case DW_AT_abstract_origin: func->name = find_abstract_instance_name (unit, attr.u.val); break; @@ -1796,8 +1842,10 @@ comp_unit_find_nearest_line (struct comp_unit *unit, } function = NULL; - func_p = lookup_address_in_function_table (unit->function_table, addr, + func_p = lookup_address_in_function_table (unit, addr, &function, functionname_ptr); + if (func_p && (function->tag == DW_TAG_inlined_subroutine)) + stash->inliner_chain = function; line_p = lookup_address_in_line_info_table (unit->line_table, addr, function, filename_ptr, linenumber_ptr); @@ -1954,6 +2002,8 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, if (! stash->info_ptr) return FALSE; + stash->inliner_chain = NULL; + /* Check the previously read comp. units first. */ for (each = stash->all_comp_units; each; each = each->next_unit) if (comp_unit_contains_address (each, addr)) @@ -2047,6 +2097,32 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, return FALSE; } +bfd_boolean +_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr, + void **pinfo) +{ + struct dwarf2_debug *stash; + + stash = *pinfo; + if (stash) + { + struct funcinfo *func = stash->inliner_chain; + if (func && func->caller_func) + { + *filename_ptr = func->caller_file; + *functionname_ptr = func->caller_func->name; + *linenumber_ptr = func->caller_line; + stash->inliner_chain = func->caller_func; + return (TRUE); + } + } + + return (FALSE); +} + void _bfd_dwarf2_cleanup_debug_info (bfd *abfd) { diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index ca51e35adb8..53f2845be9e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1488,6 +1488,8 @@ extern bfd_boolean _bfd_elf_set_arch_mach extern bfd_boolean _bfd_elf_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean _bfd_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol extern int _bfd_elf_sizeof_headers diff --git a/bfd/elf.c b/bfd/elf.c index b6ec5c98ad7..4ff1d256ce1 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -6672,6 +6672,25 @@ _bfd_elf_find_nearest_line (bfd *abfd, return TRUE; } +/* After a call to bfd_find_nearest_line, successive calls to + bfd_find_inliner_info can be used to get source information about + each level of function inlining that terminated at the address + passed to bfd_find_nearest_line. Currently this is only supported + for DWARF2 with appropriate DWARF3 extensions. */ + +bfd_boolean +_bfd_elf_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + int _bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) { diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 34c887d2699..af46138baa6 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -5289,6 +5289,19 @@ elf32_arm_find_nearest_line (bfd * abfd, return TRUE; } +static bfd_boolean +elf32_arm_find_inliner_info (bfd * abfd, + const char ** filename_ptr, + const char ** functionname_ptr, + unsigned int * line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + /* Adjust a symbol defined by a dynamic object and referenced by a regular object. The current definition is in some section of the dynamic object, but we're not including those sections. We have to @@ -6810,6 +6823,7 @@ const struct elf_size_info elf32_arm_size_info = { #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line +#define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info #define bfd_elf32_new_section_hook elf32_arm_new_section_hook #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 0ed4b440696..9684d0bf854 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1573,6 +1573,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define bfd_elf32_bfd_is_local_label_name \ mips_elf_is_local_label_name #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line +#define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index cc226e570ab..7f0bb12e670 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -3102,6 +3102,7 @@ const struct elf_size_info mips_elf64_size_info = MIPS-specific function only applies to IRIX5, which had no 64-bit ABI. */ #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line +#define bfd_elf64_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf64_bfd_get_relocated_section_contents \ diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 102b9acd13c..b4fafb7e41b 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -2356,6 +2356,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line +#define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 6e5d968a275..c0bcfc5512c 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -8625,6 +8625,20 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, filename_ptr, functionname_ptr, line_ptr); } + +bfd_boolean +_bfd_mips_elf_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + /* When are writing out the .options or .MIPS.options section, remember the bytes we are writing out, so that we can install the diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 6d9b3487900..624d4ab7ce7 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -81,6 +81,8 @@ extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs extern bfd_boolean _bfd_mips_elf_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean _bfd_mips_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern bfd_boolean _bfd_mips_elf_set_section_contents (bfd *, asection *, const void *, file_ptr, bfd_size_type); extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 77b29cc7853..fcfd0402d9c 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -44,6 +44,9 @@ #ifndef bfd_elfNN_find_nearest_line #define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line #endif +#ifndef bfd_elfNN_find_inliner_info +#define bfd_elfNN_find_inliner_info _bfd_elf_find_inliner_info +#endif #define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols #define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol #define bfd_elfNN_get_dynamic_symtab_upper_bound \ diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 1e747efd5d2..bb25acd7324 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -169,6 +169,7 @@ msdos_set_section_contents (abfd, section, location, offset, count) #define msdos_print_symbol _bfd_nosymbols_print_symbol #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line +#define msdos_find_inliner_info _bfd_nosymbols_find_inliner_info #define msdos_get_lineno _bfd_nosymbols_get_lineno #define msdos_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name diff --git a/bfd/ieee.c b/bfd/ieee.c index e2b0b6aeb85..b517c02a3f8 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -3664,6 +3664,15 @@ ieee_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, return FALSE; } +static bfd_boolean +ieee_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr ATTRIBUTE_UNUSED, + const char **functionname_ptr ATTRIBUTE_UNUSED, + unsigned int *line_ptr ATTRIBUTE_UNUSED) +{ + return FALSE; +} + static int ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf) { diff --git a/bfd/ihex.c b/bfd/ihex.c index 8e9a4bbebe2..fb2ab96c99e 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -920,6 +920,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUS #define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define ihex_get_lineno _bfd_nosymbols_get_lineno #define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line +#define ihex_find_inliner_info _bfd_nosymbols_find_inliner_info #define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols #define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol diff --git a/bfd/libaout.h b/bfd/libaout.h index 6b326939b22..79f540221ef 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -590,6 +590,12 @@ extern bfd_boolean NAME (aout, final_link) extern bfd_boolean NAME (aout, bfd_free_cached_info) (bfd *); +#define aout_32_find_inliner_info _bfd_nosymbols_find_inliner_info +#if 0 /* Are these needed? */ +#define aout_16_find_inliner_info _bfd_nosymbols_find_inliner_info +#define aout_64_find_inliner_info _bfd_nosymbols_find_inliner_info +#endif + /* A.out uses the generic versions of these routines... */ #define aout_16_get_section_contents _bfd_generic_get_section_contents diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 18c9e69fa69..84236f9d570 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -312,6 +312,9 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ const char **, unsigned int *)) \ bfd_false) +#define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ + bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ @@ -425,6 +428,10 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *, unsigned int, void **); +/* Find inliner info after calling bfd_find_nearest_line. */ +extern bfd_boolean _bfd_dwarf2_find_inliner_info + (bfd *, const char **, const char **, unsigned int *, void **); + /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 5b83a81c036..f2d51efb9e1 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -317,6 +317,9 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ const char **, unsigned int *)) \ bfd_false) +#define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ + bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ @@ -430,6 +433,10 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *, unsigned int, void **); +/* Find inliner info after calling bfd_find_nearest_line. */ +extern bfd_boolean _bfd_dwarf2_find_inliner_info + (bfd *, const char **, const char **, unsigned int *, void **); + /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index a6707278585..490f2a80462 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -345,6 +345,8 @@ extern asymbol *coff_bfd_make_debug_symbol extern bfd_boolean coff_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers (bfd *, bfd_boolean); extern bfd_boolean bfd_coff_reloc16_relax_section diff --git a/bfd/libcoff.h b/bfd/libcoff.h index decd146ab29..67ff404895a 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -349,6 +349,8 @@ extern asymbol *coff_bfd_make_debug_symbol extern bfd_boolean coff_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers (bfd *, bfd_boolean); extern bfd_boolean bfd_coff_reloc16_relax_section diff --git a/bfd/libecoff.h b/bfd/libecoff.h index becc75cc153..8c5e218ee58 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -289,6 +289,7 @@ extern bfd_boolean _bfd_ecoff_find_nearest_line #define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define _bfd_ecoff_find_inliner_info _bfd_nosymbols_find_inliner_info #define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound extern long _bfd_ecoff_canonicalize_reloc diff --git a/bfd/mach-o.c b/bfd/mach-o.c index f25b42bcff4..6991612f07c 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -48,6 +48,7 @@ #define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name #define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno #define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_mach_o_find_inliner_info _bfd_nosymbols_find_inliner_info #define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymbols #define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/mmo.c b/bfd/mmo.c index e7543d92338..a4559e1ba27 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -3202,6 +3202,7 @@ mmo_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED, /* FIXME: We can do better on this one, if we have a dwarf2 .debug_line section or if MMO line numbers are implemented. */ #define mmo_find_nearest_line _bfd_nosymbols_find_nearest_line +#define mmo_find_inliner_info _bfd_nosymbols_find_inliner_info #define mmo_make_empty_symbol _bfd_generic_make_empty_symbol #define mmo_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define mmo_read_minisymbols _bfd_generic_read_minisymbols diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index f99aa429ee6..3358aef8e75 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -29,6 +29,7 @@ #define nlm_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define nlm_get_lineno _bfd_nosymbols_get_lineno #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line +#define nlm_find_inliner_info _bfd_nosymbols_find_inliner_info #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define nlm_read_minisymbols _bfd_generic_read_minisymbols #define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/oasys.c b/bfd/oasys.c index 2813d4d0541..2647f82f00c 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1132,6 +1132,15 @@ oasys_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, return FALSE; } +static bfd_boolean +oasys_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr ATTRIBUTE_UNUSED, + const char **functionname_ptr ATTRIBUTE_UNUSED, + unsigned int *line_ptr ATTRIBUTE_UNUSED) +{ + return FALSE; +} + static int oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf) { diff --git a/bfd/pef.c b/bfd/pef.c index d9e05b1d526..2aca6a445b7 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -37,6 +37,7 @@ #define bfd_pef_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define bfd_pef_get_lineno _bfd_nosymbols_get_lineno #define bfd_pef_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_pef_find_inliner_info _bfd_nosymbols_find_inliner_info #define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define bfd_pef_read_minisymbols _bfd_generic_read_minisymbols #define bfd_pef_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 87cacfa81aa..7c8a4190bac 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -350,6 +350,7 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret) #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name #define ppcboot_get_lineno _bfd_nosymbols_get_lineno #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line +#define ppcboot_find_inliner_info _bfd_nosymbols_find_inliner_info #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ppcboot_read_minisymbols _bfd_generic_read_minisymbols #define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/srec.c b/bfd/srec.c index 32aaca918e6..2b24f46ffb6 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1188,6 +1188,7 @@ srec_print_symbol (bfd *abfd, #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name #define srec_get_lineno _bfd_nosymbols_get_lineno #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line +#define srec_find_inliner_info _bfd_nosymbols_find_inliner_info #define srec_make_empty_symbol _bfd_generic_make_empty_symbol #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define srec_read_minisymbols _bfd_generic_read_minisymbols diff --git a/bfd/targets.c b/bfd/targets.c index a9e4c1ecdcb..50b3eeb5003 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -349,6 +349,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_is_target_special_symbol, \ . NAME##_get_lineno, \ . NAME##_find_nearest_line, \ +. NAME##_find_inliner_info, \ . NAME##_bfd_make_debug_symbol, \ . NAME##_read_minisymbols, \ . NAME##_minisymbol_to_symbol @@ -370,6 +371,8 @@ BFD_JUMP_TABLE macros. . bfd_boolean (*_bfd_find_nearest_line) . (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, . const char **, const char **, unsigned int *); +. bfd_boolean (*_bfd_find_inliner_info) +. (bfd *, const char **, const char **, unsigned int *); . {* Back-door to allow format-aware applications to create debug symbols . while using BFD for everything else. Currently used by the assembler . when creating COFF files. *} diff --git a/bfd/tekhex.c b/bfd/tekhex.c index a2017d229dc..559f21afb5c 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -895,6 +895,7 @@ tekhex_print_symbol (bfd *abfd, #define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name #define tekhex_get_lineno _bfd_nosymbols_get_lineno #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line +#define tekhex_find_inliner_info _bfd_nosymbols_find_inliner_info #define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define tekhex_read_minisymbols _bfd_generic_read_minisymbols #define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/versados.c b/bfd/versados.c index f04cc3726db..fb6cfbd22ac 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -792,6 +792,7 @@ versados_canonicalize_reloc (bfd *abfd, #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name #define versados_get_lineno _bfd_nosymbols_get_lineno #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line +#define versados_find_inliner_info _bfd_nosymbols_find_inliner_info #define versados_make_empty_symbol _bfd_generic_make_empty_symbol #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define versados_read_minisymbols _bfd_generic_read_minisymbols diff --git a/bfd/vms.c b/bfd/vms.c index 69888671863..cdac3813012 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -972,6 +972,19 @@ vms_find_nearest_line (bfd * abfd ATTRIBUTE_UNUSED, return FALSE; } +static bfd_boolean +vms_find_inliner_info (bfd * abfd ATTRIBUTE_UNUSED, + const char **file ATTRIBUTE_UNUSED, + const char **func ATTRIBUTE_UNUSED, + unsigned int *line ATTRIBUTE_UNUSED) +{ +#if VMS_DEBUG + vms_debug (1, "vms_find_inliner_info (%p, , , )\n", + abfd); +#endif + return FALSE; +} + /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ diff --git a/bfd/xsym.c b/bfd/xsym.c index e38f9baca21..9659a65e021 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -30,6 +30,7 @@ #define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol