qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Patch Tracking <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 0/3] scripts/qemu-gdb: Add event tracing support
Date: Fri, 15 May 2015 15:36:41 +0200	[thread overview]
Message-ID: <5555F669.80805@siemens.com> (raw)
In-Reply-To: <87wq0aasdf.fsf@blackfin.pond.sub.org>

On 2015-05-15 15:21, Markus Armbruster wrote:
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> On 2015-05-15 14:18, Markus Armbruster wrote:
>>> Peter Maydell <peter.maydell@linaro.org> writes:
>>>
>>>> On 15 May 2015 at 08:58, Markus Armbruster <armbru@redhat.com> wrote:
>>>>> Since you're touching qemu-gdb.py anyway, could you stick in a brief
>>>>> comment explaining how to put it to use?
>>>>
>>>> Good idea. It turns out the answer is just "source it from gdb",
>>>> but it took me a little while to find that out, so worth commenting.
>>>> I also have a patch which makes it do the 'ignore SIGUSR1' bit
>>>> by doing 'handle SIGUSR1 pass noprint nostop' for you.
>>>
>>> Here's how to load scripts/qemu-gdb.py automatically:
>>>
>>> * Apply the appended patch to turn it into a gdb init file
>>>
>>>   That's what it is, after all.  It's not a standalone Python program.
>>>
>>> * Tell gdb to trust it
>>>
>>>   Add a line like
>>>
>>>       add-auto-load-safe-path ~/work/qemu/scripts/qemu-gdb.py
>>>
>>>   to your ~/.gdbinit
>>>
>>> * Link it into the directory where you run gdb --args qemu...
>>>
>>> * Verify it works:
>>>
>>>       $ gdb
>>>       [...]
>>>       (gdb) help qemu
>>>       Prefix for QEMU debug support commands
>>>
>>>       List of qemu subcommands:
>>>
>>>       qemu coroutine -- Display coroutine backtrace
>>>       qemu mtree -- Display the memory tree hierarchy
>>>
>>>       Type "help qemu" followed by qemu subcommand name for full documentation.
>>>       Type "apropos word" to search for commands related to "word".
>>>       Command name abbreviations are allowed if unambiguous.
>>>       (gdb) 
>>>
>>> If you know a better way to do this, please post it.
>>>
>>
>> Yep, that's the basic idea behind gdb python scripts: myapp-gdb.py gets
>> auto-pulled on "gdb myapp". Since some gdb 7.x, we have that security
>> feature above which prevents pulling from arbitrary sources.
>>
>>>
>>> diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py
>>> index 6c7f4fb..ac3087c 100644
>>> --- a/scripts/qemu-gdb.py
>>> +++ b/scripts/qemu-gdb.py
>>> @@ -1,5 +1,3 @@
>>> -#!/usr/bin/python
>>> -
>>>  # GDB debugging support
>>>  #
>>>  # Copyright 2012 Red Hat, Inc. and/or its affiliates
>>> @@ -13,7 +11,7 @@
>>>  # Contributions after 2012-01-13 are licensed under the terms of the
>>>  # GNU GPL, version 2 or (at your option) any later version.
>>>  
>>> -
>>> +python
>>
>> What is this line doing?
> 
> Found here:
> https://stackoverflow.com/questions/16553283/python-code-in-gdb-init-file-gdbinit

The author there puts his code into .gdbinit, which is a gdb script, not
a python one.

> 
> It doesn't work for me without it.

When sourcing? Works fine here (gdb 7.7.something).

In any case, when you pull in the script via auto-load, that extra
non-python statement will break. Try "python python". ;)

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2015-05-15 13:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 16:43 [Qemu-devel] [PATCH 0/3] scripts/qemu-gdb: Add event tracing support Peter Maydell
2015-05-14 16:43 ` [Qemu-devel] [PATCH 1/3] scripts/qemu-gdb: Split MtreeCommand into its own module Peter Maydell
2015-05-14 16:43 ` [Qemu-devel] [PATCH 2/3] scripts/qemu-gdb: Split CoroutineCommand into its own file Peter Maydell
2015-05-14 16:43 ` [Qemu-devel] [PATCH 3/3] scripts/qemu-gdb: Add support for printing trace events Peter Maydell
2015-09-22 14:52   ` Paolo Bonzini
2015-09-22 15:39     ` Peter Maydell
2015-05-15  7:58 ` [Qemu-devel] [PATCH 0/3] scripts/qemu-gdb: Add event tracing support Markus Armbruster
2015-05-15  9:09   ` Peter Maydell
2015-05-15 12:18     ` Markus Armbruster
2015-05-15 12:39       ` Jan Kiszka
2015-05-15 13:21         ` Markus Armbruster
2015-05-15 13:36           ` Jan Kiszka [this message]
2015-05-15 14:18             ` Markus Armbruster
2015-05-18 13:28 ` Stefan Hajnoczi
2015-05-18 13:31 ` Stefan Hajnoczi

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=5555F669.80805@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=armbru@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 NNTP newsgroup(s).