Date: Fri, 04 Jun 1999 22:49:17 -0600 From: Wes Peters <wes@softweyr.com> To: Marc Tardif <intmktg@CAM.ORG> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: disassembling execve (fwd) Message-ID: <3758AC4D.AFE9F78C@softweyr.com> References: <Pine.SOL.4.10.9906050025410.10165-100000@Ocean.CAM.ORG>
next in thread | previous in thread | raw e-mail | index | archive | help
Marc Tardif wrote:
>
> ---------- Forwarded message ----------
> Date: Fri, 4 Jun 1999 18:39:35 -0400 (EDT)
> From: Marc Tardif <intmktg@CAM.ORG>
> To: freebsd-questions@freebsd.org
> Subject: disassembling execve
>
> How can I disassemble the execve syscall?
>
> I tried compiling the following code:
> #include <stdio.h>
>
> void main() {
> char *name[2];
> name[0] = "/bin/date";
> name[1] = NULL;
> execve(name[0], name, NULL);
> }
>
> ... using the following command:
> gcc -o program -ggdb -static program.c
>
> ... and then debugging with:
> gdb program
>
> ... followed by:
> disassemble main
> disassemble execve
>
> The gcc manpage specifies that "on systems that support dynamic linking,
> this prevents linking with the shared libraries" regarding the -static
> flag. I've noted changes when using 'disassemble main' and using the
> -static flag, so it seems FreeBSD is among such systems. Yet, when running
> disassemble execve (which is what appears in the main disassembly), I get:
> "No function contains the specified address."
My system reports the following:
(gdb) disassemble execve
Dump of assembler code for function _execve:
0x80481f0 <_execve>: leal 0x3b,%eax
0x80481f6 <_execve+6>: int $0x80
0x80481f8 <_execve+8>: jb 0x80481e8 <atexit+108>
0x80481fa <_execve+10>: ret
0x80481fb <_execve+11>: nop
End of assembler dump.
What version of FreeBSD, gcc, and gdb are you using? Mine are
3.1-RELEASE, 2.7.2.1, and 4.16 respectively, all as installed from
the 3.1 CD-ROM. It also worked fine on my 4.0-CURRENT machine using
egcs-1.1.2 release and 4.18.
--
"Where am I, and what am I doing in this handbasket?"
Wes Peters Softweyr LLC
http://www.softweyr.com/~softweyr wes@softweyr.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3758AC4D.AFE9F78C>
