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

--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Thiago Jung Bauermann from comment #4)
Hi Thiago,

> $ gcc -g -o pr25124 ~/src/binutils-gdb/gdb/testsuite/gdb.arch/pr25124.S
> $ gdb pr25124
> Reading symbols from pr25124...
> (gdb) x/i main
>    0x103e5 <main>:      bx      pc
> (gdb) x/i main+8
>    0x103ed <main+7>:    vrhadd.u16      d14, d14, d31
> (gdb) quit
> 
> Interestingly, as can be seen above "x/i main" actually works fine.

Except that the address is displayed with the bottom bit set, which
might be confusing the readers.  Maybe.

> it's "x/i main+8" that breaks. This is a detail that I just noticed.
> 
> There's another thing I just discovered : I can reproduce GDB's bad
> behavior on an ELF executable (produced by GCC from the .S file), but
> not on a .o file produced directly by gas:

Or one that is produced by using gcc to invoke just gas.  ie compiling with
"-c".

> $ as -g -o pr25124.o ~/src/binutils-gdb/gdb/testsuite/gdb.arch/pr25124.S
> $ gdb pr25124.o
> Reading symbols from pr25124.o...
> (gdb) x/i main
>    0x0 <main>:  bx      pc
> (gdb) x/i main+8
>    0x8 <main+8>:        bx      lr
> (gdb) quit

Interestingly my patch makes things even worse for the fully linked executable:

  $ gdb pr25124.with-nicks-patch 
  GNU gdb (GDB) Fedora Linux 13.2-6.fc38
  [...]
  (gdb) x/i main
     0x8243 <_start+158>:       movs    r0, r0
  (gdb) x/i main+8
     0x824b <main+7>:   b.n     0x898e

So please consider it withdrawn.


> Both the executable and the .o file have the LSB bit set in main's
> DW_AT_low_pc:

> So for some reason GDB is fine with an object file containing the wrong
> DW_AT_low_pc in main's DIE, but not when it's with a "full blown"
> executable.

My guess - totally unproven - is that GDB has special code to mask thumb
addresses for object files, but for some reason this code is not applied
to linked executables.

I do wonder if this is something that GDB has already partially fixed, and
maybe this fix needs to be extended...

Anyway I am investigating gas some more...

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

Reply via email to