From owner-freebsd-hackers Fri Jun 4 21:49:25 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from obie.softweyr.com (unknown [204.68.178.33]) by hub.freebsd.org (Postfix) with ESMTP id 45E1D14DDF for ; Fri, 4 Jun 1999 21:49:21 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from softweyr.com ([204.68.178.224]) by obie.softweyr.com (8.8.8/8.8.8) with ESMTP id WAA24882; Fri, 4 Jun 1999 22:49:18 -0600 (MDT) (envelope-from wes@softweyr.com) Message-ID: <3758AC4D.AFE9F78C@softweyr.com> Date: Fri, 04 Jun 1999 22:49:17 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Marc Tardif Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: disassembling execve (fwd) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Marc Tardif wrote: > > ---------- Forwarded message ---------- > Date: Fri, 4 Jun 1999 18:39:35 -0400 (EDT) > From: Marc Tardif > To: freebsd-questions@freebsd.org > Subject: disassembling execve > > How can I disassemble the execve syscall? > > I tried compiling the following code: > #include > > 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 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