user478571
user478571

Reputation:

debugging assembly code under gdb | platform linux

I am new to debugging an assembly code under gdb.Therefore, I have some question;

I know some of you will say "go and read gdb tutorial or man page".But, I could not find any good tutorials, with example to explain how a command works. My brain only works when my eyes see example :)

Platform is Linux Tool is terminal/console

EDIT : Please give me a good website including good documentation, of course If you know

Give me documentation of "how to [catch] fish", "not how to eat fish"

Upvotes: 2

Views: 1306

Answers (2)

ninjalj
ninjalj

Reputation: 43748

How can I run my assembly code without actually running it ?

Umm, err, what?!

If it needs a value, how can I insert a value to see how it works for each case in switch statement?

set whatever = some expression

Remember that registers have a $ sigil (e.g: $eax).

If I need, how can I know what value is stored in a register ?

For all registers:

info reg

For a specific register

info reg $eax

or

p $eax

or

p/x $eax

etc...

How can I print out all display to my .txt file ? In other words, assume I have started my program and it runs with no break point and then I want print this display to .txt file. So, I can work on paper. As You know, paper is more powerful than computer :)

set logging file foobar.out
set logging on

Upvotes: 1

ott--
ott--

Reputation: 5722

Look at this page: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka12961.html - it's for ARM assembler, most should fit for all assemblers. You can set the program counter to the desired instruction, put values into registers, view registers, view memory etc. Don't print it out, we're out of trees almost already.

Upvotes: 1

Related Questions