public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: "Luis Machado" <luis.machado@arm.com>,
	"Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>,
	gdb-patches@sourceware.org
Cc: tom@tromey.com, Yvan Roux <yvan.roux@foss.st.com>
Subject: Re: [PATCH v3 2/2] gdb/arm: Use new dwarf2 function cache
Date: Wed, 25 Jan 2023 12:12:06 -0500	[thread overview]
Message-ID: <4a2b3e01-570c-65e7-544f-924f0ff7576b@simark.ca> (raw)
In-Reply-To: <801f740d-9186-52dc-5bd4-e3416f001c17@arm.com>



On 1/25/23 11:55, Luis Machado via Gdb-patches wrote:
> On 1/19/23 10:29, Torbjörn SVENSSON wrote:
>> v2 -> v3:
>> No changes, just rebase.
>>
>> ---
>>
>> This patch resolves the performance issue reported in pr/29738 by
>> caching the values for the stack pointers for the inner frame.  By
>> doing so, the impact can be reduced to checking the state and
>> returning the appropriate value.
>>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> Signed-off-by: Yvan Roux <yvan.roux@foss.st.com>
>> ---
>>   gdb/arm-tdep.c | 96 +++++++++++++++++++++++++++++++++-----------------
>>   1 file changed, 64 insertions(+), 32 deletions(-)
>>
>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
>> index 51ec5236af1..be7219ca66e 100644
>> --- a/gdb/arm-tdep.c
>> +++ b/gdb/arm-tdep.c
>> @@ -3964,6 +3964,18 @@ struct frame_base arm_normal_base = {
>>     arm_normal_frame_base
>>   };
>>   +struct arm_dwarf2_prev_register_cache
>> +{
>> +  /* Cached value of the coresponding stack pointer for the inner frame.  */
>> +  CORE_ADDR sp;
>> +  CORE_ADDR msp;
>> +  CORE_ADDR msp_s;
>> +  CORE_ADDR msp_ns;
>> +  CORE_ADDR psp;
>> +  CORE_ADDR psp_s;
>> +  CORE_ADDR psp_ns;
>> +};
>> +
>>   static struct value *
>>   arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
>>                 int regnum)
>> @@ -3972,6 +3984,48 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
>>     arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
>>     CORE_ADDR lr;
>>     ULONGEST cpsr;
>> +  struct arm_dwarf2_prev_register_cache *cache
>> +    = (struct arm_dwarf2_prev_register_cache *) dwarf2_frame_get_fn_data (
>> +      this_frame, this_cache, arm_dwarf2_prev_register);
>> +
>> +  if (!cache)
>> +    {
>> +      const unsigned int size = sizeof (struct arm_dwarf2_prev_register_cache);
>> +      cache = (struct arm_dwarf2_prev_register_cache *)
>> +    dwarf2_frame_allocate_fn_data (this_frame, this_cache,
> 
> Still some funny spacing above. Could you please check the patch again, just to be sure?

To clarify, I would probably write the first part as:

  arm_dwarf2_prev_register_cache *cache
    = ((arm_dwarf2_prev_register_cache *)
       dwarf2_frame_get_fn_data (this_frame, this_cache,
				 arm_dwarf2_prev_register));


The changes are:

 - dropping the struct keyword (unnecessary in C++)
 - the assigment operator is on the second line (mandated by GNU style)
 - the addition of parenthesis when breaking an expression (also
   mandated by GNU style, is it so that the following line(s) align
   nicely with the opening parenthesis)

Similarly, the second one would be:

      cache = ((arm_dwarf2_prev_register_cache *)
	       dwarf2_frame_allocate_fn_data (this_frame, this_cache,
					      arm_dwarf2_prev_register, size);

This is just how I would do it, there are probably other valid ways.

Simon

  reply	other threads:[~2023-01-25 17:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 10:29 [PATCH v3 1/2] gdb: dwarf2 generic implementation for caching function data Torbjörn SVENSSON
2023-01-19 10:29 ` [PATCH v3 2/2] gdb/arm: Use new dwarf2 function cache Torbjörn SVENSSON
2023-01-25 16:55   ` Luis Machado
2023-01-25 17:12     ` Simon Marchi [this message]
2023-01-25 20:15       ` Torbjorn SVENSSON
2023-01-19 16:53 ` [PATCH v3 1/2] gdb: dwarf2 generic implementation for caching function data Simon Marchi
2023-01-20 14:12   ` Torbjorn SVENSSON
2023-01-20 17:28     ` Simon Marchi
2023-01-20 17:33       ` Luis Machado
2023-01-20 17:43         ` Simon Marchi
2023-01-25  9:34           ` Torbjorn SVENSSON
2023-01-20 19:59 ` Tom Tromey
2023-01-25  9:39   ` Torbjorn SVENSSON
2023-01-25 16:11     ` Tom Tromey

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=4a2b3e01-570c-65e7-544f-924f0ff7576b@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --cc=tom@tromey.com \
    --cc=torbjorn.svensson@foss.st.com \
    --cc=yvan.roux@foss.st.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).