public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] objdump for binary file
@ 2001-08-21 12:23 Trenton D. Adams
  2001-08-21 12:33 ` Grant Edwards
  0 siblings, 1 reply; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 12:23 UTC (permalink / raw)
  To: 'eCos Discussion'

I compiled an eCos program and then copied it to a binary file.  Is
there a way of dumping the assembly now?  I've tried the command below,
but it doesn't work.

$ arm-elf-objdump.exe -b binary -D -mcpu=arm7tdmi test.bin

test.bin:     file format binary

arm-elf-objdump.exe: test.bin: no symbols
arm-elf-objdump.exe: Can't use supplied machine cpu=arm7tdmi



Trenton D. Adams
Extreme Engineering
#17, 6025 - 12 St. SE
Calgary, Alberta, Canada
T2H 2K1

Phone: 403 640 9494 ext-208
Fax: 403 640 9599

http://www.extremeeng.com

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

* Re: [ECOS] objdump for binary file
  2001-08-21 12:23 [ECOS] objdump for binary file Trenton D. Adams
@ 2001-08-21 12:33 ` Grant Edwards
  2001-08-21 13:02   ` Jonathan Larmour
  2001-08-21 13:05   ` Trenton D. Adams
  0 siblings, 2 replies; 13+ messages in thread
From: Grant Edwards @ 2001-08-21 12:33 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'eCos Discussion'

On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:

> I compiled an eCos program and then copied it to a binary file.  Is
> there a way of dumping the assembly now?  

No.

Run arm-elf-objdump --source on the ELF file.

-- 
Grant Edwards
grante@visi.com

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

* Re: [ECOS] objdump for binary file
  2001-08-21 12:33 ` Grant Edwards
@ 2001-08-21 13:02   ` Jonathan Larmour
  2001-08-21 13:07     ` Trenton D. Adams
  2001-08-21 13:22     ` Grant Edwards
  2001-08-21 13:05   ` Trenton D. Adams
  1 sibling, 2 replies; 13+ messages in thread
From: Jonathan Larmour @ 2001-08-21 13:02 UTC (permalink / raw)
  To: Grant Edwards; +Cc: Trenton D. Adams, 'eCos Discussion'

Grant Edwards wrote:
> 
> On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:
> 
> > I compiled an eCos program and then copied it to a binary file.  Is
> > there a way of dumping the assembly now?
> 
> No.

Yes :-). It's not pretty and you've lost all the symbol info, but you can
disassemble everything (including data!). e.g.

echo > foo.c
arm-elf-gcc -c -o foo.o foo.c
arm-elf-objcopy --remove-section=.text foo.o
arm-elf-objcopy --add-section=.text=thebinfile foo.o
arm-elf-objcopy --set-section-flags=.text=alloc,load,code,contents,readonly
foo.o
arm-elf-objdump -d foo.o

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

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

* RE: [ECOS] objdump for binary file
  2001-08-21 12:33 ` Grant Edwards
  2001-08-21 13:02   ` Jonathan Larmour
@ 2001-08-21 13:05   ` Trenton D. Adams
  2001-08-21 13:28     ` Grant Edwards
  1 sibling, 1 reply; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 13:05 UTC (permalink / raw)
  To: 'Grant Edwards', 'Trenton D. Adams'
  Cc: 'eCos Discussion'

Ok, if the arm-elf tools can't do it, how would I do it?  I want to
reverse engineer a driver for the PCMCIA controller I'm using.  I think
it's in plain binary form, but I'm not sure.

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Grant
Edwards
Sent: Tuesday, August 21, 2001 1:35 PM
To: Trenton D. Adams
Cc: 'eCos Discussion'
Subject: Re: [ECOS] objdump for binary file


On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:

> I compiled an eCos program and then copied it to a binary file.  Is
> there a way of dumping the assembly now?  

No.

Run arm-elf-objdump --source on the ELF file.

-- 
Grant Edwards
grante@visi.com

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

* RE: [ECOS] objdump for binary file
  2001-08-21 13:02   ` Jonathan Larmour
@ 2001-08-21 13:07     ` Trenton D. Adams
  2001-08-21 13:08       ` Jonathan Larmour
  2001-08-21 13:22     ` Grant Edwards
  1 sibling, 1 reply; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 13:07 UTC (permalink / raw)
  To: 'Jonathan Larmour', 'Grant Edwards'
  Cc: 'Trenton D. Adams', 'eCos Discussion'

Although that was very cool! ;)  I don't have source code or object
code! :)

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Jonathan
Larmour
Sent: Tuesday, August 21, 2001 2:02 PM
To: Grant Edwards
Cc: Trenton D. Adams; 'eCos Discussion'
Subject: Re: [ECOS] objdump for binary file


Grant Edwards wrote:
> 
> On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:
> 
> > I compiled an eCos program and then copied it to a binary file.  Is
> > there a way of dumping the assembly now?
> 
> No.

Yes :-). It's not pretty and you've lost all the symbol info, but you
can
disassemble everything (including data!). e.g.

echo > foo.c
arm-elf-gcc -c -o foo.o foo.c
arm-elf-objcopy --remove-section=.text foo.o
arm-elf-objcopy --add-section=.text=thebinfile foo.o
arm-elf-objcopy
--set-section-flags=.text=alloc,load,code,contents,readonly
foo.o
arm-elf-objdump -d foo.o

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223)
271062
Maybe this world is another planet's Hell -Aldous Huxley ||
Opinions==mine

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

* Re: [ECOS] objdump for binary file
  2001-08-21 13:07     ` Trenton D. Adams
@ 2001-08-21 13:08       ` Jonathan Larmour
  2001-08-21 13:20         ` Trenton D. Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Larmour @ 2001-08-21 13:08 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'eCos Discussion'

"Trenton D. Adams" wrote:
> 
> Although that was very cool! ;)  I don't have source code or object
> code! :)

What I described will work for a binary file.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

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

* RE: [ECOS] objdump for binary file
  2001-08-21 13:08       ` Jonathan Larmour
@ 2001-08-21 13:20         ` Trenton D. Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 13:20 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: 'eCos Discussion'

Oh, I just skimmed it so I didn't realize what was going on.

I thought that GCC would give an error for an empty .c file.  That's
interesting! :)

Now it's very cool! ;)

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Jonathan
Larmour
Sent: Tuesday, August 21, 2001 2:09 PM
To: Trenton D. Adams
Cc: 'eCos Discussion'
Subject: Re: [ECOS] objdump for binary file


"Trenton D. Adams" wrote:
> 
> Although that was very cool! ;)  I don't have source code or object
> code! :)

What I described will work for a binary file.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223)
271062
Maybe this world is another planet's Hell -Aldous Huxley ||
Opinions==mine

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

* Re: [ECOS] objdump for binary file
  2001-08-21 13:02   ` Jonathan Larmour
  2001-08-21 13:07     ` Trenton D. Adams
@ 2001-08-21 13:22     ` Grant Edwards
  2001-08-21 13:27       ` Trenton D. Adams
  1 sibling, 1 reply; 13+ messages in thread
From: Grant Edwards @ 2001-08-21 13:22 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: Trenton D. Adams, 'eCos Discussion'

On Tue, Aug 21, 2001 at 09:02:05PM +0100, Jonathan Larmour wrote:
> Grant Edwards wrote:
> > 
> > On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:
> > 
> > > I compiled an eCos program and then copied it to a binary file.  Is
> > > there a way of dumping the assembly now?
> > 
> > No.
> 
> Yes :-). It's not pretty and you've lost all the symbol info, but you can
> disassemble everything (including data!). e.g.
> 
> echo > foo.c
> arm-elf-gcc -c -o foo.o foo.c
> arm-elf-objcopy --remove-section=.text foo.o
> arm-elf-objcopy --add-section=.text=thebinfile foo.o
> arm-elf-objcopy --set-section-flags=.text=alloc,load,code,contents,readonly foo.o
> arm-elf-objdump -d foo.o

The bit at the top where you compile an empty C file to
generate all the right sections is clever -- I hadn't thought
of that.

One would hope he kept a copy of the ELF file -- or can
re-generate it.  Making sense of a binary file by disassembling
it requires considerable skill and can use up lots of hours for
a non-trivial program.

-- 
Grant Edwards
grante@visi.com

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

* RE: [ECOS] objdump for binary file
  2001-08-21 13:22     ` Grant Edwards
@ 2001-08-21 13:27       ` Trenton D. Adams
  2001-08-21 13:32         ` Grant Edwards
  0 siblings, 1 reply; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 13:27 UTC (permalink / raw)
  To: 'Grant Edwards', 'Jonathan Larmour'
  Cc: 'Trenton D. Adams', 'eCos Discussion'

All I'm looking for is accesses to specific areas of memory.  If I can
find the references to those areas of memory, it shouldn't be that
difficult, should it?

I've done it with TRIVIAL programs before, but never something so
complex.  It's 257K of assembly.  Ouch.

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Grant
Edwards
Sent: Tuesday, August 21, 2001 2:25 PM
To: Jonathan Larmour
Cc: Trenton D. Adams; 'eCos Discussion'
Subject: Re: [ECOS] objdump for binary file


On Tue, Aug 21, 2001 at 09:02:05PM +0100, Jonathan Larmour wrote:
> Grant Edwards wrote:
> > 
> > On Tue, Aug 21, 2001 at 01:23:22PM -0600, Trenton D. Adams wrote:
> > 
> > > I compiled an eCos program and then copied it to a binary file.
Is
> > > there a way of dumping the assembly now?
> > 
> > No.
> 
> Yes :-). It's not pretty and you've lost all the symbol info, but you
can
> disassemble everything (including data!). e.g.
> 
> echo > foo.c
> arm-elf-gcc -c -o foo.o foo.c
> arm-elf-objcopy --remove-section=.text foo.o
> arm-elf-objcopy --add-section=.text=thebinfile foo.o
> arm-elf-objcopy
--set-section-flags=.text=alloc,load,code,contents,readonly foo.o
> arm-elf-objdump -d foo.o

The bit at the top where you compile an empty C file to
generate all the right sections is clever -- I hadn't thought
of that.

One would hope he kept a copy of the ELF file -- or can
re-generate it.  Making sense of a binary file by disassembling
it requires considerable skill and can use up lots of hours for
a non-trivial program.

-- 
Grant Edwards
grante@visi.com

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

* Re: [ECOS] objdump for binary file
  2001-08-21 13:05   ` Trenton D. Adams
@ 2001-08-21 13:28     ` Grant Edwards
  0 siblings, 0 replies; 13+ messages in thread
From: Grant Edwards @ 2001-08-21 13:28 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'Trenton D. Adams', 'eCos Discussion'

On Tue, Aug 21, 2001 at 02:05:18PM -0600, Trenton D. Adams wrote:

> > > I compiled an eCos program and then copied it to a binary file.
> > > Is there a way of dumping the assembly now?
> >
> > No.
> >
> > Run arm-elf-objdump --source on the ELF file.

> Ok, if the arm-elf tools can't do it, how would I do it? 

It can be done by converting the file back into ELF format.

> I want to reverse engineer a driver for the PCMCIA controller
> I'm using.  I think it's in plain binary form, but I'm not
> sure.

You've got an eCos program in binary-only and you need to
reverse-engineer it?  Ouch.

Have you reverse-engineered machine-level stuff before? You
probably need to find a good interactive disassembler that lets
you annotate stuff as you figure it out. I don't know of any
for ARM.

-- 
Grant Edwards
grante@visi.com

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

* Re: [ECOS] objdump for binary file
  2001-08-21 13:27       ` Trenton D. Adams
@ 2001-08-21 13:32         ` Grant Edwards
  2001-08-21 14:02           ` Trenton D. Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Grant Edwards @ 2001-08-21 13:32 UTC (permalink / raw)
  To: Trenton D. Adams
  Cc: 'Jonathan Larmour', 'Trenton D. Adams',
	'eCos Discussion'

On Tue, Aug 21, 2001 at 02:27:25PM -0600, Trenton D. Adams wrote:

> All I'm looking for is accesses to specific areas of memory.
> If I can find the references to those areas of memory, it
> shouldn't be that difficult, should it?

Hard to tell.

> I've done it with TRIVIAL programs before, but never something
> so complex.  It's 257K of assembly.  Ouch.

I don't know exactly how much you get paid, but it's not
enough...

-- 
Grant Edwards
grante@visi.com

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

* RE: [ECOS] objdump for binary file
  2001-08-21 13:32         ` Grant Edwards
@ 2001-08-21 14:02           ` Trenton D. Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Trenton D. Adams @ 2001-08-21 14:02 UTC (permalink / raw)
  To: 'Grant Edwards'
  Cc: 'Jonathan Larmour', 'eCos Discussion'

I don't have all that much of a choice at the moment.  We need that
controller working, and the only way I can see it happening at the
moment is this way.  If I do manage to do it, I'll be laughing for the
rest of my life! :)

I don't actually believe that I will get anywhere, but I'll try for
awhile, and if it doesn't work then oh well.

As for pay, this is for FUN! ;)  NOT!!!

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Grant
Edwards
Sent: Tuesday, August 21, 2001 2:34 PM
To: Trenton D. Adams
Cc: 'Jonathan Larmour'; 'Trenton D. Adams'; 'eCos Discussion'
Subject: Re: [ECOS] objdump for binary file


On Tue, Aug 21, 2001 at 02:27:25PM -0600, Trenton D. Adams wrote:

> All I'm looking for is accesses to specific areas of memory.
> If I can find the references to those areas of memory, it
> shouldn't be that difficult, should it?

Hard to tell.

> I've done it with TRIVIAL programs before, but never something
> so complex.  It's 257K of assembly.  Ouch.

I don't know exactly how much you get paid, but it's not
enough...

-- 
Grant Edwards
grante@visi.com

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

* Re: [ECOS] objdump for binary file
@ 2001-08-27  8:02 Andre Asselin
  0 siblings, 0 replies; 13+ messages in thread
From: Andre Asselin @ 2001-08-27  8:02 UTC (permalink / raw)
  To: ecos-discuss

>----- Message from Grant Edwards <grante@visi.com> on Tue, 21 Aug 2001
15:30:05 -0500 -----

>>On Tue, Aug 21, 2001 at 02:05:18PM -0600, Trenton D. Adams wrote:

>> > > I compiled an eCos program and then copied it to a binary file.
>> > > Is there a way of dumping the assembly now?
>> >
>> > No.
>> >
>> > Run arm-elf-objdump --source on the ELF file.

>> Ok, if the arm-elf tools can't do it, how would I do it?

>It can be done by converting the file back into ELF format.

>> I want to reverse engineer a driver for the PCMCIA controller
>> I'm using.  I think it's in plain binary form, but I'm not
>> sure.

>You've got an eCos program in binary-only and you need to
>reverse-engineer it?  Ouch.

>Have you reverse-engineered machine-level stuff before? You
>probably need to find a good interactive disassembler that lets
>you annotate stuff as you figure it out. I don't know of any
>for ARM.

The best interactive disassembler I've found is IDA Pro (see
http://www.datarescue.com/idabase/ida.htm ).  At $300 for the standard
version, which includes ARM and many other processor architectures, its a
bargain.  I've used it on 386, 6800, and 68000 code, and its been
fantastic.

Andre Asselin
IBM ServeRAID Software Development
Research Triangle Park, NC

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

end of thread, other threads:[~2001-08-27  8:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 12:23 [ECOS] objdump for binary file Trenton D. Adams
2001-08-21 12:33 ` Grant Edwards
2001-08-21 13:02   ` Jonathan Larmour
2001-08-21 13:07     ` Trenton D. Adams
2001-08-21 13:08       ` Jonathan Larmour
2001-08-21 13:20         ` Trenton D. Adams
2001-08-21 13:22     ` Grant Edwards
2001-08-21 13:27       ` Trenton D. Adams
2001-08-21 13:32         ` Grant Edwards
2001-08-21 14:02           ` Trenton D. Adams
2001-08-21 13:05   ` Trenton D. Adams
2001-08-21 13:28     ` Grant Edwards
2001-08-27  8:02 Andre Asselin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).