Reputation: 925
I was wondering if it's possible to display the current source line in windbg?
Right now I am able to step through the code and display 5 lines before and after the current line every time I step through the code. This is great, but it would be nice if there was a command to print the current source line on demand instead of having to step to the next line.
Upvotes: 0
Views: 620
Reputation: 9007
if you want to print a single source line use lsp
The default value is 20 (0x14)
> lsp -a 1
WARNING: Source line display is disabled
At the prompt, display 0 source lines before and 1 after
For lsa commands, display 0 source lines before
For ls and lsa commands, display 1 source lines
now use lsa where .denotes the current Eip/Rip
0:000:x86> lsa .
> 28: void main(int argc, char *argv[]) {
or provide an address
0:000:x86> lsa @$ip+42
> 30: SymInitialize(hProcess, NULL, FALSE);
you can also provide the source line to lsa
0:000> lsa `symtype!symtype.cpp:16`
> 16: if (maxcmplen == pSymInfo->NameLen) {
0:000> lsa `symtype!symtype.cpp:28`
> 28: void main(int argc, char *argv[]) {
Upvotes: 1