Author Topic: Feature Request/Help: GDB Vector, nested vector, and strut viewing.[SOLVED]  (Read 16419 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #15 on: July 20, 2012, 10:45:02 pm »
For me it works by default (gentoo+gcc-4.7+gdb-7.4)
(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!]

Offline PureBlackSin

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #16 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?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #17 on: July 21, 2012, 03:50:11 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.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)

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #18 on: July 21, 2012, 10:03:23 am »
ollydbg: this is not needed, becase gdb supports auto loading them...

pureblacksin: try this command in a terminal
Code
$ 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:
Code
/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!]

Offline PureBlackSin

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #19 on: July 22, 2012, 02:09:40 am »
Right first bit had an output of:

Code
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:
Code
/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...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #20 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.
(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!]

Offline PureBlackSin

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #21 on: July 22, 2012, 05:33:14 pm »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #22 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.
(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!]

Offline PureBlackSin

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #23 on: July 22, 2012, 08:01:13 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:

Code
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 :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #24 on: July 22, 2012, 11:26:06 pm »
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!]

Offline PureBlackSin

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Feature Request/Help: GDB Vector, nested vector, and strut viewing.
« Reply #25 on: July 23, 2012, 04:48:23 am »
Perfect! Yep, sorted Cheers, you've just made my day!!!