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