Ticket #116 (new defect)

Opened 10 months ago

Last modified 6 months ago

better debugging support

Reported by: pg@futureware.at Assigned to:
Priority: P1 Milestone:
Component: Debug Format: stabs Version: 0.6.0
Severity: normal Keywords: kdbg debugging
Cc:

Description

It would be helpful if yasm could produce sourcecode-line references into the -g debugging output, so that the assembler program can be debugged with KDBG more easily.

Attachments

dwarf2missingsource.txt (13.1 kB) - added by pg@futureware.at on 10/12/07 13:52:00.
gdb trace that shows the problem

Change History

10/11/07 22:07:28 changed by peter@tortall.net

If you're not using -g dwarf2, I suspect that may be the problem. Few systems actually use STABS debugging these days (judging from the ticket, that's what you're using). Try again with -g dwarf2 and let us know if it works (it should).

10/12/07 13:51:10 changed by pg@futureware.at

I tried both dwarf2 and stabs. I switched to dwarf2 now, recompiled everything, but I still don´t get a sourcecode of the assembler sourcecode file while debugging. I am sure that the debugging info is actually there, since it recognizes the functions, and displays RING_X_NKI+325 in the memory view in gdb, so it has the symbols included in the debugging info. But it seems that the references to the sourcecode files are either missing or broken, so the sourcecode isn´t displayed. I´ll attach a logfile of the gdb session here. The main program is a C sourcecode file, which calls an assembler function, both are linked together. The first breakpoint is in the C sourcecode, directly before it calls the assembler function, the crash afterwards happens in the assembler function. At first the reference to /home/test/LinuxFramework/cam.c:81 works, but then the crash only says that it happened in symbol RING_X_NKI which is the nearest lable in the assembler function, but it doesn´t show any information in which file or linenumber that symbol is, or the crash happened.

10/12/07 13:52:00 changed by pg@futureware.at

  • attachment dwarf2missingsource.txt added.

gdb trace that shows the problem

10/12/07 19:50:47 changed by peter@tortall.net

Can you email me or attach to this bug the .o file that you assembled with -g dwarf2? Thanks.

10/16/07 00:44:19 changed by peter@tortall.net

The other problem is that you might be linking without -g. I've tried the following example locally and it appears to work fine:

testdwarf2.asm:

global main
main:
  push ebp
  mov eax, 0
  pop ebp
  ret

Compile and debug:

% yasm -f elf32 -g dwarf2 testdwarf2.asm
% gcc -g -o testdwarf2 testdwarf2.o
% gdb testdwarf2
(gdb) break main
Breakpoint 1 at 0x80484f0: file testdwarf2.asm, line 3.
(gdb) run
Starting program: testdwarf2

Breakpoint 1, main () at testdwarf2.asm:3
3               push ebp
Current language:  auto; currently asm
(gdb) next
4               mov eax, 0
(gdb)
5               pop ebp
(gdb)

(follow-up: ↓ 7 ) 01/14/08 22:03:04 changed by anonymous

Is there a way to look out for contents of Registers using YASM?

01/14/08 23:29:09 changed by anonymous

Is there a debugging tool in YASM?

(in reply to: ↑ 5 ) 01/14/08 23:30:17 changed by anonymous

Replying to anonymous:

Is there a way to look out for contents of Registers using YASM?

Use GDB, run code, then type info registers.


Add/Change #116 (better debugging support)