Author Topic: debugger plugin feature request about the initial command of GDB  (Read 23743 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger plugin feature request about the initial command of GDB
« Reply #15 on: August 09, 2011, 02:55:01 pm »
@xunxun, here is the log of gdb (without the hack of gdb's share path), it shows both worked and un-worked condition.

Quote
E:\test\unix_gdb\install\mingw\bin>gdb --data-directory=e:/test/unix_gdb/install
/mingw/share/gdb
GNU gdb (GDB) 7.3.50.20110808-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) info pretty-printer
(gdb) q

E:\test\unix_gdb\install\mingw\bin>gdb
GNU gdb (GDB) 7.3.50.20110808-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) info pretty-printer
Undefined info command: "pretty-printer".  Try "help info".
(gdb)

the gdb's shared folder is used when it's python module is initialized. but the python module is running before you "set-directory" command.
so the only way to set the data-directory is setting that path as gdb parameters, like "gdb --data-directory=XXX"

the other way such as “set data-directory XXX” can not work.



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 xunxun

  • Almost regular
  • **
  • Posts: 187
Re: debugger plugin feature request about the initial command of GDB
« Reply #16 on: August 09, 2011, 02:57:59 pm »
so we can use the command :
gdb -ex "set data-directory e:\mypack\mingw\share\gdb"
Why would you do this instead of passing --data-dir?
[/quote]
I want to make gdb auto source this script, but .gdbinit must be in the current directory, so "-ex" only is the test.
Regards,
xunxun

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: debugger plugin feature request about the initial command of GDB
« Reply #17 on: August 09, 2011, 03:01:04 pm »

the gdb's shared folder is used when it's python module is initialized. but the python module is running before you "set-directory" command.
so the only way to set the data-directory is setting that path as gdb parameters, like "gdb --data-directory=XXX"

the other way such as “set data-directory XXX” can not work.
Can we redefine gdb.PYTHONDIR to gdb's data directory in python.c?
Regards,
xunxun

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: debugger plugin feature request about the initial command of GDB
« Reply #18 on: January 09, 2012, 11:23:07 pm »
I've added an option to set custom arguments to gdb, please test it and report if it really works.
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger plugin feature request about the initial command of GDB
« Reply #19 on: January 10, 2012, 01:59:16 am »
I've added an option to set custom arguments to gdb, please test it and report if it really works.
I will test it ASAP, currently I can't synchonize SVN now due to network issue. :)
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger plugin feature request about the initial command of GDB
« Reply #20 on: January 11, 2012, 02:10:42 am »
I've added an option to set custom arguments to gdb, please test it and report if it really works.

Setting gdb startup arguments works fine.

Thank you!

PS:
Under MinGW, if you would like to Automatically load gdb's own python pretty script, you still  need to hack the gdb's source code, as I said before, it can't be done by pass the "-data-directory ...." in the gdb's startup arguments.

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.