Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 1999 13:54:44 +0200
From:      Ugo Matrangolo <gimatra@tin.it>
To:        freebsd-questions@freebsd.org
Subject:   newbie : gdb and 386's machine code 
Message-ID:  <373EB204.BD1DE491@tin.it>

next in thread | raw e-mail | index | archive | help
Hi ,

Cause i have to do some coding in 'pure' assembly language (college exam) i
have to find a way to write pure x86 code under freebsd .        

Now , i can easily write asm code using nasm and run it using this C code 
that wraps my asm program :



#include <stdio.h>

extern void start(void);

int main(void)
{
  start();

  return 0;
}

... and this is a sample asm code :

; hello.s  --  Simple test program .

	BITS 32
	
	GLOBAL start		; exported syms 
	
	EXTERN printf           ; imported syms

	SECTION .text

start:
	 push	ebp
	mov	esp,ebp
	push	dword	hello_string
	call	printf
	add	esp,4
	mov	ebp,esp
	pop	ebp
	ret

	SECTION	.data

hello_string	db	"Hello World!",10,0
	
	SECTION	.bss
			
After compiling this with nasm & gcc ,it runs fine . Now , what if 
i want to debug the asm code instruction by instruction ? 

If i use gdb,placing a breakpoint on start(),"step"/"next" jumps over the start() routine !
All i can do ( i think ! )is to put a breakpoint in memory ,run the code,
and see what are the registers but i don't know how to execute every single   
instructions . 

How can i do it using gdb or any other debugger (?) under freebsd ? 

Please , i don't want to reinstall dos on my box !;-)

bye!








To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?373EB204.BD1DE491>