dbfn@debian:~/Scripts$ cat teste2.asm
%macro exit 1
mov eax,1
mov ebx,%1
int 80h
%endmacro
section .text
global main
section .data
msg1 db "teste", 0Ah
len1 equ $ - msg1
main:
mov ecx,msg1
mov edx,len1
mov eax,4
mov ebx,1
int 80h
exit 0
dbfn@debian:~/Scripts$ nasm -f elf -g -F stabs teste2.asm
dbfn@debian:~/Scripts$ ld -e main -o teste2 teste2.o
dbfn@debian:~/Scripts$ file teste2
teste2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
dbfn@debian:~/Scripts$ readelf -s -g teste2
There are no section groups in this file.
Symbol table '.symtab' contains 11 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 08049054 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 SECTION LOCAL DEFAULT 2
3: 00000000 0 SECTION LOCAL DEFAULT 3
4: 00000000 0 FILE LOCAL DEFAULT ABS teste2.asm
5: 08049054 1 OBJECT LOCAL DEFAULT 1 msg1
6: 00000006 0 NOTYPE LOCAL DEFAULT ABS len1
7: 0804907c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
8: 0804905a 0 NOTYPE GLOBAL DEFAULT 1 main
9: 0804907c 0 NOTYPE GLOBAL DEFAULT ABS _edata
10: 0804907c 0 NOTYPE GLOBAL DEFAULT ABS _end
dbfn@debian:~/Scripts$ objdump -M intel -g -e -G teste2
objdump: teste2: no recognized debugging information
dbfn@debian:~/Scripts$ gdb teste2
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(no debugging symbols found)
(gdb) r
Starting program: /home/dbfn/Scripts/teste2
(no debugging symbols found)
teste
Program exited normally.
(gdb) l 20
No symbol table is loaded. Use the "file" command.
(gdb) q
dbfn@debian:~/Scripts$ nasm -v
NASM version 2.03.01 compiled on Jun 18 2008
dbfn@debian:~/Scripts$
You've got "main" (and following) in section .data. Put it back in .text and try it.
Best,
Frank
P.S. I forget which version "dwarf" debugging info was added. Supposed to be the "default" for gdb. (I don't see any difference, to be honest). Anyway, much newer versions available at:
http://www.nasm.us (http://www.nasm.us/)
Yes...I'm an iddiot...t-t
Thanks dude!
Now i'm having another problem...idk wtf it is...look:
Quote:
dbfn@debian:~/Scripts$ ls | grep teste2
teste2
teste2.asm
teste2.asm~
teste2.o
dbfn@debian:~/Scripts$ file teste2
teste2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
dbfn@debian:~/Scripts$ ./teste2
bash: ./teste2: No such file or directory
dbfn@debian:~/Scripts$
Looking into my crystal ball... you linked this directly, didn't use gcc, right? Add "-I ld-linux.so.2" to the ld command line. "-I" (Interpreter) or "--dynamic-linker" (longer to type) tell ld which dynamic linker to use, by default it looks for ".so.1". I think you'll find that that's the "file not found"... If not... you may need to give us more information...
Confusing when it says "file not found" when you can "see" the file right there, isn't it?
Best,
Frank