Search code examples
debuggingwindbgd

CDB command for setting a breakpoint based on a line number


Is there a set of CDB commands for setting a breakpoint based on a line number?

It seems that there is no "direct" one. Actually it seems that CDB knowledge is falling into a black hole and it's getting harder and harder to find resources on the Internet.

My CDB setup

cdb -c "l+*;.lines"

and later I add the source

lsf mySource.d

Currently I put hard-coded breakpoints with a mixin

enum brk = "debug{asm{int 3;}}";
// code
mixin(brk);

But it's not a viable solution.


Solution

  • The syntax to break in source line mode, is well explained here or here, e.g:

    bp `mod!source.c:12`;

    And to stop on a particular line:

    g `:20`;