public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* python interface gdb.execute() to_string is useless
@ 2020-07-01 12:26 Emiliano Testa
  0 siblings, 0 replies; only message in thread
From: Emiliano Testa @ 2020-07-01 12:26 UTC (permalink / raw)
  To: gdb

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>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-01 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 12:26 python interface gdb.execute() to_string is useless Emiliano Testa

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