flat assembler
Message board for the users of flat assembler.

Index > Linux > fas -> dwarf2?

Author
Thread Post new topic Reply to topic
litwr



Joined: 23 Aug 2005
Posts: 11
Location: Moscow, Russia
litwr 07 Nov 2014, 19:19
I begin to think about a converter from FAS to DWARF2 format. Could anybody help to estimate the difficulty of this task? I like FASM and GDB but can't use them together. Sad
Post 07 Nov 2014, 19:19
View user's profile Send private message Visit poster's website Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 430
Location: Australia
redsock 08 Nov 2014, 06:31
I use fasm + gdb constantly, and have found that so long as I use public symbols and framepointers, it is a breeze (and works as you'd expect/want).

Code:
        format ELF64

public crashycrashy
crashycrashy:
        push    rbp
        mov     rbp, rsp        ; framepointers to make gdb happy

        xor     eax, eax
        mov     dword [rax], 0
        
        leave                   ; restore stackframe
        ret

public _start
_start:
        push    rbp
        mov     rbp, rsp        ; framepointers to make gdb happy

        call    crashycrashy

        mov     eax, 60         ; exit
        xor     edi, edi        ; return code
        syscall
    


compile/link with:
fasm example.asm && ld -o example example.o

seems better than going to DWARF2 imo Smile

Cheers
Post 08 Nov 2014, 06:31
View user's profile Send private message Reply with quote
litwr



Joined: 23 Aug 2005
Posts: 11
Location: Moscow, Russia
litwr 08 Nov 2014, 10:11
Thank you. However this way can't satisfy me. I want to use b, l, d, ... - commands which are only available if the symbolic information is provided... I use gdb to work with C/C++ and want to use the same ways with Assembler.
Post 08 Nov 2014, 10:11
View user's profile Send private message Visit poster's website Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 08 Nov 2014, 16:01
Dwarf format is rather complex. You might want to take a look at stabs format which is simpler and gdb knows it. The other option is using another assembler as e.g. (g)as, yasm, nasm, etc. On Linux I use exclusively (g)as which is always available and knows everything I need. (g)as has the advantage that you can easily use the C preprocessor. There are some examples here and here. And you can use the mentioned gdb commands.
Post 08 Nov 2014, 16:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.