Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Martin K. on September 20, 2012, 12:51:26 pm

Title: someone working on CDB debugger?
Post by: Martin K. on September 20, 2012, 12:51:26 pm
Hi,

Is curently someone working on the CDB Debugger Plugin? There are a few funktions open and they cry out for implementation ;-)

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on September 20, 2012, 08:23:06 pm
No. Keep in mind that some of them aren't implementable.

But what version are you talking about? 10.05 or latest HEAD?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on September 20, 2012, 09:01:35 pm
Hi,

Wich one isn't implementable? CDB is a powerful debugger and its expandable.

I'm talking about the HEAD (8397)

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on September 20, 2012, 09:04:12 pm
Wich one isn't implementable? CDB is a powerful debugger and its expandable.
Don't remember any more. CDB is not meant to be integrated in an IDE.
It could be powerful, but parsing its output is way harder than parsing gdb's output.

If you care for CDB support, provide patches and I'll see if they are good and I'll integrate them.
I don't use CDB and I rarely use Windows, so there are very little chances for CDB improvements in the future done by me.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on September 20, 2012, 09:26:51 pm

Don't remember any more. CDB is not meant to be integrated in an IDE.
It could be powerful, but parsing its output is way harder than parsing gdb's output.

If you care for CDB support, provide patches and I'll see if they are good and I'll integrate them.
I don't use CDB and I rarely use Windows, so there are very little chances for CDB improvements in the future done by me.

CDB is generally a commandline wrapper for dbgeng.dll. Maybe it would to use the debug engine without CDB, i don't know (yet).
But i can try my best, should i extend the existing CDB over GDB part or should i write a new debugger plugin? What do you think?

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on September 20, 2012, 10:08:24 pm
Hm, interesting...
I didn't know that there is this kind of a dll.
So the best way is to write a new debugger engine application as MS call it, which can use some IPC mechanism to communicate with a debugger plugin.
Another option is to try to integrate the dll in a new debugger plugin.
This way you won't need to parse the text output from CDB, which is close to unparsable sometimes.

Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 01, 2012, 11:07:32 am
Hi,

OK, i'm working on this and have one first Question:
In ExamineMemoryDlg::AddHexByte there is a loop for 16 hex bytes in one row of the window. But m_LastRowStartingAddress will be advanced by only 8. Is this OK?

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 01, 2012, 11:57:17 am
I'm not sure. Have you look what is the output of the gdb that is being parsed?
Keep in mind that the examine memory window has not been made generic,
it simply has been extracted from the code inside the plugin to the sdk without modifications.
It is very gdb specific and needs some work to be made generic.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 01, 2012, 12:39:27 pm
Hi,

I have found "my" Problem. The fault is inside of  ExamineMemoryDlg::AddHexByte();

It takes the address of the memory range to be displayed once on the first value, and then after every completed line. There are a maximum of 16 Values in each line and the next address will be computed from the last adress value + 8. This works only when the adress delivered to this funktion will is valid on every 8. value and don't change for the next 8 values.
The GDB Driver will work, it "sends" the memory dump values to this funktion in packages of 8 values. Every other combination will not work. And there is an additional Problem when the memory dump starts at address 0.

I will work around this problem in my funktion until someone other fixes the behaviour of  ExamineMemoryDlg::AddHexByte().

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 01, 2012, 07:32:17 pm
I will work around this problem in my funktion until someone other fixes the behaviour of  ExamineMemoryDlg::AddHexByte().
Why not fixing the AddHexByte directly?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 01, 2012, 08:20:36 pm
I will work around this problem in my funktion until someone other fixes the behaviour of  ExamineMemoryDlg::AddHexByte().
Why not fixing the AddHexByte directly?

My main problem is the CDB plugin currently and i can work on it only on my spare time. The "workaround" is currently faster for me, so i don't have to check other things that i'm not know currently. But i can note this problem on my list and can come back later to it.

Martin
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 03, 2012, 02:05:44 pm
Hi,

I have prepared a first version of the CDB Debugger plugin. Maybe someone is able to have a look on it.

https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip (https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip)


This plugin is based on the new Code::Blocks debugger plugin structure, based on debugger_gdbmi.
The Debugger is driven on its commandline version CDB.exe.

It is not yet completed, but it seems to work. available functions so far:
- start a debuggee, break into it, stop it
- set unconditinal Breakpoints and delete it
- shows tooltip watches
- set simple watches and delete it
- show threads
- show backtrace
- show memory dump
- show cpu registers

Overall performance seems to be OK.

unavailable functions:
- Breakpoint and watches are needing further improvements.
- There are no Data Brakpoints and no conditional Breakpoints.
- Run to cursor isn't implemented.
- Attach to/detach from process isn't implemented.
- Disassembly isn't implemented.
- The display of watches is currently the output of the debugger,
  pretty printig whould be nice.

Tested with
- Code::Blocks rev 8383, rev 8397 and rev 8431.
- CDB Version 6.12.0002.633 X86
on windows XP SP3 32Bit and Windows 7 64Bit

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 03, 2012, 06:17:47 pm
I have prepared a first version of the CDB Debugger plugin. Maybe someone is able to have a look on it.

https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip (https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip)
Have you though of putting it on github or something like this?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 04, 2012, 06:16:12 pm
I have prepared a first version of the CDB Debugger plugin. Maybe someone is able to have a look on it.

https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip (https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip)
Have you though of putting it on github or something like this?

http://svn.code.sf.net/p/debuggercdb/code/trunk (http://svn.code.sf.net/p/debuggercdb/code/trunk)  ;)

Martin
Title: Re: someone working on CDB debugger?
Post by: CsrPryr on October 07, 2012, 09:44:28 am
send me compile errors?....


||=== debugger_cdb, default ===|
C:\wxWidgets-2.8.12\include\wx\platform.h|196|error: wx/setup.h: No such file or directory|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|103|error: #error "wxUSE_DYNLIB_CLASS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|111|error: #error "wxUSE_EXCEPTIONS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|119|error: #error "wxUSE_FILESYSTEM must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|127|error: #error "wxUSE_FS_ARCHIVE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|140|error: #error "wxUSE_DYNAMIC_LOADER must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|148|error: #error "wxUSE_LOG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|156|error: #error "wxUSE_LONGLONG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|164|error: #error "wxUSE_MIMETYPE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|180|error: #error "wxUSE_PRINTF_POS_PARAMS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|188|error: #error "wxUSE_PROTOCOL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|230|error: #error "wxUSE_REGEX must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|238|error: #error "wxUSE_STDPATHS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|246|error: #error "wxUSE_XML must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|254|error: #error "wxUSE_SOCKETS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|262|error: #error "wxUSE_STREAMS must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|270|error: #error "wxUSE_STOPWATCH must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|278|error: #error "wxUSE_TEXTBUFFER must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|286|error: #error "wxUSE_TEXTFILE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|302|error: #error "wxUSE_URL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|310|error: #error "wxUSE_VARIANT must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|330|error: #error "wxUSE_ABOUTDLG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|338|error: #error "wxUSE_ACCEL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|346|error: #error "wxUSE_ANIMATIONCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|354|error: #error "wxUSE_BITMAPCOMBOBOX must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|362|error: #error "wxUSE_BMPBUTTON must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|370|error: #error "wxUSE_BUTTON must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|378|error: #error "wxUSE_CALENDARCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|386|error: #error "wxUSE_CARET must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|394|error: #error "wxUSE_CHECKBOX must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|410|error: #error "wxUSE_CHOICE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|418|error: #error "wxUSE_CHOICEBOOK must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|426|error: #error "wxUSE_CHOICEDLG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|434|error: #error "wxUSE_CLIPBOARD must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|442|error: #error "wxUSE_COLLPANE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|450|error: #error "wxUSE_COLOURDLG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|458|error: #error "wxUSE_COLOURPICKERCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|466|error: #error "wxUSE_COMBOBOX must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|474|error: #error "wxUSE_COMBOCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|482|error: #error "wxUSE_DATAOBJ must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|490|error: #error "wxUSE_DATAVIEWCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|498|error: #error "wxUSE_DATEPICKCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|506|error: #error "wxUSE_DIRPICKERCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|514|error: #error "wxUSE_DISPLAY must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|522|error: #error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|530|error: #error "wxUSE_FILEDLG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|538|error: #error "wxUSE_FILEPICKERCTRL must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|546|error: #error "wxUSE_FONTDLG must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|554|error: #error "wxUSE_FONTMAP must be defined."|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|562|error: #error "wxUSE_FONTPICKERCTRL must be defined."|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|
Title: Re: someone working on CDB debugger?
Post by: Jenna on October 07, 2012, 10:28:16 am
send me compile errors?....


||=== debugger_cdb, default ===|
C:\wxWidgets-2.8.12\include\wx\platform.h|196|error: wx/setup.h: No such file or directory|
[...]
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Looks like a not build wxWidgets library (at least not for the parameters you use).
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 08, 2012, 09:19:29 pm
I have prepared a first version of the CDB Debugger plugin. Maybe someone is able to have a look on it.

https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip (https://www.dropbox.com/s/ds1b5rr7ouhhvsl/debugger_cdb.zip)
Have you though of putting it on github or something like this?

http://svn.code.sf.net/p/debuggercdb/code/trunk (http://svn.code.sf.net/p/debuggercdb/code/trunk)  ;)

Martin

I have a new update: Disassembly window and 64Bit CDB running 32 Bit Software works also.
shortly tested on rev 8442.

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 08, 2012, 10:29:54 pm
Some suggestions:
1. don't use wxarray as it will hurt, search the forum for details
2. name your files with only lower case + underscores
3. try to follow (to some extent) the c::b coding guideline

2 and 3 are if you want the sources to be included in C::B in the future.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 08, 2012, 11:47:34 pm
Some suggestions:
1. don't use wxarray as it will hurt, search the forum for details
2. name your files with only lower case + underscores
3. try to follow (to some extent) the c::b coding guideline

2 and 3 are if you want the sources to be included in C::B in the future.

1. OK, i will have a look on it.
2. OK
3. ohh, there are coding guidelines? What is wrong with my code?

Martin
Title: Re: someone working on CDB debugger?
Post by: stahta01 on October 08, 2012, 11:55:00 pm
send me compile errors?....


||=== debugger_cdb, default ===|
C:\wxWidgets-2.8.12\include\wx\platform.h|196|error: wx/setup.h: No such file or directory|
C:\wxWidgets-2.8.12\include\wx\chkconf.h|103|error: #error "wxUSE_DYNLIB_CLASS must be defined."|

C:\wxWidgets-2.8.12\include\wx\chkconf.h|562|error: #error "wxUSE_FONTPICKERCTRL must be defined."|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

DO NOT TAKE OVER ANOTHER PERSON POST.

Read the Wiki page
http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef)

Tim S.
Title: Re: someone working on CDB debugger?
Post by: Alpha on October 08, 2012, 11:57:18 pm
3. ohh, there are coding guidelines? What is wrong with my code?
I have not looked at your code, but see Coding style (http://wiki.codeblocks.org/index.php?title=Coding_style) for how Code::Blocks (mostly) does it.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 09, 2012, 06:02:23 am
3. ohh, there are coding guidelines? What is wrong with my code?
I have not looked at your code, but see Coding style (http://wiki.codeblocks.org/index.php?title=Coding_style) for how Code::Blocks (mostly) does it.

Thank you for the link, but i currently can't see the big problem with my code.

Martin
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 09, 2012, 06:42:12 pm
a new one:

renamed every file to lowercase
reformated the source with astyle
everything is in namespace now (except the plugin itself)
renamed a few class variables
changes the wxarray to stl::dqueue
breakpoint enable/disable and delete

is there someone looking on or should i stop the announcements?

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 09, 2012, 07:58:55 pm
is there someone looking on or should i stop the announcements?
Keep 'em coming.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 10, 2012, 09:33:47 pm
is there someone looking on or should i stop the announcements?
Keep 'em coming.

OK, rev 8:
Runto cursor
Visual C++ 6 support
more documentation

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 11, 2012, 09:20:38 am
Visual C++ 6 support
BTW, it has been some time I was using VS and the CDB debugger. It seems its now integrated in the Windows platform SDK but one can extract it easily from there. What version(s) are you using for your trials? One of these:
http://msdn.microsoft.com/en-us/windows/hardware/gg463041.aspx
???
It would be nice if you could clarify... especially, what's different to VC6? From my understanding, the CDB interface should be the same for debugging VC6 or any other VC version files, isn't it?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 11, 2012, 10:09:38 am
Visual C++ 6 support
BTW, it has been some time I was using VS and the CDB debugger. It seems its now integrated in the Windows platform SDK but one can extract it easily from there. What version(s) are you using for your trials? One of these:
http://msdn.microsoft.com/en-us/windows/hardware/gg463041.aspx
???
It would be nice if you could clarify... especially, what's different to VC6? From my understanding, the CDB interface should be the same for debugging VC6 or any other VC version files, isn't it?

I am using CDB from different sources. I have one from the MSDN link above and one from the current WinDDK.
Generally, CDB handels all VC version the same way. I can use a 32 Bit CDB to debug every 32 Bit application build with a VC compiler and i can use the 64 Bit CDB to debug 32 and 64 bit applications. The difference between 32 and 64 Bit is the debugger prompt. The 64 Bit Debugger tells me at the prompt that my debuggee runs under the x86 environment.

The difference between the old VC6 compiler and never versions is the symbol table of the debuggee. The VS2010 compiler for example seems to use only absolute pathnames for the symbols (c:\project\test\main.c), the vc6 compiler uses relative paths (main.c) also and so the Debugger tells me different informations about source positions on a breakpoint hit.

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 11, 2012, 11:29:58 am
also and so the Debugger tells me different informations about source positions on a breakpoint hit.
Too bad. Well think about how much time you invest in supporting this aged compiler than... it may not be worth it. I see more and more projects dropping support for this compiler already.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 11, 2012, 02:11:24 pm
OK,

one question to the debugger professionals:

Wich sense makes the function ShiftBreakpoint?
When the debuggee runs and there are breakpoints set, then an open editor windows calls this function for all breakpoints affected by a sourceline change (insert or delete lines). So it should move breakpoints to the new position. When i handle this function, the breakpoints view and the marker in the editor are moving too. Very nice. But the source ist out of sync with the symbol table of the debuggee. It makes no sense to send the new breakpoint position to the debugger (as the old Debugger_GDB does). And when i remember this changes internally in the breakpoint list, then i'm able to correct positions on debugger stops while hitting breakpoints. But i can't correct any position when the sourcecode changes while debugging without an breakpoint set, so this makes no sense to me. Any Ideas?

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 11, 2012, 05:48:35 pm
Any Ideas?
Hopefully oBFusCATed can say something more detailed about this, but weren't there just with the last commits some changes accordingly to fix a  (similar/same) wrong behaviour accordingly? Are your sources in sync with trunk?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 11, 2012, 08:39:26 pm
Any Ideas?
Hopefully oBFusCATed can say something more detailed about this, but weren't there just with the last commits some changes accordingly to fix a  (similar/same) wrong behaviour accordingly? Are your sources in sync with trunk?

yes, my sources are compiling fine to the trunk.

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 11, 2012, 09:18:19 pm
ShiftBreakpoint function should re-set the breakpoint only if the compiler supports edit-and-continue, but c::b currently doesn't support edit-and-continue.
I'm not sure what is the best action we could take. The options are:
1. Mark the breakpoint as invalid (should provide some api for it)
2. Don't move the breakpoints and tell the editor that the must stay at the same line as before the edit operation, thus the breakpoint and the source will diverge.
3. Anything else...
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 11, 2012, 11:04:48 pm
OK,

i do what M$ does, what the best solution is - maybe. Warn the user about the changes, update the editor marks and let the debugger run into the wrong breakpoint position.

Martin

BTW: I like to have the possibility to load a source file into the editor, which is not known to the project. Why? For example, i have installed wxWidgets from wxPack. my path for the installation is c:\codeblocks\wxWidgets2.8.12. When i debug an application and break (or step) into the wxWidgets library, than CDB gives me symbols for the original path where the library was build from by someone who builds wxPack. My project has never build the library and my paths are not the same a those be used from the wxPack team. So i like to open source files like the WinDbg debugger will open it, or i like to let the user define some type of replace-mask, so that he (or i :-) can step into the library source (or any other source) without having them to be in the same path as the library creator. Any suggestions on this? SyncEditor calls always the project file functions.

thanks Martin

Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 11, 2012, 11:53:15 pm
SyncEditor calls always the project file functions.
As far as I can see it should work if you pass the correct path to the file on your system. Have you tried it?
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 12, 2012, 12:26:20 am
SyncEditor calls always the project file functions.
As far as I can see it should work if you pass the correct path to the file on your system. Have you tried it?

no, i have not tried it, i have had only a look at the source code - too many construction sites...
I will try it next week, because i am on a short vacation this weekend (vienna).

Martin
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 19, 2012, 06:28:15 pm
The next, rev 10:

- in sync with Code::Blocks rev8462
- added Windows Version resource
- show backtrace/callstack with function arguments
- disassembly for code without source
- better handling of disassemble view updates (still not completed but not bad)
- additional debugger commandline args in the configuration
- some cosmetic changes

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 19, 2012, 08:50:24 pm
The next, rev 10:
- [...long list...]
Sounds pretty amazing. Maybe after all that time I should give CDB another try...
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 19, 2012, 10:28:57 pm
just try it. I think that it already runs better as the current plugin, but this is only my meaning currently. Every found problem is one problem less. And the visual c++ compiler is much faster on windows as gcc.
When this plugin works - and the gdb/MI plugin also - than you can switch completely to the "new" debugger plugin api.

Martin

Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 19, 2012, 11:50:09 pm
I don't understand your last comment, as we have already switched to the new debugger plugin api.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 20, 2012, 09:46:23 am
I don't understand your last comment, as we have already switched to the new debugger plugin api.

Sorry, my english is not the best. The current debuggers depend on each other so much, that i couldn't remove one of them.

Martin
Title: Re: someone working on CDB debugger?
Post by: MortenMacFly on October 20, 2012, 12:32:48 pm
I don't understand your last comment, as we have already switched to the new debugger plugin api.
I think he means the GDB/MI plugin... which I would indeed like to switch to when you say its ready. :-)
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 22, 2012, 06:41:19 pm
rev 11:

- fixed an error with the destruction of tooltip watches
- fixed a race condition on closing code::blocks while staying in the debugger
- added "set next statement" function
- added the ability to map symbol paths to local source paths
- added "start step into"

Martin
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 24, 2012, 02:04:17 pm
Hi,

I have seen that the DisassemblyDialog is very slow. Adding 4800 assembler lines take 10 seconds (4800 lines is 250 c++ lines generated from wxSmith). Any change to speed it up a little bit?

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on October 24, 2012, 02:45:59 pm
Patches welcome:)
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 24, 2012, 03:01:10 pm
Patches welcome:)

:-)

OK, it goes into my list.

Martin
Title: Re: someone working on CDB debugger?
Post by: Martin K. on October 24, 2012, 06:08:47 pm
rev 13:
- run to cursor works (on running and stopped debugger)
- a little profile to measure the performance of the debugger plugin

have fun
Martin
Title: Re: someone working on CDB debugger?
Post by: Bat on December 23, 2012, 11:15:36 am
Good work !
I've compiled and installed it. It's even as good as current plugin in CodeBlock trunks.
I will try to add some missing things in my use.

For information, I use it with C compiler LCC-Win32. (it's enhanced C, so there is some common C++ feature include in it)
This compiler produce CodeView debugging symbol, that seem not well understood by CDB. So I use an open source tool cv2pdb http://dsource.org/projects/cv2pdb (http://dsource.org/projects/cv2pdb) to do conversion. So missing can come from cv2pdb or cdb plugin ...

So, question :

with :
struct bob{
  char str[200];
};

struct bob a_bob;
strcpy(a_bob,"data");

what look like :
a_bob.str
here I have only first char str 'd'
Title: Re: someone working on CDB debugger?
Post by: Martin K. on December 23, 2012, 12:48:38 pm
Good work !
I've compiled and installed it. It's even as good as current plugin in CodeBlock trunks.
I will try to add some missing things in my use.

For information, I use it with C compiler LCC-Win32. (it's enhanced C, so there is some common C++ feature include in it)
This compiler produce CodeView debugging symbol, that seem not well understood by CDB. So I use an open source tool cv2pdb http://dsource.org/projects/cv2pdb (http://dsource.org/projects/cv2pdb) to do conversion. So missing can come from cv2pdb or cdb plugin ...

So, question :

with :
struct bob{
  char str[200];
};

struct bob a_bob;
strcpy(a_bob,"data");

what look like :
a_bob.str
here I have only first char str 'd'


Thank you, the first response to my plugin :-)

It is not complete now, but i think that it offers more functionality as the "trunk" Plugin.
Feel free to enhance whatever you like and send me patches for it.

Martin
Title: Re: someone working on CDB debugger?
Post by: Bat on December 29, 2012, 06:12:43 pm
Here a patch to add "Breakpoint at main entry"

Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on December 29, 2012, 06:32:54 pm
Here a patch to add "Breakpoint at main entry"
Isn't this the same as using the step-into command instead of debug->start?
Title: Re: someone working on CDB debugger?
Post by: Bat on December 29, 2012, 06:44:08 pm
Here a patch to add "Breakpoint at main entry"
Isn't this the same as using the step-into command instead of debug->start?
Not really the same. In fact 4 cases :

-Hit run, with no bp at start : program run fully
-Hit step-into, with no bp at start : program stop just after loading (so long before main() or WinMain(), before initializing DLL and so on)
-Hit run, with bp at start : program stop at WinMain
-Hit step-into, with bp at start : program stop just after loading and if we run, it stop at main() WinMain() too ...

In case, Step-into+Bp we can change beahviour not to place main() bp ...

Patch include a configuration checkbox to activate (or not) Breakpoint at start
Title: Re: someone working on CDB debugger?
Post by: Martin K. on December 29, 2012, 07:17:29 pm
Here a patch to add "Breakpoint at main entry"
Isn't this the same as using the step-into command instead of debug->start?
Not really the same. In fact 4 cases :

-Hit run, with no bp at start : program run fully
-Hit step-into, with no bp at start : program stop just after loading (so long before main() or WinMain(), before initializing DLL and so on)
-Hit run, with bp at start : program stop at WinMain
-Hit step-into, with bp at start : program stop just after loading and if we run, it stop at main() WinMain() too ...

In case, Step-into+Bp we can change beahviour not to place main() bp ...

Patch include a configuration checkbox to activate (or not) Breakpoint at start


Hi,

Makes sense after the first look, are there some other comments on this?

Martin
Title: Re: someone working on CDB debugger?
Post by: oBFusCATed on December 29, 2012, 07:24:52 pm
-Hit step-into, with no bp at start : program stop just after loading (so long before main() or WinMain(), before initializing DLL and so on)
If you ask me, I'd make it to stop at main and I'll add an option to make it possible to stop just after load.
GDB does just this currently and in fact there is no option.
Title: Re: someone working on CDB debugger?
Post by: Martin K. on December 29, 2012, 09:20:42 pm
-Hit step-into, with no bp at start : program stop just after loading (so long before main() or WinMain(), before initializing DLL and so on)
If you ask me, I'd make it to stop at main and I'll add an option to make it possible to stop just after load.
GDB does just this currently and in fact there is no option.

You mean:

1.) Run runs the program under debugger control with user breakpoints set - like currently and "step into" sets a temporary breakpoint at main, Winmain, _main or whatever is found by the debugger?
2.) make an option to stop the debuggee after it is loaded - before main.

right?

I haven't implemented it so far, because i haven't checked whats happen when my project is a shared library und another program (which uses this library) will be started as debuggee. There are two other points i'm aware of with CDB and executable breakpoints: CDB64 is able to debug 32 and 64 bit programs, but it sets another breakpoint while starting the 32bit runtime environment (WoW64), the debugger should go over it (maybe should an option also, or depending on the option "stop after loading"), the second is the ability of the MSVC Compiler to generate incremental link tables. When i set a breakpoint on a function entry while this feature is on, the debuggee will break at the link table entry and the user has to step one time to reach the requested breakpoint position. Maybe also an option for the user...

Martin
Title: Re: someone working on CDB debugger?
Post by: Bat on December 30, 2012, 11:44:48 am
You mean:

1.) Run runs the program under debugger control with user breakpoints set - like currently and "step into" sets a temporary breakpoint at main, Winmain, _main or whatever is found by the debugger?
2.) make an option to stop the debuggee after it is loaded - before main.

right?

For me it's a good base.

With DLL 2 or 3 possibility in fact :
-stop at main() of host program
-stop at DllEntry() of DLL (here EntryPoint name should be recovered)
-stop at both

Stopping at DllEntry is good option ?

And if we keep option "stop debuggee after loading", all other possibility can do manually

For 32/64 bit I haven't do enought 64 bits debugging. If debugger add itself some breakpoint they can be bypassed manually in first time ...

If it's ok I will do modification
Title: Re: someone working on CDB debugger?
Post by: Bat on January 06, 2013, 09:32:13 pm
So, I've make modification of previous post and enhanced watch variable/watch tooltips.
Here a list :
-modification of option added 'break at program entry'
-watchs improved
  -convert CDB type to C/C++
  -handle recurse subitem (struct, array) dynamically when user expand watch
  -handle string
  -update of all watch and subwatch when needed (seem to have some case where update is not ok)
  -handle of structure, structure pointer and cast ((MYSTRUCT*)prj->j where prj is a void * is ok)
  -handle of local variable
  -handle of function pointer, with recover of textual function name
-combination of TooltipWatch and Watch. They give now identical result, but some enhancement to make (Tooltips don't generate ExpandWatch ?)
-correction of RegExp for stack frame where function have parameter with array
 
Title: Re: someone working on CDB debugger?
Post by: Martin K. on January 06, 2013, 09:39:21 pm
So, I've make modification of previous post and enhanced watch variable/watch tooltips.
Here a list :
-modification of option added 'break at program entry'
-watchs improved
  -convert CDB type to C/C++
  -handle recurse subitem (struct, array) dynamically when user expand watch
  -handle string
  -update of all watch and subwatch when needed (seem to have some case where update is not ok)
  -handle of structure, structure pointer and cast ((MYSTRUCT*)prj->j where prj is a void * is ok)
  -handle of local variable
  -handle of function pointer, with recover of textual function name
-combination of TooltipWatch and Watch. They give now identical result, but some enhancement to make (Tooltips don't generate ExpandWatch ?)
-correction of RegExp for stack frame where function have parameter with array
 

sounds very good, thank you! I will have a look on it in the next days.

committed after a short test.

Martin
Title: Re: someone working on CDB debugger?
Post by: geoffzou on May 14, 2013, 05:12:03 am
So, I've make modification of previous post and enhanced watch variable/watch tooltips.
Here a list :
-modification of option added 'break at program entry'
-watchs improved
  -convert CDB type to C/C++
  -handle recurse subitem (struct, array) dynamically when user expand watch
  -handle string
  -update of all watch and subwatch when needed (seem to have some case where update is not ok)
  -handle of structure, structure pointer and cast ((MYSTRUCT*)prj->j where prj is a void * is ok)
  -handle of local variable
  -handle of function pointer, with recover of textual function name
-combination of TooltipWatch and Watch. They give now identical result, but some enhancement to make (Tooltips don't generate ExpandWatch ?)
-correction of RegExp for stack frame where function have parameter with array
 

sounds very good, thank you! I will have a look on it in the next days.

committed after a short test.

Martin

What is the status of this awsome development? Has Bat's patch been integrated to svn (rev.17) yet? Thanks!
Title: Re: someone working on CDB debugger?
Post by: Bat on November 01, 2014, 12:28:42 am
This topic is quite rather old, but here is a crude patch for actual update of this plugin
It's not clean, debug trace are still activated and so on.
It correct some few things on this plugin (small name variables, array, ...)

If there is an interest in it I can clean it