Dear all.

On Sat, Mar 7, 2015 at 6:44 PM Kiwamu Okabe <[email protected]> wrote:
> Someone is trying to debug ATS code using DWARF?

Fortunately, I found the following simple method, while learning Vala language:

https://gist.github.com/master-q/b8167531a5a0679b9a830ed12a75619f

```
$ gcc -g -I /home/kiwamu/src/ATS-Postiats/ccomp/runtime/ -I
/home/kiwamu/src/ATS-Postiats/ main_dats.c
$ gdb a.out
(gdb) b main.dats:atspre_g0int_add_int
Breakpoint 1 at 0x120a: file
/home/kiwamu/src/ATS-Postiats/prelude/CATS/integer.cats, line 157.
(gdb) run
Starting program: /home/kiwamu/src/idiomaticca/regress/noinc/arithmetic_op/a.out

Breakpoint 1, atspre_g0int_add_int (x1=1, x2=2) at
/home/kiwamu/src/ATS-Postiats/prelude/CATS/integer.cats:157
157       (atstype_int x1, atstype_int x2) { return (x1 + x2) ; }
(gdb) bt
#0  atspre_g0int_add_int (x1=1, x2=2) at
/home/kiwamu/src/ATS-Postiats/prelude/CATS/integer.cats:157
#1  0x000055555555529c in mainats_1_void () at main.dats:4
#2  0x0000555555555635 in main (argc=1, argv=0x7fffffffd5d8,
envp=0x7fffffffd5e8) at main.dats:3
(gdb) l
152       (atstype_int x) { return (x / 2) ; }
153     // end of [atspre_g0int_half_int]
154     ATSinline()
155     atstype_int
156     atspre_g0int_add_int
157       (atstype_int x1, atstype_int x2) { return (x1 + x2) ; }
158     // end of [atspre_g0int_add_int]
159     ATSinline()
160     atstype_int
161     atspre_g0int_sub_int
(gdb) up
#1  0x000055555555529c in mainats_1_void () at main.dats:4
4         1 + 2 - 3 * 4 / 4
(gdb) l
1       #include "share/atspre_staload.hats"
2
3       implement main () =
4         1 + 2 - 3 * 4 / 4
5
```

I'll try to write some patch to inject such `#line` code onto output of patsopt.

I'm so happy, if you advice me some comment on ATS compiler internal.
Best regards,
-- 
Kiwamu Okabe at METASEPI DESIGN

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAEvX6d%3Da47ypQcg2q3wsh%2Bxwuw2xCgnyX%2BVa_BVUOa0EWiRBeQ%40mail.gmail.com.

Reply via email to