public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Simulating arm-linux binaries
@ 2005-11-14 22:28 Shaun Jackman
  2005-11-14 22:31 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Shaun Jackman @ 2005-11-14 22:28 UTC (permalink / raw)
  To: gdb

Hello,

I'm adding support to sim/arm (arm-elf-run) to run statically linked
Linux binaries. The work is going well so far; I'm already able to run
a "Hello, world!" application linked against uClibc. Running a "Hello,
world!" application linked against glibc is proving to be a little
more difficult. If anyone else is interested in this work, and perhaps
in helping with this work, I'll send my current patch your way. I'll
be sending a patch upstream that works with uClibc shortly.

It irks me, though, that glibc isn't yet working. Particularly
annoying is that arm-elf-run and arm-elf-gdb 'target sim' are giving
different results. When I call arm-elf-run hello, glibc calls the
syscalls { uname, brk, brk mmap) and then dies shortly after the
simulated mmap fails (errno = ENOMEM) with unhandled instructions at
address 0x504 and 0x50c. When I run the same binary with arm-elf-gdb,
glibc calls the syscalls { uname, geteuid32, getuid32, getegid32,
getgid32, writev } and the writev call displays...
*** glibc detected *** corrupted double-linked list: 0xff00006d ***

These two invocations of the same binary seem to be going down very
different code paths within glibc. Any idea why that is? Is gdb
calling the ARMulator differently somehow than sim?

Cheers,
Shaun

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

* Re: Simulating arm-linux binaries
  2005-11-14 22:28 Simulating arm-linux binaries Shaun Jackman
@ 2005-11-14 22:31 ` Daniel Jacobowitz
  2005-11-14 22:59   ` Shaun Jackman
  2005-11-15 20:44   ` Shaun Jackman
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2005-11-14 22:31 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: gdb

On Mon, Nov 14, 2005 at 03:28:47PM -0700, Shaun Jackman wrote:
> Hello,
> 
> I'm adding support to sim/arm (arm-elf-run) to run statically linked
> Linux binaries. The work is going well so far; I'm already able to run
> a "Hello, world!" application linked against uClibc. Running a "Hello,
> world!" application linked against glibc is proving to be a little
> more difficult. If anyone else is interested in this work, and perhaps
> in helping with this work, I'll send my current patch your way. I'll
> be sending a patch upstream that works with uClibc shortly.

Have you considered just using qemu instead?  It supports ARM usermode
emulation, and has a gdb server as a bonus.

> These two invocations of the same binary seem to be going down very
> different code paths within glibc. Any idea why that is? Is gdb
> calling the ARMulator differently somehow than sim?

No idea - it shouldn't be.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: Simulating arm-linux binaries
  2005-11-14 22:31 ` Daniel Jacobowitz
@ 2005-11-14 22:59   ` Shaun Jackman
  2005-11-15  2:07     ` Daniel Jacobowitz
  2005-11-15 20:44   ` Shaun Jackman
  1 sibling, 1 reply; 5+ messages in thread
From: Shaun Jackman @ 2005-11-14 22:59 UTC (permalink / raw)
  To: gdb

2005/11/14, Daniel Jacobowitz <drow@false.org>:
> Have you considered just using qemu instead?  It supports ARM usermode
> emulation, and has a gdb server as a bonus.

I didn't know qemu-arm existed. Thanks for the pointer.

I used this howto [1] to set up qemu-arm, but it's failing as follows:

$ qemu-arm -L arm arm/bin/ls
Unable to load interpreter
Segmentation fault
$ qemu-arm --version
qemu-arm version 0.7.2, Copyright (c) 2003-2005 Fabrice Bellard

[1] http://people.debian.org/~ballombe/qemu/qemu.html/

> > These two invocations of the same binary seem to be going down very
> > different code paths within glibc. Any idea why that is? Is gdb
> > calling the ARMulator differently somehow than sim?
>
> No idea - it shouldn't be.

Odd.

Cheers,
Shaun

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

* Re: Simulating arm-linux binaries
  2005-11-14 22:59   ` Shaun Jackman
@ 2005-11-15  2:07     ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2005-11-15  2:07 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: gdb

On Mon, Nov 14, 2005 at 03:59:12PM -0700, Shaun Jackman wrote:
> 2005/11/14, Daniel Jacobowitz <drow@false.org>:
> > Have you considered just using qemu instead?  It supports ARM usermode
> > emulation, and has a gdb server as a bonus.
> 
> I didn't know qemu-arm existed. Thanks for the pointer.
> 
> I used this howto [1] to set up qemu-arm, but it's failing as follows:
> 
> $ qemu-arm -L arm arm/bin/ls
> Unable to load interpreter
> Segmentation fault
> $ qemu-arm --version
> qemu-arm version 0.7.2, Copyright (c) 2003-2005 Fabrice Bellard

Afraid I don't know much about it; you may want to direct questions to
the qemu forums, or for ARM, annoy Paul Brook directly :-)

I've only worked with qemu system emulation, not user emulation.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: Simulating arm-linux binaries
  2005-11-14 22:31 ` Daniel Jacobowitz
  2005-11-14 22:59   ` Shaun Jackman
@ 2005-11-15 20:44   ` Shaun Jackman
  1 sibling, 0 replies; 5+ messages in thread
From: Shaun Jackman @ 2005-11-15 20:44 UTC (permalink / raw)
  To: gdb

2005/11/14, Daniel Jacobowitz <drow@false.org>:
> Have you considered just using qemu instead?  It supports ARM usermode
> emulation, and has a gdb server as a bonus.

qemu-arm works very well with statically linked executables! In
conjunction with Linux binfmt, it makes testing arm-linux binaries a
breeze!

$ cat /proc/sys/fs/binfmt_misc/arm-linux
enabled
interpreter /usr/bin/qemu-arm
flags:
offset 0
magic 7f454c4601010161

Cheers!
Shaun

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

end of thread, other threads:[~2005-11-15 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-14 22:28 Simulating arm-linux binaries Shaun Jackman
2005-11-14 22:31 ` Daniel Jacobowitz
2005-11-14 22:59   ` Shaun Jackman
2005-11-15  2:07     ` Daniel Jacobowitz
2005-11-15 20:44   ` Shaun Jackman

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).