From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
To: Alan Hayward <Alan.Hayward@arm.com>,
Ulrich Weigand <uweigand@de.ibm.com>
Cc: Simon Marchi <simark@simark.ca>,
"gdb-patches\\\@sourceware.org"
<gdb-patches@sourceware.org>, nd <nd@arm.com>
Subject: Re: [PATCH 2/2] gdbserver: Add linux_get_hwcap
Date: Thu, 11 Apr 2019 14:12:00 -0000 [thread overview]
Message-ID: <87bm1cfx71.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <D92D5717-3F2E-4DB4-A7A4-86DA22587463@arm.com>
Hi Alan,
Thank you for the comments.
Alan Hayward <Alan.Hayward@arm.com> writes:
>> -static CORE_ADDR
>> -linux_get_auxv (int wordsize, CORE_ADDR match)
>> +int
>> +linux_get_auxv (int wordsize, CORE_ADDR match, CORE_ADDR *valp)
>> {
>> gdb_byte *data = (gdb_byte *) alloca (2 * wordsize);
>> int offset = 0;
>
> Would be useful to set valp to zero here. (Not sure if the GDB version
> does this either).
The client version doesn't do this (target_auxv_search). Should I be
consistent with that or change it here?
> I don’t think there is a requirement here for the error to be return separately
> to the phdr. With the my version of linux_get_auxv, on error you would get 0
> for phdr. Given that it is an address, 0 should never be a valid value.
>
> With the code pre my patch and this patch, I’m not sure what will happen if the
> PHDR value is 0 - will read_inferior_memory then the memcmp deal with that? (To
> be fair, I suspect there are bigger issues to deal with if phdr is 0).
I'm probably nitpicking, but I tried using memory at 0x0 with mmap and
it seems to work, even if it is unusual, and gdb can read from that
address, so apparently ptrace can read memory at 0x0, which should mean
that read_inferior_memory can do that too.
Still, I don't think the program headers could really be at 0x0, since
there would be no room for the ELF header before that. However,
wouldn't it make sense to return in error separately, so that the next
person who reads that function doesn't have to go through this
reasoning?
Besides, other auxv values that might be retrieved in the future with
linux_get_auxv could have a real meaning for 0.
Other than that, I agree with your other comments.
> Thanks,
> Alan.
Thanks!
--
Pedro Franco de Carvalho
next prev parent reply other threads:[~2019-04-11 14:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 12:05 [PATCH 1/2] " Alan Hayward
2019-03-25 12:05 ` [PATCH 2/2] gdbserver: " Alan Hayward
2019-03-25 15:41 ` Simon Marchi
2019-03-26 13:17 ` Alan Hayward
[not found] ` <353e83d9-efb3-c485-9ae6-6fc0a1f54553@simark.ca>
[not found] ` <57CEBD0C-44A5-48D1-8CEB-54584E1A1A21@arm.com>
[not found] ` <59A457A2-F464-4A05-A471-700F066114AD@arm.com>
2019-03-26 14:34 ` FW: " Alan Hayward
2019-03-28 9:50 ` Ulrich Weigand
2019-03-28 11:35 ` Alan Hayward
2019-03-29 23:12 ` Ulrich Weigand
2019-04-03 19:13 ` Pedro Franco de Carvalho
2019-04-04 13:49 ` Ulrich Weigand
2019-04-05 16:26 ` Pedro Franco de Carvalho
2019-04-05 16:39 ` Ulrich Weigand
2019-04-05 17:23 ` Pedro Franco de Carvalho
2019-04-08 9:38 ` Alan Hayward
2019-04-11 14:12 ` Pedro Franco de Carvalho [this message]
2019-03-26 14:56 ` FW: " Simon Marchi
2019-04-02 22:00 ` Peter Bergner
2019-04-04 21:22 ` Pedro Franco de Carvalho
2019-03-25 15:18 ` [PATCH 1/2] " Simon Marchi
2019-03-25 16:51 ` Alan Hayward
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=87bm1cfx71.fsf@linux.vnet.ibm.com \
--to=pedromfc@linux.ibm.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
--cc=simark@simark.ca \
--cc=uweigand@de.ibm.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