Author Topic: [OT] unofficial MinGW GDB gdb with python released  (Read 96851 times)

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #90 on: March 01, 2010, 07:30:39 am »
Finally, I have successfully build gdb.exe with expat-1.dll support. Here are the major steps, I hope it can help others to build gdb.exe himself.

You need MSYS and MinGW installed in your system.

First, you need to build expat library.
1, Download the expat source.
2, Suppose your expat2.0.1 source code was located in c:\expat2.0.1, and you would like the generated dll installed in c:\install_expat
In MSYS, under /c/expat2.0.1, entering these command:
Code: [Select]
./configure -prefix=/c/install_expat --enable-shared3, make[press enter]
4, make install[press enter]
Then, you will have all the files in c:\install_expat. also, don't forget to run the strip command to strip the debug information. for example:
strip expat-1.dll will remove the strip information in this dll, and reduce the dll file size.

Second, build gdb
You need to copy all the files under c:\install_expat to c:\mingw, I suppose you have install MinGW in "c:\mingw", so, now, the compiler can find both the headers and libraries.

1, download the gdb source file, and unzip them, eg, they are extract to c:\gdb2010XXX
2, Create two empty folders, one is c:\obj_gdb, and the other is c:\install_gdb
3, in MSYS command, go to /c/obj_gdb
4, run these command:
Code: [Select]
../gdb2010XXX/configure --prefix=/c/install_gdb  --with-expat5, make[press enter] , this will build the gdb.exe and gdbserver.exe, take about half an hour in my P43.0 CPU.
6, make install[press enter]

After this, all the files were in c:\install_gdb
Also, don't forget to run the strip command to reduce the file size in c:\install_gdb\bin
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #91 on: March 13, 2010, 01:08:48 am »
I have upload the gdb7.0.1 version to gdb7.0.1_ollydbg.7z.

I  built it in TDM GCC 4.4.1dw2, also, I have comment the warning statement in symtab.c of the gdb source, so there is no such warning now. Since the new GDB 7.0.50 version and the GDB branch 7.0.90 is still experience the watch wxString lag problem I statement before.

Also, I build this gdb.exe statically link the expat library, so you don't need expat-1.dll.
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #92 on: March 19, 2010, 04:01:03 am »
Hi, all.
today, gdb 7.1 official released, see here: GDB: The GNU Project Debugger

I have build this version under Loaden's GCC 4.4.3. I can debug under Codeblocks, but I still have some problems. the major problem is that showing variables in the Watch window of C::B, and the command interpreter runs really slow when I debug the Codecompletion plugin DLL.

See a more details in Asm_gmail - Re: gdb-7.1 - last call before release (Wed, Mar 17th).

Can some one help me? you can build a gdb yourself, or you can test the gdb I built from gdb7.1.7z

Thanks.

Edit
You can compare these two version of gdb
gdb7.0.1_ollydbg.7z, I build from TDM gcc 4.4.1dw2,with static expat library, based on the official gdb 7.0.1 source code, and I only comment out the #psymbal warning message.
and
gdb7.1.7z, I built from Loaden gcc 4.4.3, with static expat library, based on the official gdb 7.1 source code.

You will notice that the first one gdb7.0.1_ollydbg.7z runs really faster then the second one.
« Last Edit: March 19, 2010, 08:13:12 am by ollydbg »
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: 7784
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #93 on: March 19, 2010, 10:45:59 am »
Ah, great... time to test gdb_mi with this :)
<debugger plugin maintainer>
(most of the time I ignore long posts)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #94 on: March 19, 2010, 11:30:04 am »
I have build this version under Loaden's GCC 4.4.3. I can debug under Codeblocks, but I still have some problems. the major problem is that showing variables in the Watch window of C::B, and the command interpreter runs really slow when I debug the Codecompletion plugin DLL.
In here, there is no delay, very fast! :lol:

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #95 on: March 21, 2010, 06:28:25 am »
Just a reminder:
Today, Chirs has announced an offcial mingw gdb 7.1 in the mingw maillist:

Quote
I've uploaded a new mingw gdb build created from the vanilla gdb 7.1 sources:

http://sourceforge.net/projects/mingw/files/GNU%20Source-Level%20Debugger/GDB-7.1/gdb-7.1-1-mingw32-bin.tar.gz/download

The sources can be found here:

http://sourceforge.net/projects/mingw/files/GNU%20Source-Level%20Debugger/GDB-7.1/gdb-7.1-src.tar.gz/download

Please report any issues to this mailing list.

Chris

I have tested it and found that this one can't debug into a dll source. The same as this bug report and discussion:
Re: [OT] MinGW GDB 7.0 is released

Thanks.
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 Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #96 on: March 21, 2010, 08:00:46 am »
I have build this version under Loaden's GCC 4.4.3. I can debug under Codeblocks, but I still have some problems. the major problem is that showing variables in the Watch window of C::B, and the command interpreter runs really slow when I debug the Codecompletion plugin DLL.
In here, there is no delay, very fast! :lol:
I'm sorry, that my original testing method was wrong, now, I have exprenced the debug lag problem too.( using gdb 7.1)

Here is the instrucntions to reproduce the problem:

1, start debugging
2, set a breakpoint in the parserthread.cpp, line 450
3, add a watch variable: token, which is a wxString
4, when the debugger reach the breakpoint, you will notice the debugger toolbar will disabled for several seconds.
5, then, you will see the token's value in "watch window".
6, you press "step" button in the debugger toolbar.
7, you will notice that the toolbar disabled agian for a few seconds, and the lag happens again.

I have trid the mingw gdb 7.0.1, these is no such time delay probelm.
« Last Edit: March 21, 2010, 08:13:07 am by Loaden »

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] MinGW GDB 7.0.1 is released in 2010 01 07
« Reply #97 on: May 22, 2010, 07:53:58 am »
Hi, all.

I have successfully built the mingw gdb 7.1.50 snapshot from the source gdb-7.1.50.20100521. tar.bz2 link to expat static library (under Loaden's mingw 4.4.4 and Msys)

You can download it from gdb-7.1.50.20100521.7z

It is just runs fast as gdb 7.0.1.
As you know, the 7.1 version has some problems(time delay when showing wxString), this gdb 7.1.50 don't have this problem.

Have a try!!

ollydbg
« Last Edit: May 22, 2010, 07:55:58 am by ollydbg »
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] ollydbg's unoffcial MinGW GDB 7.1.50-20100521 released
« Reply #98 on: June 14, 2010, 10:29:39 am »
Updated 2010-06-15
I found that the gdb.exe build from tdm-gcc 4.5 lacks iconv library, this will cause the problem like: Bug 10908 - error reading variable for char variable, So, I rebuild the gdb under Loaden's GCC 4.4.4, now, it works fine, so, I suggest you need to download the file gdb-7.1.50.20100613withpython-2.7z

2010-06-14
Hi, all. Today, I have build the latest gdb CVS under TDM-MinGW 4.5 dw2 with python support.

Firstly, you need to install the python environment, I use header file and libs in this package python Python 2.6.5 Windows installer

the gdb package can be downloaded from Loaden's site: gdb-7.1.50.20100613withpython-2.7z

Now, I have testing the pretty print function of python, it works fine!! :D

There are the brief steps to use the pretty print function. I mainly followed STLSupport - GDB Wiki

The only difference is that, you can create a single *.gdb file, then use this command  "source *.gdb"  instead of using a .gdbinit file.

Then you can add it here: in the debugger setting dialog, see attachment image

Also, I think many py pretty printers can be added, like the wxWidgets support.
http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/misc/gdb/print.py



[attachment deleted by admin]
« Last Edit: June 15, 2010, 07:12:53 am by ollydbg »
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] ollydbg's unoffcial MinGW GDB 7.1.50-20100521 released
« Reply #99 on: June 14, 2010, 10:33:40 am »
Here is the test code:
Code: [Select]
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef vector<string> vstr;

int main()
{
    vstr vvvv;
    vvvv.push_back("bla bla");
    vvvv.push_back("aaabbb");
    string v0 = vvvv[0];
    cout << "Hello world!" << endl;

    return 0;
}

Then ,you can enter "print vvvv" in the debugger edit control, and here is the log output:

Quote
> print vvvv
$2 = std::vector of length 2, capacity 2 = {"bla bla", "aaabbb"}
>>>>>>cb_gdb:
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Just a reminder, the new gdb version with wxWidgets and stl python script released. see the updated OP
[OT] ollydbg's unoffcial MinGW GDB gdb-7.1.50.20100623 with python released
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 nenin

  • Advanced newcomer
  • *
  • Posts: 92
Lokks like it works. Thanks!
Where I can find instructions to prepare pretty printer for class? Actually I now need it just for std::vallaray.   

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Lokks like it works. Thanks!
Where I can find instructions to prepare pretty printer for class? Actually I now need it just for std::vallaray.   

Nice.
You can see this wiki page:
STLSupport - GDB Wiki
So, I think you can see the python script in the GCC's trunk.
By the way, it seems the Latest svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python does not works correctly. I just use an old revision.

You can see the web page's of Tom( he is the main dev of GDB)
7. Pretty printing, part 1 The Cliffs of Inanity

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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Just a reminder:
New gdb cvs version was released.See
[OT] ollydbg's unoffcial MinGW GDB gdb-7.2.50.20100708 with python released
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.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4183
  • Interests on OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [OT] unoffcial MinGW GDB gdb-7.2 with python released
« Reply #104 on: September 05, 2010, 02:55:36 pm »
Hi, new gdb 7.2 for windows is released.

2010-09-05
since the official gdb 7.2 is released, then Loaden has build this one, he just build it from the official gdb 7.2 source(no extra patches is used).
it is linked to expat static library, also python pretty script is enabled. (the package has python script for std library and wxwidgets)
You can download it from:
gdb-7.2.7z
Thanks loaden for the build.


Have a try!!!
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.