From: Emiliano Testa <etesta@undo.io>
To: gdb@sourceware.org
Subject: python interface gdb.execute() to_string is useless
Date: Wed, 1 Jul 2020 13:26:39 +0100 [thread overview]
Message-ID: <b178b57e-b098-fe06-7acb-07d2882af887@undo.io> (raw)
Hello,
I'm using the gdb APIs to implement a command and I want to control when
the output of a certain command is sent to the console.
To this end I'm using
s = gdb.execute(cmd, to_string=True)
unfortunately it doesn't seem to do what is says it would:
I can see s is not None when to_string=True BUT it doesn't contain the
output that it should. It went to the console instead.
I think this is a bug.
Many thanks
Emiliano
The output I get (gdb version is "GNU gdb (Ubuntu 8.1-0ubuntu3.2)
8.1.0.20180409-git"):
(gdb) python
>print ("Before")
>s = gdb.execute("continue", to_string=True)
>print ("After")
>print (s)
>end
Before
loop_then_segv.c: i=0
loop_then_segv.c: i=1
loop_then_segv.c: i=2
loop_then_segv.c: i=3
loop_then_segv.c: i=4
loop_then_segv.c: i=5
loop_then_segv.c: i=6
loop_then_segv.c: i=7
loop_then_segv.c: i=8
loop_then_segv.c: i=9
causing deliberate segv pid=11290.
Program received signal SIGSEGV, Segmentation fault.
0x0804855c in main () at tests/test/generic/loop_then_segv.c:26
26 *(volatile int*)NULL = 0;
After
(gdb) python
>print ("Before")
>s = gdb.execute("continue", to_string=False)
>print ("After")
>print (s)
>end
Before
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
After
None
(gdb)
--
Emiliano Testa | Software Engineer | Direct: (+44)7512468305 |
etesta@undo.io
Undo <https://undo.io> | Accelerate software defect resolution by
eliminating the guesswork in failure diagnosis
CI Best Practice: Go Green, Stay Green
<https://info.undo.io/go-green-stay-green>
reply other threads:[~2020-07-01 12:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=b178b57e-b098-fe06-7acb-07d2882af887@undo.io \
--to=etesta@undo.io \
--cc=gdb@sourceware.org \
/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).