https://sourceware.org/bugzilla/show_bug.cgi?id=29075

Aaron Merey <amerey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14097|0                           |1
        is obsolete|                            |
  Attachment #14299|0                           |1
        is obsolete|                            |

--- Comment #25 from Aaron Merey <amerey at redhat dot com> ---
Created attachment 14311
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14311&action=edit
0001-bfd-Add-bfd_find_nearest_line_with_alt.patch

(In reply to Nick Clifton from comment #23)
> The patch looks good to me apart from one minor issue.  The function
> _bfd_dwarf2_find_nearest_line_with_alt() is supposed to return an integer 
> value, but most of the time the code inside the function treats the return
> as a boolean.  For example there are several "return false" statements.
> Whilst the code works, it is slightly inelegant.

I left this alone since _bfd_dwarf2_find_nearest_line_with_alt() was mostly
copied from _bfd_dwarf2_find_nearest_line() so it might return 2 under some
circumstances.

> Talking of _bfd_dwarf2_find_nearest_line_with_alt() returning false, it 
> might be helpful if it also set a bfd_error code, so that caller's can
> determine why it failed.  Maybe bfd_error_invalid_operation ?

I changed it so that if bfd_check_format fails with the .gnu_debugaltlink bfd,
bfd_error_wrong_format is set. If bfd_openr cannot open it then this function
will set appropriate bfd_error.

(In reply to Nick Clifton from comment #24)
> Further testing has revealed another problem:  The patched objdump.c calls
> bfd_elf_find_nearest_line_with_alt() even for targets which do not use the
> ELF file format.  (Which are therefore built without bfd/elf.c and hence do
> not define bfd_elf_find_nearest_line_with_alt).
> 
> The are file formats, eg PE, which can use DWARF debug information, so 
> ideally what you need to do is to add a new vector to the bfd_target
> structure (defined in bfd/targets.c) and a new macro to call it (like
> the ones in bfd/bfd.c), plus initialisers for this new field in all the
> various target specific initialiser files.  Which is a lot of hassle I
> know, but it is the proper way to solve this problem.

I added implementations for the different targets. Almost all of them call
_bfd_nosymbol_find_nearest_line_with_alt() which just sets
bfd_error_invalid_operation and returns false. AFAICT I added *_with_alt()
implementations in all the necessary places since I was able to build
binutils-gdb with --enable-targets=all. Hopefully I didn't miss anything.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to