CDB command for setting a breakpoint based on a li

2020-07-28 10:38发布

问题:

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.

回答1:

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`;