Quote:
Originally Posted by jackandking
how can i get the addr following "saved eip" and "Arglist at" from the output of "info f" in gdb?
Code:
(gdb) info f
Stack level 9, frame at 0xbfffcc78:
eip = 0x42d5310e in EvalAll (epeval.c:218); saved eip 0x42d53c3a
called by frame at 0xbfffccb8, caller of frame at 0xbfffcc38
source language c.
Arglist at 0xbfffcc78, args: r=0x894a488, sArg=0x89f6e83 " $$searchdata{starfirst} ", flags=0, sName=0x89ffe28 "$衆224\b\001",
pRet=0xbfffcca8
Locals at 0xbfffcc78, Previous frame's sp is 0x0
Saved registers:
ebx at 0xbfffcc6c, ebp at 0xbfffcc78, esi at 0xbfffcc70, edi at 0xbfffcc74, eip at 0xbfffcc7c
I wanna use the two addr in my gdb script.
|
You can redirect output to the file, then process file with any external program (invoked by the gdb's shell call), write output in the form of
$name1 = value1
$name2 = value2
to the file, source this file to gdb and use those variables.
Tricky and ugly but doable.
You can have a look for something resembling here:
http://statifier.sf.net
Statifier is a program that convert dynamically linked executable to pseudo-static.
It uses gdb to dump process memory and registers to the files as part of statifying process
Files src/gdb_runner.gdb and src/statifier.gdb are examples of such tricks.
PLease notes, that those files are preprocessed with sed before be used, but anyway you should get idea.
EDIT: Statifier don't use gdb any more, but files mentioned above still can be found in the release < 1.7.0 or in SVN - tag 1.6.15