News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Feature Request/Help: GDB Vector, nested vector, and strut viewing.[SOLVED]

Started by PureBlackSin, July 19, 2012, 02:34:04 AM

Previous topic - Next topic

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

PureBlackSin

Okay, I'm really struggling to get these scripts to be found and run by gdb. I really have tried to follow the instructions. Can someone give me an idiots guide to getting this set up. Commands to type, config files to make and menu settings to select. I've honestly tried and need help... Can someone give me a step by step here?

ollydbg

Quote from: PureBlackSin on July 21, 2012, 12:56:21 AM
Okay, I'm really struggling to get these scripts to be found and run by gdb. I really have tried to follow the instructions. Can someone give me an idiots guide to getting this set up. Commands to type, config files to make and menu settings to select. I've honestly tried and need help... Can someone give me a step by step here?
I re-read the log message here:
http://forums.next.codeblocks.org/index.php/topic,16607.msg112768.html#msg112768
It seems that I can see any command to load the pretty printer for std c++.

You need to add a command: (There is an option in Codeblocks' debugger setting dialog)


source /path/to/some.gdb

Note:
The file "/path/to/some.gdb" should contains the script mentioned here:
http://sourceware.org/gdb/wiki/STLSupport
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

ollydbg: this is not needed, becase gdb supports auto loading them...

pureblacksin: try this command in a terminal

$ ldd /usr/bin/gdb | grep pyt

It will tell you if gdb is compiled with python support, if the output is empty, then you have no luck.
But I'm pretty sure it will be non-empty.
Also you can search for the printer files, they are python scripts.
See what do I have on my system:

/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/python/libstdcxx/__init__.py
/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/python/libstdcxx/v6/__init__.py
/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/python/libstdcxx/v6/printers.py
/usr/share/gdb/auto-load/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.0/32/libstdc++.so.6.0.17-gdb.py
/usr/share/gdb/auto-load/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.0/libstdc++.so.6.0.17-gdb.py

I have these for all three supported compiles I have (4.5, 4.6 and 4.7).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

PureBlackSin

Right first bit had an output of:

james@ubuntu:~/python$ ldd /usr/bin/gdb | grep pyt
libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007fd03bcfc000)


I have the first three files in a couple of folders which I downloaded, they are not in those directories, I don't have those directories.

The last two, the closest I can get to that path is:
/usr/share/gdb/gdb/auto-load
This directory terminates, has two .gdb files in it neither of which look like yours.

I tried to run make in the checked out folder where the first three files were, make didn't work. I did this to see if it would generate any files...

oBFusCATed

Then you should manually download the stl python printer files and to put the loading code in the .gdbinit or another file which you have to source in the initial commands.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

PureBlackSin

Quote from: oBFusCATed on July 22, 2012, 11:03:01 AM
Then you should manually download the stl python printer files and to put the loading code in the .gdbinit or another file which you have to source in the initial commands.

Right, I have re-done that. I now have the python files checked out to the home directory, in the home directory I made a file called .gdbinit like I was told and have pointed the file at the python folder, i.e. the one that was checked out.

Now how to I tell the debugger to read the .gdbinit from the home directory... This could be the bit that is going wrong. Also, what file is the .gdbinit file looking for? I might need to let it look deeper into the python, checked out folder.

oBFusCATed

Try to put "source ~/.gdbinit" in the initial commands in the settings.
C::B uses the -nx command line flag to tell gdb to not read the ~/.gdbinit file by default.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

PureBlackSin

Quote from: oBFusCATed on July 22, 2012, 05:57:55 PM
Try to put "source ~/.gdbinit" in the initial commands in the settings.
C::B uses the -nx command line flag to tell gdb to not read the ~/.gdbinit file by default.

Right, well I got it in:

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet source ~/.gdbinit -args /host/James/Ubuntu/C-C++/ParseWords/bin/Debug/ParseWords
done


however -nx is still there, and still no joy, although this looks like an improvement :)

oBFusCATed

Put the source command in the initial commands field, not the args field...
If it doesn't work, put the initialization code in another file and source it.
You have to see "source my_file.source" command in the log, not in the gdb command line.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

PureBlackSin