public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>
To: Pedro Alves <palves@redhat.com>,
	Toshihito Kikuchi <k.toshihito@yahoo.de>,
	gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: Re: [PATCH v5] Add negative repeat count to 'x' command
Date: Tue, 06 Sep 2016 14:28:00 -0000	[thread overview]
Message-ID: <e8466987-fca8-0b89-3beb-95ff5b55716f@foss.arm.com> (raw)
In-Reply-To: <0690bbdc-995d-5daf-904d-86eb5017d6bd@redhat.com>

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

      reply	other threads:[~2016-09-06 14:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  8:52 Toshihito Kikuchi
2016-06-03 10:54 ` Pedro Alves
2016-06-10  6:02   ` Toshihito Kikuchi
2016-08-08 14:45 ` Thomas Preudhomme
2016-08-11  0:00   ` Pedro Alves
2016-08-11 12:51     ` Thomas Preudhomme
2016-08-11 14:08       ` Thomas Preudhomme
2016-08-11 16:32         ` Pedro Alves
2016-08-16 14:03           ` Thomas Preudhomme
2016-08-19 18:59             ` Pedro Alves
2016-09-06 14:28               ` Thomas Preudhomme [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8466987-fca8-0b89-3beb-95ff5b55716f@foss.arm.com \
    --to=thomas.preudhomme@foss.arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=k.toshihito@yahoo.de \
    --cc=palves@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).