Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb.error: "define PI" is not a prefix command.
@ 2021-12-22 15:12 Simon Sobisch via Gdb
  2021-12-22 17:56 ` Andrew Burgess via Gdb
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Sobisch via Gdb @ 2021-12-22 15:12 UTC (permalink / raw)
  To: gdb

The following shows the issue quite well:

(gdb) macro define PI1 (3.1415926)
(gdb) print PI1
$1 = 3.1415926000000001
(gdb) py gdb.execute("print PI1", True, False)
$2 = 3.1415926000000001
(gdb) py gdb.execute("macro define PI2 (3.1415926)", True, False)
Traceback (most recent call last):
   File "<string>", line 1, in <module>
gdb.error: "define PI2" is not a prefix command.
Error while executing Python code.
(gdb) print PI2
No symbol "PI2" in current context.

This is happening with GDB 8.2, Python 3.6.8.

It did work with GDB 7.6:

(gdb) macro define PI1 (3.1415926)
(gdb) print PI1
$1 = 3.1415925999999996
(gdb) py gdb.execute("print PI1", True, False)
$2 = 3.1415925999999996
(gdb) py gdb.execute("macro define PI2 (3.1415926)", True, False)
(gdb) print PI2
$3 = 3.1415925999999996
(gdb) py gdb.execute("print PI1", True, False)
$24 = 3.1415925999999996

I've thought that this was related to the different python version 
(2.7.5 on GDB 7.6), but it isn't. After building GDB 11.1 on the test 
machine (same Python, obviously) it also works there.


Question:
Is there any way to execute this command with Python in GDB 8.2
(= without upgrading GDB)?

Thanks for any pointers / ideas,
Simon

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

end of thread, other threads:[~2021-12-22 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 15:12 gdb.error: "define PI" is not a prefix command Simon Sobisch via Gdb
2021-12-22 17:56 ` Andrew Burgess via Gdb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox