8

is it possible to configure gdb in order to debug assembly code when there are no debug symbols or no sources available ? I mean showing assembly instruction by assembly instruction when performing a step by step debug (next /step commands) (not desassembling all the function. just the next instruction that will be executed)

Regards, Ayman

3
  • I'm sure this is possible. Xcode does it by default and it uses gdb. Not sure how to configure plain ol' gdb to do it though. Commented Nov 24, 2009 at 15:28
  • 1
    possible duplicate of How to disassemble the main function of a stripped application? Commented Jan 19, 2012 at 11:45
  • GDB's TUI mode has layout reg which is pretty decent, but it won't let you scroll backwards when you don't have symbols, only forward. (At least on x86 where variable-length instructions mean you can't unambiguously decode backwards.) Commented May 13, 2020 at 14:15

2 Answers 2

4
set disassemble-next-line auto

Is what I find most useful. You can also set it to "on" to disassemble even if source is available.

See the "Source and Machine Code" section in the documentation.

Sign up to request clarification or add additional context in comments.

Comments

4

Yes. Use display/ni $pc to disassemble the next n instructions.

Also, download the GDB manual.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.