Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler: emit DWARF2 line number information #684

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Compiler: emit DWARF2 line number information #684

merged 2 commits into from
Jan 17, 2024

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Jan 16, 2024

Demo: when compiling the program below (jasminc -o crash.s crash.jazz && cc -o crash crash.s) and running it within gdb, here is the resulting output:

Program received signal SIGSEGV, Segmentation fault.
main () at crash.jazz:6
6         r = (u8)[end];

Here are the full contents of crash.jazz:

export
fn main(reg u64 argc argv) -> reg u8 {
  reg u64 end;
  reg u8 r;
  end = [argv + 8 * argc];
  r = (u8)[end];
  return r;
}

and the assembly listing produced by jasminc:

        .att_syntax
        .text
        .p2align        5
        .globl  _main
        .globl  main
_main:
main:
        .file 1 "crash.jazz"
        .loc 1 5 2
        movq    (%rsi,%rdi,8), %rax
        .loc 1 6 2
        movb    (%rax), %al
        ret

bgregoir
bgregoir previously approved these changes Jan 17, 2024
@vbgl
Copy link
Member Author

vbgl commented Jan 17, 2024

I’ve just added a command line flag -g to turn ON this new feature. It is OFF by default.

@bgregoir bgregoir merged commit c929bd8 into main Jan 17, 2024
1 check passed
@bgregoir bgregoir deleted the dwarf2 branch January 17, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants