www.digitalmars.com         C & C++   DMDScript  

c++ - Commandline option for windbg/cdb

reply "Guru Kathiresan" <gururamnath -----yahoo-------.com> writes:
Hello,
I'm trying to use windbg/cdb to debug a small "hello world" program but so 
far the debugger is not able to put a breakpoint in the requested line.
Currently I'm using -g and -D to compile the code.
Can anyone please let me know what other commandline options we need to pass 
?

Following are the cmdline I'm using to compile the executable :

dmc.exe /c main.cpp -oDMC/main.obj -A99 -D -g
link.exe /NOLOGO /SILENT /NOI /DELEXECUTABLE /EXETYPE:NT /su:windows:4.0 
DMC\main.obj , DMC\consoltest.exe, ,,,

Thanks,
Guru Kathiresan
http://wxdsgn.sf.net 
Jan 18 2007
parent reply Walter Bright <newshound digitalmars.com> writes:
Guru Kathiresan wrote:
 Hello,
 I'm trying to use windbg/cdb to debug a small "hello world" program but so 
 far the debugger is not able to put a breakpoint in the requested line.
 Currently I'm using -g and -D to compile the code.
 Can anyone please let me know what other commandline options we need to pass 
 ?
 
 Following are the cmdline I'm using to compile the executable :
 
 dmc.exe /c main.cpp -oDMC/main.obj -A99 -D -g
 link.exe /NOLOGO /SILENT /NOI /DELEXECUTABLE /EXETYPE:NT /su:windows:4.0 
 DMC\main.obj , DMC\consoltest.exe, ,,,
Need to pass /CO to the linker.
Jan 18 2007
parent reply "Guru Kathiresan" <gururamnath -----yahoo-------.com> writes:
Hi Walter,
Thanks for your reply. I am able to generate the debug information in the 
exe (after some struggle, as my  path variable had + sign) but it is not 
recognizable by the cdb. I'm using the July 2006 release of cdb (6.6.7.5).



When I view the executable content in a PE viewer  ( 
http://www.smidgeonsoft.prohosting.com/pebrowse-pro-file-viewer.html ) I can 
see the CodeView section. When I use another PE view I get the following 
info :


Debug Formats in File:
  Type            Size       Address    FilePtr    Charactr   TimeData 
Version
  CODEVIEW        0x00005EBC 0x0000E01C 0x00009E20 0x00000000 0x00000000 
0.00

  UNKNOWN/BORLAND 0x56430001 0x00000002 0x00000010 0x00000000 0x3930424E 
23184.00
  Unknown         0x6F432073 0x6C69706D 0x6D5C7265 0x00000023 0x6769441E 
29801.27745
  Unknown         0x00000002 0x00000034 0x000000CC 0x2E6E6961 0x006A626F 
0.01
  Unknown         0x56430001 0x00000002 0x00000100 0x6E6F6308 0x72617473 
116.00
  Unknown         0x56430000 0x63786508 0x736C7470 0x00000012 0x72705F07 
28265.26228
  CODEVIEW        0x00000114 0x000000D8 0x73686506 0x00000074 0x00010000 
1.22083

---- EXCEPTION: Debug Directory is corrupted.

Currently my modified command line looks like this :

 dmc.exe -c main.cpp -o"DMC/main.obj" -I"C:/Program 
Files/Dev-Cpp/include/dmars/stlport/stlport" -I"C:/Program 
Files/Dev-Cpp/include/dmars/include/win32"  -D_STLP_NO_NEW_IOSTREAMS -A99 -D 
 -g

link.exe /NOLOGO /SILENT /NOI /DELEXECUTABLE /EXETYPE:NT /su:windows:4.0 
/CO:4 "DMC\main.obj" ,"DMC\consoltest.exe", ,,,

-regards,
Guru Kathiresan

"Walter Bright" <newshound digitalmars.com> wrote in message 
news:eoof8m$1j33$1 digitaldaemon.com...
 Need to pass /CO to the linker. 
Jan 19 2007
parent reply Walter Bright <newshound digitalmars.com> writes:
Guru Kathiresan wrote:
 Hi Walter,
 Thanks for your reply. I am able to generate the debug information in the 
 exe (after some struggle, as my  path variable had + sign) but it is not 
 recognizable by the cdb. I'm using the July 2006 release of cdb (6.6.7.5).
Try using windbg.exe that comes with dmd.
Jan 19 2007
parent reply "Guru Kathiresan" <gururamnath -----yahoo-------.com> writes:
Hi Walter,

It seems the windbg provided with dmd is pretty old. Is there any chance to 
make the debug info recognized by the latest windbg/cdb ? Or If you have the 
cmd line equivalent of winddbg (cdb) that supports CV 4 format, please let 
me know where I can get it.



The main reason for asking this is that we are adding support to Digital 
Mars C++ in our wxWidgets IDE wx-DevC++ and so far we are able to make the 
IDE work seamlessly with the build system (currently out of the box a 
wxWidgets app can be compiled with DMC without any manual configuration) but 
the debugging part is still not working. Currently we have added the ability 
to debug VC++ built executables by interacting with cdb but we are not able 
to use it for debugging dmc produced executables.



If there is chance to either debug the dmc exes with cdb or gdb (we do 
support it in our IDE), I'm sure thousands of users will greatly benefit by 
the ultrafast dmc. With our plans to support wxD Form designer, even the D 
users will also benefit from this.



You can find information about the wx-DevC++ IDE support for DMC at





Once again thanks for the best compiler for win32.



-regards,

Guru Kathiresan





"Walter Bright" <newshound digitalmars.com> wrote in message 
news:eor870$2p5o$1 digitaldaemon.com...
 Guru Kathiresan wrote:
 Hi Walter,
 Thanks for your reply. I am able to generate the debug information in the 
 exe (after some struggle, as my  path variable had + sign) but it is not 
 recognizable by the cdb. I'm using the July 2006 release of cdb 
 (6.6.7.5).
Try using windbg.exe that comes with dmd.
Jan 19 2007
next sibling parent Walter Bright <newshound digitalmars.com> writes:
Guru Kathiresan wrote:
 It seems the windbg provided with dmd is pretty old.
Yes.
 Is there any chance to 
 make the debug info recognized by the latest windbg/cdb ?
It's a lot of work.
 Or If you have the 
 cmd line equivalent of winddbg (cdb) that supports CV 4 format, please let 
 me know where I can get it.
 
 
 
 The main reason for asking this is that we are adding support to Digital 
 Mars C++ in our wxWidgets IDE wx-DevC++ and so far we are able to make the 
 IDE work seamlessly with the build system (currently out of the box a 
 wxWidgets app can be compiled with DMC without any manual configuration) but 
 the debugging part is still not working. Currently we have added the ability 
 to debug VC++ built executables by interacting with cdb but we are not able 
 to use it for debugging dmc produced executables.
 
 
 
 If there is chance to either debug the dmc exes with cdb or gdb (we do 
 support it in our IDE), I'm sure thousands of users will greatly benefit by 
 the ultrafast dmc. With our plans to support wxD Form designer, even the D 
 users will also benefit from this.
 
 
 
 You can find information about the wx-DevC++ IDE support for DMC at
 

 
 
 
 Once again thanks for the best compiler for win32.
You're welcome.
Jan 19 2007
prev sibling parent reply Lazyman <mail mail.com> writes:
Walter is being asked for ages to modify symbol output, but he either refuses
to talk about it or says that it's up to OPTLINK
which is not his own property. I think we wait until he retires and the DMC
goes open source.
Feb 07 2007
parent "Guru Kathiresan" <gururamnath -----yahoo-------.com> writes:
I actually found that the watcom debugger can debug the code generated by 
DMC(provided you need to add the source path in the debugger). I have 
already created a prototype of the commandline version of Watcom debugger. 
We'll eventually add integrated debugging for DMC generated executable in 
wx-DevC++. I'm really excited to know atleast there is an alternative 
solution now.

-Guru Kathiresan

"Lazyman" <mail mail.com> wrote in message 
news:eqcm11$2sk1$1 digitaldaemon.com...
 Walter is being asked for ages to modify symbol output, but he either 
 refuses to talk about it or says that it's up to OPTLINK
 which is not his own property. I think we wait until he retires and the 
 DMC goes open source. 
Feb 07 2007