0

why bp main failed? how to list source code as gdb's list command does?

this question is not the same as CDB command for setting a breakpoint based on a line number

seems cdb can be used with windbg, but is that possible to use cdb a bit similar to gdb?

Community
  • 1
  • 1
hugemeow
  • 7,777
  • 13
  • 50
  • 63
  • 2
    I would check out the **documentation**. If there is no suitable documentation I would stop using the tool. – Cheers and hth. - Alf May 03 '15 at 10:29
  • 2
    There is a practical limit to what it can do beyond using `******* asterisks *******` to tell you about the problem and the solution. It isn't going to jump off the screen and slap you in the face :) Use the debugger built into Visual Studio and a project template to start your project to fall in the pit of success. – Hans Passant May 03 '15 at 11:47
  • Please don't post pictures, post the text instead. This makes it easier for others to find the question and a potential answer. And that's what makes Stack Overflow useful. – Thomas Weller May 03 '15 at 20:50
  • 3
    Possible duplicate of [How to set up symbols in WinDbg](http://stackoverflow.com/questions/30019889/how-to-set-up-symbols-in-windbg) – Thomas Weller May 03 '15 at 22:01

1 Answers1

1

cdb allows 3 different commands to set breakpoints: bp, bm, and bu

  1. bp accepts arguments that are numeric addresses
  2. bm accepts arguments that are textual symbols in a module that is already loaded
  3. bu accepts arguments that are textual symbols in modules that may or may not be loaded yet.

To Set a breakpoint at main we can guess Image00390000 is actually hello.exe (Sometimes cdb fails to recover the name you would expect). You can use the command:

bm Image00390000!main

This assumes that main really is the symbol name, and that symbols are loaded. You can use:

lmvm Image00390000 //to check if symbols are loaded
x Image00390000!*main* //lists all symbols that have main anywhere in the name
Noah Falk
  • 41
  • 2