public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3] Update btrace data in maintenance btrace commands
@ 2021-09-14  9:33 Stephen Röttger
  2021-11-09 16:02 ` Metzger, Markus T
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Röttger @ 2021-09-14  9:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: markus.t.metzger, tom, Stephen Roettger

From: Stephen Roettger <sroettger@google.com>

When calling `maintenance btrace packet-history` or `maintenance info btrace`,
the commands wouldn't show any data unless it was updated previously by some
other means, for example by running `info record`.
To fix this, use the require_btrace function from record-brace.h which
will update the data before returning the btrace_thread_info pointer.

Change to v1: moved the require_btrace comment to record-btrace.h
Change to v2: fix the style in the function declaration
---
 gdb/btrace.c        | 13 ++-----------
 gdb/record-btrace.c |  8 ++------
 gdb/record-btrace.h |  7 +++++++
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/gdb/btrace.c b/gdb/btrace.c
index c697f37f46c..177e818f0cf 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3231,12 +3231,8 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
   struct btrace_thread_info *btinfo;
   unsigned int size, begin, end, from, to;
 
-  thread_info *tp = find_thread_ptid (current_inferior (), inferior_ptid);
-  if (tp == NULL)
-    error (_("No thread."));
-
+  btinfo = require_btrace ();
   size = 10;
-  btinfo = &tp->btrace;
 
   btrace_maint_update_packets (btinfo, &begin, &end, &from, &to);
   if (begin == end)
@@ -3372,12 +3368,7 @@ maint_info_btrace_cmd (const char *args, int from_tty)
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
 
-  if (inferior_ptid == null_ptid)
-    error (_("No thread."));
-
-  thread_info *tp = inferior_thread ();
-
-  btinfo = &tp->btrace;
+  btinfo = require_btrace ();
 
   conf = btrace_conf (btinfo);
   if (conf == NULL)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index b7b3c91f85d..8945eb73277 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -263,13 +263,9 @@ require_btrace_thread (void)
   return tp;
 }
 
-/* Update the branch trace for the current thread and return a pointer to its
-   branch trace information struct.
-
-   Throws an error if there is no thread or no trace.  This function never
-   returns NULL.  */
+/* See record-btrace.h.  */
 
-static struct btrace_thread_info *
+struct btrace_thread_info *
 require_btrace (void)
 {
   struct thread_info *tp;
diff --git a/gdb/record-btrace.h b/gdb/record-btrace.h
index 8e7bbd90e60..f9c3eac8efe 100644
--- a/gdb/record-btrace.h
+++ b/gdb/record-btrace.h
@@ -29,4 +29,11 @@ extern void record_btrace_push_target (void);
    NULL if the cpu was configured as auto.  */
 extern const struct btrace_cpu *record_btrace_get_cpu (void);
 
+/* Update the branch trace for the current thread and return a pointer to its
+   branch trace information struct.
+
+   Throws an error if there is no thread or no trace.  This function never
+   returns NULL.  */
+extern struct btrace_thread_info *require_btrace ();
+
 #endif /* RECORD_BTRACE_H */
-- 
2.33.0.309.g3052b89438-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] Update btrace data in maintenance btrace commands
  2021-09-14  9:33 [PATCH v3] Update btrace data in maintenance btrace commands Stephen Röttger
@ 2021-11-09 16:02 ` Metzger, Markus T
  2021-11-10  8:47   ` Stephen Röttger
  0 siblings, 1 reply; 4+ messages in thread
From: Metzger, Markus T @ 2021-11-09 16:02 UTC (permalink / raw)
  To: Stephen Röttger; +Cc: gdb-patches

Hello Stephen,

>When calling `maintenance btrace packet-history` or `maintenance info btrace`,
>the commands wouldn't show any data unless it was updated previously by some
>other means, for example by running `info record`.
>To fix this, use the require_btrace function from record-brace.h which
>will update the data before returning the btrace_thread_info pointer.
>
>Change to v1: moved the require_btrace comment to record-btrace.h
>Change to v2: fix the style in the function declaration

Version 2 was already approved but I see that you have not pushed your changes, yet.

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] Update btrace data in maintenance btrace commands
  2021-11-09 16:02 ` Metzger, Markus T
@ 2021-11-10  8:47   ` Stephen Röttger
  2021-11-10  9:16     ` Metzger, Markus T
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Röttger @ 2021-11-10  8:47 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: gdb-patches

Hey Markus,
I just push this commit to origin/master? Do I have the required
permissions to do that?
Unless I missed it, the contribution checklist doesn't seem to explain
this step.
(https://sourceware.org/gdb/wiki/ContributionChecklist).
Thanks!
Stephen


On Tue, Nov 9, 2021 at 5:05 PM Metzger, Markus T
<markus.t.metzger@intel.com> wrote:
>
> Hello Stephen,
>
> >When calling `maintenance btrace packet-history` or `maintenance info btrace`,
> >the commands wouldn't show any data unless it was updated previously by some
> >other means, for example by running `info record`.
> >To fix this, use the require_btrace function from record-brace.h which
> >will update the data before returning the btrace_thread_info pointer.
> >
> >Change to v1: moved the require_btrace comment to record-btrace.h
> >Change to v2: fix the style in the function declaration
>
> Version 2 was already approved but I see that you have not pushed your changes, yet.
>
> Regards,
> Markus.
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] Update btrace data in maintenance btrace commands
  2021-11-10  8:47   ` Stephen Röttger
@ 2021-11-10  9:16     ` Metzger, Markus T
  0 siblings, 0 replies; 4+ messages in thread
From: Metzger, Markus T @ 2021-11-10  9:16 UTC (permalink / raw)
  To: Stephen Röttger
  Cc: gdb-patches, Simon Marchi, Pedro Alves, Joel Brobecker

Hello Stephen,

If this is your first patch, we need to get the paperwork in place and grant you write access.  I cannot do that but one of the Global Maintainers should be able to help with that.

Regards,
Markus.

>-----Original Message-----
>From: Stephen Röttger <sroettger@google.com>
>Sent: Wednesday, November 10, 2021 9:48 AM
>To: Metzger, Markus T <markus.t.metzger@intel.com>
>Cc: gdb-patches@sourceware.org
>Subject: Re: [PATCH v3] Update btrace data in maintenance btrace commands
>
>Hey Markus,
>I just push this commit to origin/master? Do I have the required
>permissions to do that?
>Unless I missed it, the contribution checklist doesn't seem to explain
>this step.
>(https://sourceware.org/gdb/wiki/ContributionChecklist).
>Thanks!
>Stephen
>
>
>On Tue, Nov 9, 2021 at 5:05 PM Metzger, Markus T
><markus.t.metzger@intel.com> wrote:
>>
>> Hello Stephen,
>>
>> >When calling `maintenance btrace packet-history` or `maintenance info
>btrace`,
>> >the commands wouldn't show any data unless it was updated previously by
>some
>> >other means, for example by running `info record`.
>> >To fix this, use the require_btrace function from record-brace.h which
>> >will update the data before returning the btrace_thread_info pointer.
>> >
>> >Change to v1: moved the require_btrace comment to record-btrace.h
>> >Change to v2: fix the style in the function declaration
>>
>> Version 2 was already approved but I see that you have not pushed your
>changes, yet.
>>
>> Regards,
>> Markus.
>>
>> Intel Deutschland GmbH
>> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
>> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
>> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
>> Chairperson of the Supervisory Board: Nicole Lau
>> Registered Office: Munich
>> Commercial Register: Amtsgericht Muenchen HRB 186928
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-10  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  9:33 [PATCH v3] Update btrace data in maintenance btrace commands Stephen Röttger
2021-11-09 16:02 ` Metzger, Markus T
2021-11-10  8:47   ` Stephen Röttger
2021-11-10  9:16     ` Metzger, Markus T

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).