Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Fwd: Decompiler program
       [not found] ` <1a47b9f10709061417t6a8778bboe741ecbe31c2b0eb@mail.gmail.com>
@ 2007-09-06 21:33   ` Prasanna .S
  2007-09-06 21:48     ` Joel Brobecker
       [not found]     ` <46E0732F.7060309@adacore.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Prasanna .S @ 2007-09-06 21:33 UTC (permalink / raw)
  To: gdb

Hi,

I am a student in India. I am not very experienced with gdb's
internals but have used it before.
Broadly i am interested in writing a decompiler
(given a binary, create some readable HLL code), that let's you trace
through code.

I've used gdb to step through binaries without debug info, but as far
as i've known (or tried),
it has a limitation that it cant step out of a proc that it doesnt
have src (or debug info to).
So i cant step into libraries (am i correct?)

So all i want to know is a broad idea about the complexity involved in
writing a decompiler using
some of gcc's C libs, that can parse the ELF binary (i think i've seen
a lib for this parsing part in gcc)
and generate dis-assembly that can be traced freely. (Ofcourse the ELF
binary has to assumed to
contain no debug info).

Thanks a lot for sparing your time,
-Prasanna


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: Decompiler program
  2007-09-06 21:33   ` Fwd: Decompiler program Prasanna .S
@ 2007-09-06 21:48     ` Joel Brobecker
       [not found]     ` <46E0732F.7060309@adacore.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2007-09-06 21:48 UTC (permalink / raw)
  To: Prasanna .S; +Cc: gdb

> I've used gdb to step through binaries without debug info, but as far
> as i've known (or tried),
> it has a limitation that it cant step out of a proc that it doesnt
> have src (or debug info to).

If I understand you correctly ("step out" refering to the "finish"
command), then this is actually not true: GDB does not need debugging
info in order to do a finish.

> So i cant step into libraries (am i correct?)

Next/step operations are only relevant when you are in a location
where line number information is available. So in order to step
into a shared library, you'll need to step at the instruction level:
stepi, nexti.

> So all i want to know is a broad idea about the complexity involved in
> writing a decompiler using some of gcc's C libs, that can parse the
> ELF binary (i think i've seen a lib for this parsing part in gcc) and
> generate dis-assembly that can be traced freely. (Ofcourse the ELF
> binary has to assumed to contain no debug info).

You mean a disassembler? Have you looked at objdump --disassemble?

-- 
Joel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: Decompiler program
       [not found]     ` <46E0732F.7060309@adacore.com>
@ 2007-09-07 13:53       ` Prasanna .S
  2007-09-10 15:49         ` Robert Norton
  0 siblings, 1 reply; 4+ messages in thread
From: Prasanna .S @ 2007-09-07 13:53 UTC (permalink / raw)
  To: gdb

Hi ppl,

First of all I must apologise for the ambiguities due to my inexperience.
As far as i've known objdump emits assembly of an executable.
I want it to be tracable in an assembly level.
More precisely can you trace through instruction by instruction
emitted by objdump,
by a objdump/gdb lib combination?

If possible, do tell which libs to link and use, so that i write a
standalone program
that can perform the tasks (by just sharing the gdb libs with no
runtime interaction).
Is it even possible (now) ?

Thank you all so much for replying!

-Prasanna


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Fwd: Decompiler program
  2007-09-07 13:53       ` Prasanna .S
@ 2007-09-10 15:49         ` Robert Norton
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Norton @ 2007-09-10 15:49 UTC (permalink / raw)
  To: Prasanna .S, gdb

> -----Original Message-----
> From: gdb-owner@sourceware.org 
> [mailto:gdb-owner@sourceware.org] On Behalf Of Prasanna .S
> Sent: 07 September 2007 14:37
> To: gdb@sourceware.org
> Subject: Re: Fwd: Decompiler program
> More precisely can you trace through instruction by instruction
> emitted by objdump,
> by a objdump/gdb lib combination?

Have you tried the 'disassemble' (also x/i <address>) command in gdb? It
provides disassembly of the current function or of a given range of
addresses. Perhaps this, combined with the nexti / stepi commands, will
allow you to trace execution at assembly level? Turning this into HLL
code using decompilation techniques (via a 'decompile' command) would be
an interesting feature.

My apologies if I have misundertsood what you are asking for.

Robert


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-10  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1a47b9f10709061414m3344094m1f9da016cf1f765c@mail.gmail.com>
     [not found] ` <1a47b9f10709061417t6a8778bboe741ecbe31c2b0eb@mail.gmail.com>
2007-09-06 21:33   ` Fwd: Decompiler program Prasanna .S
2007-09-06 21:48     ` Joel Brobecker
     [not found]     ` <46E0732F.7060309@adacore.com>
2007-09-07 13:53       ` Prasanna .S
2007-09-10 15:49         ` Robert Norton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox