public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Bruno Larsen <blarsen@redhat.com>,
	Lancelot SIX <lancelot.six@amd.com>,
	gdb-patches@sourceware.org
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH v2 2/2] gdb: Respect the DW_CC_nocall attribute
Date: Mon, 31 Jan 2022 09:05:09 -0500	[thread overview]
Message-ID: <310c1cc5-29c7-bfe5-0421-850df50dd8bf@polymtl.ca> (raw)
In-Reply-To: <49c17cc9-fd06-31ea-b4f1-174c26b7eb9b@redhat.com>

On 2022-01-31 08:19, Bruno Larsen via Gdb-patches wrote:
> Hi Lancelot,
> 
> Thanks for looking at this. The general direction looks good, just a few minor nits.

Some more comments.

Git gave me this warning when applying, maybe something to fix:

Applying: gdb: Respect the DW_CC_nocall attribute
.git/rebase-apply/patch:148: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

>> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
>> index 994dd5b32a3..186b1a2024a 100644
>> --- a/gdb/infcmd.c
>> +++ b/gdb/infcmd.c
>> @@ -1419,6 +1419,25 @@ get_return_value (struct value *function, struct type *value_type)
>>     value_type = check_typedef (value_type);
>>     gdb_assert (value_type->code () != TYPE_CODE_VOID);
>>   +  if (is_nocall_function (check_typedef (::value_type (function))))
>> +    {
>> +      CORE_ADDR funaddr = value_address (function);
>> +      const char *fname = nullptr;
>> +      char buf[RAW_FUNCTION_ADDRESS_SIZE];
>> +      if (funaddr != 0)
>> +    fname = get_function_name (funaddr, buf, sizeof (buf));
>> +
>> +      if (fname != nullptr)

My understand is that fname will be nullptr if funaddr is 0.  Can you
explain when funaddr is 0, and what that means?  Just trying to
understand how we can get there.

My other comments about this would be:

 - One caller of this command, finish_command_fsm::should_stop, starts
   from a struct symbol.  Getting the name from that is easy, you can
   simply call 'print_name' on it (as shown by your change in
   return_command).
 - The other caller of get_return_value is bpfinishpy_pre_stop_hook.
   bpfinishpy_pre_stop_hook does not have access to a struct symbol
   directly, but maybe it could, if we saved the symbol used to set
   finish_breakpoint_object::function_value, bpfinishpy_init.

So if we can always have access to the symbol somehow, maybe we can
avoid using get_function_name in get_return_value.

>> +    warning (_("The function '%s' does not follow the target calling "

I think that when naming the thing, you should omit the "The" in front.
For example, you'd say "President Biden", or "The president", but not
"The president Biden".  Maybe I'm wrong, I'm not a native english
speaker.

Simon

  reply	other threads:[~2022-01-31 14:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 14:29 [PATCH v2 0/2] Make GDB respect " Lancelot SIX
2022-01-28 14:29 ` [PATCH v2 1/2] gdb: Move most of get_function_name (COREADDR) in symtab.h Lancelot SIX
2022-01-31 13:17   ` Bruno Larsen
2022-01-28 14:29 ` [PATCH v2 2/2] gdb: Respect the DW_CC_nocall attribute Lancelot SIX
2022-01-31 13:19   ` Bruno Larsen
2022-01-31 14:05     ` Simon Marchi [this message]
2022-01-31 14:34       ` Six, Lancelot
2022-01-31 14:36         ` Simon Marchi
2022-01-31 14:19     ` Six, Lancelot

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=310c1cc5-29c7-bfe5-0421-850df50dd8bf@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lancelot.six@amd.com \
    --cc=lsix@lancelotsix.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).