The 2024 Wheel Reinvention Jam just concluded. See the results.

Improvements to CDbg

Nikita Smith
Hello everyone! Today I upload a new version of CDbg with some improvements and bug fixes.
Changes:
- File reloading
- Window to set function breakpoints (CTRL+B)
- Hot code reloading works
- Improved breakpoint system

Here is a video where I demo these changes:
www.youtube.com/watch?v=jFAqEPQebDw&feature=youtu.be

Download link - here

Comments

New version! Awesome!
Now, whenever my program hits an exception (or rather my assert have been triggered) I obviously can't step further in the program, but CDbg also refuses to stop debugging it seems.
I was going to fix that bug, but I completely forgot about it. Thanks for reminding me, I'll fix it as soon as I can.
I don't know how much feedback you want at this point in the project, I played with it for a few minutes and here are some "problems" and random thoughts.

- I don't know about the whole reloading source file while debugging thing. I think that until you stop debugging the source should not be reloaded to allow to continue debugging even if you modified the source. I sometimes add notes or todos in the source (from outside the debugger) while debugging but still want to continue debugging.

- While stepping in a program I got this error: screenshot. I pressed "step into" instead of "step over".
- While scrolling a file, I got this assert: screenshot.
- When I stop debugging, the pdb file seems to stay locked (the compiler can't overwrite the file).
- Using "Break process" doesn't break.
- Ctrl + B to set a breakpoint: after typing the name, it tells me the function name is invalid on some functions. E.g. createScreenSpaceMat works, but gl_clear doesn't (both are defined in the same file and I can step into them with "step into" ).
- The Ctrl + B window is pasting what is in the clip board whenever I press 'v'.
- I would prefer the Add breakpoint window to be some sort of mini buffer that doesn't cover other part of the screen.
- It would be great to have list of the key bindings in a readme (you may even open it up in a tab to have an easy access).
- What is the hot key for the "selective step into" ?
- Why are watch list items always two lines ?
- I can't edit the expression in the watch list, it always put back the first one I typed.
- The watch list seems to have trouble reading some keys, I have to type '[' twice if it comes after a letter. I'm using an azerty keyboard layout (fr-be).
- Keyboard controls to move in the file, set breakpoint, go to the different panel would be great. It took me some time to figure out that to set a breakpoint I had to use the mouse and click in the margin.
- A way to disable the "Save this project" prompt would be great.
I have to agree with mrmixer about the source reloading while still debugging, I would rather have it wait till I stop debugging
Thank you for your feedback mrmixer. I'll try to fix everything you mentioned in the next release.
I got this: https://imgur.com/a/Q83js

This assertion means that there is a pdb/exe mismatch. Is this your case?
TastyMuffin

This assertion means that there is a pdb/exe mismatch. Is this your case?


So, I am pretty sure the pdb and exe match, the timestamp is the same, and they are in the same directory, I did a rebuild and it still had the same error. I was thinking that it might have something to do with the fact that I was trying to run it from a network location, so I copied it to the C: drive, and then tried it again (basically copied absolute paths into a CMD prompt, and it complained about invalid command line argument, not matching *.exe or ... even though it was...

I ended up copying all of the files (including cdbg) into a single folder local to the machine, and used relative paths from the command line, in the same directory as the files, and that seemed to work better.

Now I'm getting an assert !"fail" in render.c line 318

Its running in VMWare if that helps, although, I've done plenty of OpenGL in VMWare and it hasn't been an issue...
I've tested debugger in Virtual Box and it was working. This is assert is related to glLinkProgram, apparently it failed. Could you please compile these shaders and tell me if you get same error.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
static char *vert_shader = 
{
    "void main() {\n"
    "gl_FrontColor = gl_Color;\n"
    "gl_Position = ftransform();"
    "}\n"
};
        
static char *frag_shader = 
{
    "void main(){\n"            
    "int check_x = int(gl_FragCoord.x);\n"
    "if (mod(int(gl_FragCoord.y), 2) == 0) check_x += 1;\n"
    "if (mod(check_x, 2) == 0) { discard; }\n"
    "else { gl_FragColor = gl_Color; } }"
};


About the path related problem, I'll try to make a smarter path checking in the next build.

Also could you write a sample of network path that you passed to debugger?
This is my test program: http://dpaste.com/3QFERF7
I haven't used shaders yet, so you might want to double check that I'm doing the right thing here...

I am actually getting a GL_INVALID_OPERATION error after the call to glUseProgram(program);
The glLinkProgram(program); seems to run without error...

I checked the OpenGL version in VMWare and it looks like its version 2.1 Mesa 10 on Gallium 0.4 SVGA3D

the 1449 assertion happens when I call it like this:

C:\Users\Administrator>"C:\New folder\cdbg.exe" Z:\Documents\PersonalProjects\Misc\build\cdbg_test.exe

Z: is a mapped network drive
I do not knot if someone reported this bug (I made a fast read), but in my case the Data Inspetection is extremely slow for input. I need in the best case 30s to write the variable name. Also, his happening that if I want to step into a function that is in another file I can't, is doing a step over.