linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gdb help
@ 2004-02-21 17:36 glburt
  0 siblings, 0 replies; 2+ messages in thread
From: glburt @ 2004-02-21 17:36 UTC (permalink / raw)
  To: linux-assembly

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

I am getting different results when I use gdb at home and at school. It is
the same version of gdb at both places, however the version of nasm
is different:  

school is 0.98.19
home   is 0.98.38

I don't know what that would make a difference, though.

I have searched for a config file, but don't know what file to look for,
saw nothing interesting based on file name.

I want to have the program step through one instruction at a time and
display the next line of code to be executed.

I save the two versions and included them in the attachment.

Any help would be greatly appreciated.

Thanks.


Gary



[-- Attachment #2: gdb_results --]
[-- Type: application/octet-stream, Size: 2107 bytes --]

Linux server at UMBC


test1[102]: cat Makefile
test1a : test1a.o
        gcc  -o test1a test1a.o
test1a.o : test1a.asm
        nasm -l test1a.lst -g -f elf test1a.asm
clean :
        rm test1a test1a.o test1a.lst test1a.asm~
test1[103]: make
nasm -l test1a.lst -g -f elf test1a.asm
gcc  -o test1a test1a.o
test1[104]: gdb test1a
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) break *main
Breakpoint 1 at 0x8048420
(gdb) run
Starting program: /tmp_mnt/ftp/pub/WWW/courses/undergraduate/CMSC313/spring04/burt_katz/test1/test1a

Breakpoint 1, 0x08048420 in main ()
(gdb) s
Single stepping until exit from function main,
which has no line number information.

Program exited normally.


==================================================================

Linux at home



[~/courses/umbc/CMSC313/spring04/test1]$ make
nasm -l test1a.lst -g -f elf test1a.asm
gcc  -o test1a test1a.o
[~/courses/umbc/CMSC313/spring04/test1]$ gdb test1a
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) break *main
Breakpoint 1 at 0x8048300: file test1a.asm, line 40.
(gdb) run
Starting program: /home/burt/courses/umbc/CMSC313/spring04/test1/test1a

Breakpoint 1, main () at test1a.asm:40
40              mov     eax, [ A ]              ; eax ____________________________
(gdb) s
42              add     eax, 32                 ; eax ____________________________
(gdb)

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

* Re: gdb help
@ 2004-02-24  1:18 Emmet Ford
  0 siblings, 0 replies; 2+ messages in thread
From: Emmet Ford @ 2004-02-24  1:18 UTC (permalink / raw)
  To: linux-assembly

I use gas rather than nasm, but I also find that I am unable to break on 
the first instruction in a program. Generally, what I do is use the gdb 
'list' command to list out the program and then set a break point on the 
line number of the second instruction in the program.

This issue is documented in various places, one of them being 
http://www.csee.umbc.edu/~chang/cs313.f03/gdb_help.shtml, where it says:

-->
Due to a bug in gdb,

<br> break *_start<br> does not stop the program before the execution of 
the first instruction. A workaround is to add a no operation instruction 
(mnemonic "nop") to the beginning of your program and use: <br> break 
*_start+1

<--

This may not be the problem that you are experiencing, however, since 
programs normally start at _start, not main. In any case, you might try 
break *main+1

--Emmet Ford



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

end of thread, other threads:[~2004-02-24  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-21 17:36 gdb help glburt
  -- strict thread matches above, loose matches on Subject: below --
2004-02-24  1:18 Emmet Ford

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 NNTP newsgroup(s).