qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] simpletrace: build() missing 2 required positional arguments
@ 2021-01-31 17:34 Volker Rümelin
  2021-01-31 19:56 ` Philippe Mathieu-Daudé
  2021-02-01 10:51 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Volker Rümelin @ 2021-01-31 17:34 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Cleber Rosa, QEMU, Eduardo Habkost

Commit 4e66c9ef64 "tracetool: add input filename and line number to
Event" forgot to add a line number and a filename argument at one
build method call site.

Traceback (most recent call last):
  File "./scripts/simpletrace.py", line 261, in <module>
    run(Formatter())
  File "./scripts/simpletrace.py", line 236, in run
    process(events, sys.argv[2], analyzer, read_header=read_header)
  File "./scripts/simpletrace.py", line 177, in process
    dropped_event =
      Event.build("Dropped_Event(uint64_t num_events_dropped)")
TypeError: build() missing 2 required positional arguments:
  'lineno' and 'filename'

Add the missing arguments.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 scripts/simpletrace.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 20f0026066..d61fb0bd87 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -174,7 +174,9 @@ def process(events, log, analyzer, read_header=True):
     if read_header:
         read_trace_header(log)
 
-    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)")
+    frameinfo = inspect.getframeinfo(inspect.currentframe())
+    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)",
+                                frameinfo.lineno + 1, frameinfo.filename)
     edict = {"dropped": dropped_event}
     idtoname = {dropped_event_id: "dropped"}
 
-- 
2.26.2



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

* Re: [PATCH] simpletrace: build() missing 2 required positional arguments
  2021-01-31 17:34 [PATCH] simpletrace: build() missing 2 required positional arguments Volker Rümelin
@ 2021-01-31 19:56 ` Philippe Mathieu-Daudé
  2021-02-01 10:51 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-31 19:56 UTC (permalink / raw)
  To: Volker Rümelin, Stefan Hajnoczi; +Cc: QEMU, Eduardo Habkost, Cleber Rosa

On 1/31/21 6:34 PM, Volker Rümelin wrote:
> Commit 4e66c9ef64 "tracetool: add input filename and line number to
> Event" forgot to add a line number and a filename argument at one
> build method call site.
> 
> Traceback (most recent call last):
>   File "./scripts/simpletrace.py", line 261, in <module>
>     run(Formatter())
>   File "./scripts/simpletrace.py", line 236, in run
>     process(events, sys.argv[2], analyzer, read_header=read_header)
>   File "./scripts/simpletrace.py", line 177, in process
>     dropped_event =
>       Event.build("Dropped_Event(uint64_t num_events_dropped)")
> TypeError: build() missing 2 required positional arguments:
>   'lineno' and 'filename'

Oops

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> 
> Add the missing arguments.
> 
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
>  scripts/simpletrace.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
> index 20f0026066..d61fb0bd87 100755
> --- a/scripts/simpletrace.py
> +++ b/scripts/simpletrace.py
> @@ -174,7 +174,9 @@ def process(events, log, analyzer, read_header=True):
>      if read_header:
>          read_trace_header(log)
>  
> -    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)")
> +    frameinfo = inspect.getframeinfo(inspect.currentframe())
> +    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)",
> +                                frameinfo.lineno + 1, frameinfo.filename)
>      edict = {"dropped": dropped_event}
>      idtoname = {dropped_event_id: "dropped"}
>  
> 



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

* Re: [PATCH] simpletrace: build() missing 2 required positional arguments
  2021-01-31 17:34 [PATCH] simpletrace: build() missing 2 required positional arguments Volker Rümelin
  2021-01-31 19:56 ` Philippe Mathieu-Daudé
@ 2021-02-01 10:51 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2021-02-01 10:51 UTC (permalink / raw)
  To: Volker Rümelin; +Cc: Cleber Rosa, QEMU, Eduardo Habkost

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

On Sun, Jan 31, 2021 at 06:34:15PM +0100, Volker Rümelin wrote:
> Commit 4e66c9ef64 "tracetool: add input filename and line number to
> Event" forgot to add a line number and a filename argument at one
> build method call site.
> 
> Traceback (most recent call last):
>   File "./scripts/simpletrace.py", line 261, in <module>
>     run(Formatter())
>   File "./scripts/simpletrace.py", line 236, in run
>     process(events, sys.argv[2], analyzer, read_header=read_header)
>   File "./scripts/simpletrace.py", line 177, in process
>     dropped_event =
>       Event.build("Dropped_Event(uint64_t num_events_dropped)")
> TypeError: build() missing 2 required positional arguments:
>   'lineno' and 'filename'
> 
> Add the missing arguments.
> 
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
>  scripts/simpletrace.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Thanks, applied to my tracing tree:
https://gitlab.com/stefanha/qemu/commits/tracing

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-02-01 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-31 17:34 [PATCH] simpletrace: build() missing 2 required positional arguments Volker Rümelin
2021-01-31 19:56 ` Philippe Mathieu-Daudé
2021-02-01 10:51 ` Stefan Hajnoczi

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 NNTP newsgroup(s).