Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* trying to use gdb to disassemble a binary file
@ 2007-08-06 18:46 Fahd Abidi
  2007-08-06 18:56 ` Dave Korn
  0 siblings, 1 reply; 6+ messages in thread
From: Fahd Abidi @ 2007-08-06 18:46 UTC (permalink / raw)
  To: gdb

Hello,

I am trying to use GDB to disassemble a binary file. I have no problems
when gdb connects to a target board (running a PC440) and viewing the
disassembly via the display command, (gdb)x /10i$0xfffff000. But GDB
does will not recognize or open a binary file format. It might not be
the right tool to use, I really just want to open a binary file in gdb
and view the disassembly. Is that possible?

Fahd
 


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

* RE: trying to use gdb to disassemble a binary file
  2007-08-06 18:46 trying to use gdb to disassemble a binary file Fahd Abidi
@ 2007-08-06 18:56 ` Dave Korn
  2007-08-06 19:16   ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Korn @ 2007-08-06 18:56 UTC (permalink / raw)
  To: 'Fahd Abidi', gdb

On 06 August 2007 19:45, Fahd Abidi wrote:

> Hello,
> 
> I am trying to use GDB to disassemble a binary file. I have no problems
> when gdb connects to a target board (running a PC440) and viewing the
> disassembly via the display command, (gdb)x /10i$0xfffff000. But GDB
> does will not recognize or open a binary file format. It might not be
> the right tool to use, I really just want to open a binary file in gdb
> and view the disassembly. Is that possible?

  Not easily, although it would work if you could get the file's contents
loaded into memory.

  Probably your best bet is to use "objdump -D --target=binary
--architecture=<your arch> filename"


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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

* Re: trying to use gdb to disassemble a binary file
  2007-08-06 18:56 ` Dave Korn
@ 2007-08-06 19:16   ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-06 19:16 UTC (permalink / raw)
  To: Dave Korn; +Cc: 'Fahd Abidi', gdb

On Mon, Aug 06, 2007 at 07:56:32PM +0100, Dave Korn wrote:
> On 06 August 2007 19:45, Fahd Abidi wrote:
> 
> > Hello,
> > 
> > I am trying to use GDB to disassemble a binary file. I have no problems
> > when gdb connects to a target board (running a PC440) and viewing the
> > disassembly via the display command, (gdb)x /10i$0xfffff000. But GDB
> > does will not recognize or open a binary file format. It might not be
> > the right tool to use, I really just want to open a binary file in gdb
> > and view the disassembly. Is that possible?
> 
>   Not easily, although it would work if you could get the file's contents
> loaded into memory.
> 
>   Probably your best bet is to use "objdump -D --target=binary
> --architecture=<your arch> filename"

Alternatively, use objcopy to convert the file into an ELF image.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: trying to use gdb to disassemble a binary file
@ 2007-08-08 13:10 Robert Bu
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Bu @ 2007-08-08 13:10 UTC (permalink / raw)
  To: dave.korn; +Cc: gdb

That's it.

Thanks!

Dave Korn 写道:
> On 08 August 2007 10:07, Robert Bu wrote:
>
>> I can get the architecture information on my MIPS by
>> "mips-elf-objcopy -I binary -O elf32-bigmips -B mips test.bin test.elf"
>>
>> However, is that possible to designate the entrypoint(start address) for
>> the ELF file? The default seems to be 0x0.
>
>   The man page suggests there is a "--set-start" option that sounds like it
> should do what you want; have you tried it?
>
>
>     cheers,
>       DaveK


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

* Re: trying to use gdb to disassemble a binary file
@ 2007-08-08  9:06 Robert Bu
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Bu @ 2007-08-08  9:06 UTC (permalink / raw)
  To: gdb

I can get the architecture information on my MIPS by
"mips-elf-objcopy -I binary -O elf32-bigmips -B mips test.bin test.elf"

However, is that possible to designate the entrypoint(start address) for
the ELF file? The default seems to be 0x0.

> ------------------------------------------------------------------------
>
> 主题:
> RE: trying to use gdb to disassemble a binary file
> 发件人:
> "Fahd Abidi" <fabidi@ultsol.com>
> 日期:
> Mon, 06 Aug 2007 17:00:07 -0400
> 收件人:
> <gdb@sourceware.org>
>
> 收件人:
> <gdb@sourceware.org>
>
>
> Thanks to the both of you. The objdump command worked.
>
> I tried the objcopy before I emailed and converted the binary file to an
> ELF format but for some reason the architecture would not get written to
> the created elf file:
>
> PPC_440-bojcopy -I binary -O elf32-powerpc -B powerpc file file.elf
>
> trying to do an "objdump -f" showed that there was no architecture
> information copied over. Trying to disassemble this resulted in an error
> saying the architecture was unknown. Probably this was a problem with my
> tools so I won't worry about it. And it would have to go on another
> thread anyhow.
>
> Thanks again.
>
> Fahd
>
>

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

* RE: trying to use gdb to disassemble a binary file
@ 2007-08-06 21:00 Fahd Abidi
  0 siblings, 0 replies; 6+ messages in thread
From: Fahd Abidi @ 2007-08-06 21:00 UTC (permalink / raw)
  To: gdb

Thanks to the both of you. The objdump command worked.

I tried the objcopy before I emailed and converted the binary file to an
ELF format but for some reason the architecture would not get written to
the created elf file:

PPC_440-bojcopy -I binary -O elf32-powerpc -B powerpc file file.elf

trying to do an "objdump -f" showed that there was no architecture
information copied over. Trying to disassemble this resulted in an error
saying the architecture was unknown. Probably this was a problem with my
tools so I won't worry about it. And it would have to go on another
thread anyhow.

Thanks again.

Fahd
 

-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@false.org] 
Sent: Monday, August 06, 2007 3:30 PM
To: Dave Korn
Cc: Fahd Abidi; gdb@sourceware.org
Subject: Re: trying to use gdb to disassemble a binary file

On Mon, Aug 06, 2007 at 07:56:32PM +0100, Dave Korn wrote:
> On 06 August 2007 19:45, Fahd Abidi wrote:
> 
> > Hello,
> > 
> > I am trying to use GDB to disassemble a binary file. I have no 
> > problems when gdb connects to a target board (running a PC440) and 
> > viewing the disassembly via the display command, (gdb)x 
> > /10i$0xfffff000. But GDB does will not recognize or open a binary 
> > file format. It might not be the right tool to use, I really just 
> > want to open a binary file in gdb and view the disassembly. Is that
possible?
> 
>   Not easily, although it would work if you could get the file's 
> contents loaded into memory.
> 
>   Probably your best bet is to use "objdump -D --target=binary 
> --architecture=<your arch> filename"

Alternatively, use objcopy to convert the file into an ELF image.

--
Daniel Jacobowitz
CodeSourcery




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

end of thread, other threads:[~2007-08-08 13:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-06 18:46 trying to use gdb to disassemble a binary file Fahd Abidi
2007-08-06 18:56 ` Dave Korn
2007-08-06 19:16   ` Daniel Jacobowitz
2007-08-06 21:00 Fahd Abidi
2007-08-08  9:06 Robert Bu
2007-08-08 13:10 Robert Bu

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