0

I'm trying to learn assembly and I'm using Nasm v2.10.07 on Mac OS X (Snow Leopard). I can compile, but I need to read the Debug file, that is a .o file. This is what I compile:

global _main
section.data
M db 5,4,3,2,1
dim equ $-M
section.text
_main:
    mov edi, M
    mov eax, 0
    mov ebx, 1
int 80h

This is how I compile:

nasm -f elf -g -F stabs myfile.asm -o myfile.o

And this is the result:

ELF����������������������@�������4�����(�
�������������������������������������������������������������������–������������������������������������?��������������������������������0��M��������������������������������Ä��ê���������������"����������������2������������������*���   �����������P�����������������4��������������`��T����������������:��������������¿��������������������C���    �����������–��0���������������ø����∏����ª���ÕÄ�%define $�The Netwide Assembler 0.98.40 (Apple Computer, Inc. build 11)���.text�.comment�.shstrtab�.symtab�.strtab�.rel.text�.stab�.stabstr�.rel.stab��%d����������������������������Òˇ�������������Òˇ������������������������������������������������������Òˇ�������������,�������������myfile.asm�section.data�M�dim�section.text�_main��%define $_%1 ������%define������������d�����������D����������D���������D��
�������D�   ��������D�
�����%define $_%�myfile.asm��%de����� �����,�����8�����D�����P�����

So, what should I do to read in the correct way the debug without those strange symbols?

Paul R
  • 208,748
  • 37
  • 389
  • 560
OniTakeda
  • 11
  • 5

1 Answers1

1

To show the contents of the .stabs section, use objdump -g myfile.o or objdump -G myfile.o

To get the full source code with line numbers taken from the debug section, use objdump -S -l myfile.o

Michael
  • 57,169
  • 9
  • 80
  • 125