This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/19786] New: Python: gdb.execute("checkpoint", to_string=True) returns an empty string
- From: "raphael.jakse at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 08 Mar 2016 12:18:35 +0000
- Subject: [Bug python/19786] New: Python: gdb.execute("checkpoint", to_string=True) returns an empty string
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19786
Bug ID: 19786
Summary: Python: gdb.execute("checkpoint", to_string=True)
returns an empty string
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: raphael.jakse at gmail dot com
Target Milestone: ---
Hello,
I need to create a checkpoint and get its identifier. using the Python
interface
One way to do it would be to parse the checkpoint's command output using
gdb.execute and the to_string parameter and hope things don't break if the
string gets translated.
However, gdb.execute("checkpoint", to_string=True) returns an empty string.
To reproduce:
---
echo "int main () {return 0;}" > test.c
cc -g test.c
gdb ./a.out
start
python print(gdb.execute("checkpoint", to_string=True))
---
This should output:
checkpoint 1: fork returned pid 12600.
The following patch does what I need.
---
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index e7202dd..b2054d4 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -717,12 +717,13 @@ checkpoint_command (char *args, int from_tty)
fp = find_fork_pid (retpid);
+ printf_filtered (_("checkpoint %d: fork returned pid %ld.\n"),
+ fp != NULL ? fp->num : -1, (long) retpid);
+
if (from_tty)
{
int parent_pid;
- printf_filtered (_("checkpoint %d: fork returned pid %ld.\n"),
- fp != NULL ? fp->num : -1, (long) retpid);
if (info_verbose)
{
parent_pid = ptid_get_lwp (last_target_ptid);
---
Cheers,
RaphaÃl
--
You are receiving this mail because:
You are on the CC list for the bug.