This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v5] Add negative repeat count to 'x' command


Hi Pedro,

Sorry for the delay in answering.

On 19/08/16 19:59, Pedro Alves wrote:


First I think we should assess whether the behavior is correct or
whether there's a qemu or gdb bug.  If it's a gdb bug, we should fix
it, of course.  If it's a qemu bug, we should report it and maybe XFAIL
it.  If it's not a bug but a qemu personality quirk, then we can make
the tests cope, somehow.

I still wonder why does the read from 0 work at all.  I've tried
reproducing this, using x86_64 Fedora 23's stock qemu-arm:

$ qemu-arm -version
qemu-arm version 2.4.1 (qemu-2.4.1-11.fc23), Copyright (c) 2003-2008 Fabrice Bellard

... but couldn't.  Here's what I get instead:

Terminal 1:

 $ cat crash.c
 int main ()
 {
   volatile int *null = 0;

   return *null;
 }

 $ arm-linux-gnueabi -static crash.c

 $ qemu-arm -g 9999 a.out

Terminal 2:

 $ gdb a.out -ex "tar rem :9999"

 (gdb) x 0
 Sending packet: $m0,4#fd...Ack
 Packet received: E14
 0x0:    Cannot access memory at address 0x0

IIRC, arm's exception vector is at 0 and that that's
where execution starts.  But that shouldn't be applicable
to mmu userspace programs?

I'm getting:

(gdb) x 0
0x0:    0x464c457f

However note that I compiled with arm-none-eabi-gcc so there would be some bits of the program (ARM's exception vector indeed) at this address.


I wonder what's different between our environments.

We are targetting ARM bare-metal targets.


Note: I had to use -static, because of:

 $ qemu-arm -g 9999  ./crash.arm
 /lib/ld-linux.so.3: No such file or directory

I suppose I would need to point qemu at an arm sysroot,
somehow to get past that.

Is there a dejagnu board file somewhere handy one could steal
in order to run tests against qemu-user ?

Nothing public that I am aware of I'm afraid. However I can reproduce this issue easily by compiling examine-backward.c with the GNU ARM embedded toolchain [1] using the following command line:

arm-none-eabi-gcc -o examine-backward.axf gdb/testuite/gdb.base/examine-backward.c -specs=rdimon.specs

and then running:

qemu-arm -g 2048 examine-backward.axf &
arm-none-eabi-gdb examine-backward.axf
(gdb) target remote :2048
x/3xb 0x0
x/-6x


[1] https://launchpad.net/gcc-arm-embedded

Thanks for your effort on understanding this Pedro.

Best regards,

Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]