UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2011-10-30 09:39 AM

useless79
Member
Registered: 2011-10-10
Posts: 30

info register in gdb

Hi,

Can any body help me in interpretating following output of info reg from gdb.
What are these pointers and first and second columns addresses.
How can I process from here ?


(gdb) info reg
eax            0x0    0
ecx            0x0    0
edx            0xfffffff4    -12
ebx            0x8e98f68    149524328
esp            0xf0828630    0xf0828630
ebp            0xf0828768    0xf0828768
esi            0x1    1
edi            0xf08293b4    -259877964
eip            0x812d529    0x812d529
eflags         0x10202    66050
cs             0x23    35
ss             0x2b    43
ds             0x2b    43
es             0x2b    43
fs             0x0    0
gs             0x63    99
(gdb)



Thanks....

Offline

#2 2011-10-31 12:07 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: info register in gdb

The first column is the register name, the second column is its value in hexadecimals
and the last column is its value in decimals.

I'm not sure what you're trying to do, but usually you get more useful information
with the "disassemble" gdb command, as that shows which instructions are executed.
If the binary is compiled with debugging info then you get a lot more information and
backtraces are helpful too then, especially "bt full", as that gives a lot of extra info.

EIP is the instruction pointer, EAX is both the first argument of a function as well as
the return value (though it depends on which calling convention is used), but of course
the registers can be used for other things too. You can't tell what's going on by looking
at the register values, for that you need to look at the instructions. "info reg" is useful
when you want to look up the value of a register that is used by some instruction.

Offline

#3 2011-10-31 06:52 PM

useless79
Member
Registered: 2011-10-10
Posts: 30

Re: info register in gdb

Hi  i3839,


My intention is how to know what was the reason of crash in case stack frame
is completely corrupt.

Thanks....

Offline

#4 2011-11-01 02:08 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: info register in gdb

Then looking at registers won't help very much, as the instructions causing
the corruptions are quite old and the ones causing the crash are innocent
ones choking on the result.

Compile with debugging info and run your program through Valgrind,
it's slow, but it usually finds out where it goes wrong.

Offline

Board footer

Powered by FluxBB