This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] Fixup gdb.python/py-value.exp for bare-metal aarch64-elf
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 7 Oct 2016 06:42:05 -0500
- Subject: Re: [PATCH] Fixup gdb.python/py-value.exp for bare-metal aarch64-elf
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <CAH=s-PPVmjR0h5bNKeUT8PuJTLEQJh4AhK206-+=nto4mL3sew@mail.gmail.com>
- Reply-to: Luis Machado <lgustavo at codesourcery dot com>
On 10/07/2016 05:23 AM, Yao Qi wrote:
On Thu, Oct 6, 2016 at 5:27 PM, Luis Machado <firstname.lastname@example.org> wrote:
I noticed that testing aarch64-elf gdb with a physical board
ran into issues with gdb.python/py-value.exp. Further investigation showed
that we were actually trying to dereference a NULL pointer (argv) when trying
to access argv.
Being bare-metal, argv is not guaranteed to be there. So we need to make sure
argv is sane before accessing argv.
After fixing that, i noticed we were assuming a value of 1 for argc, which is
also not true, as i see 0 in my tests.
If I understand C standard
"argv" can't be NULL.
126.96.36.199.1 Program startup
The value of argc shall be nonnegative.
argv[argc] shall be a null pointer.
The first one implies that argc can be zero, and the second one implies
argv can't be NULL. In this case, argc is zero, so argv can be
Ah, that makes sense indeed. Let me check the startup code and i'll get
back to this patch (that may not be needed then).