how to extract all the global variables , data structures and sub-structures (with address, type and values) from core dump,using gdb-python, generated after crashing of a C code.?
Asked
Active
Viewed 1,017 times
1
-
There is an open source project [Core Analyser](http://sourceforge.net/projects/core-analyzer/) that may have everything you need. – Preet Sangha May 16 '13 at 11:02
-
Why the python tags if this is C code? – symcbean May 16 '13 at 11:12
-
@symcbean, because gdb extension supports python. – Baijnath Jaiswal May 16 '13 at 11:38
-
What is "gdb extension"? Gdb supports lots of languages. – symcbean May 16 '13 at 12:11
-
@symcbean, means python script can be executed inside gdb promp,which make gdb very powerful – Baijnath Jaiswal May 16 '13 at 12:18
-
@PreetSangha, thanks but do you know how to do that under gdb? – Baijnath Jaiswal May 16 '13 at 13:43
-
@Baijnath: why must you use GDB if another open source tool can do it as well. – Lie Ryan May 17 '13 at 08:45
-
@Lie Ryan, Actually i want to write a script in python which will be executed under gdb to perform those operations. – Baijnath Jaiswal May 17 '13 at 14:20
-
is there any direct command to get all the global symbols name and value inside gdb? – Baijnath Jaiswal May 21 '13 at 06:17
1 Answers
1
There isn't a way to iterate over symbol tables from Python yet. So, it can't be done.
However, adding support to expose this information to Python would be a reasonable thing to do.

Tom Tromey
- 21,507
- 2
- 45
- 63
-
@Tromey , Thanks. So could you please guide me how to get all the global variables(excluding libraries symbols), data structures and sub-structures (with address, type and values) from core dump manually in gdb prompt .? so i will try to do this in python. – Baijnath Jaiswal May 24 '13 at 04:41
-
It can't be done programatically from the gdb CLI, either. You have to extend the C code. – Tom Tromey May 24 '13 at 16:46