Dear Hongwei,

On Mon, May 27, 2019 at 7:18 PM Kiwamu Okabe <[email protected]> wrote:
> Fortunately, I found the following simple method, while learning Vala 
> language:
>
> https://gist.github.com/master-q/b8167531a5a0679b9a830ed12a75619f
--snip--
> I'll try to write some patch to inject such `#line` code onto output of 
> patsopt.

I think you have already implement it on `--gline` option.
May I use it to debug ELF file compiled by ATS2?

```
$ cp 
/home/kiwamu/src/ATS-Postiats/doc/BOOK/INT2PROGINATS/CODE/CHAP_DATAVTYPE/rbtree.dats
./
$ patsopt --gline -o rbtree_dats.c -d rbtree.dats
$ grep "^#line" rbtree_dats.c | wc -l
1924
$ gcc -g -DATS_MEMALLOC_LIBC -I
/home/kiwamu/src/ATS-Postiats/ccomp/runtime/ -I
/home/kiwamu/src/ATS-Postiats/ rbtree_dats.c
$ gdb a.out
(gdb) b 235
Breakpoint 1 at 0x15ee: /home/kiwamu/tmp/ats/rbtree/rbtree.dats:235.
(10 locations)
(gdb) run
Starting program: /home/kiwamu/tmp/ats/rbtree/a.out

Breakpoint 1, 
_057_home_057_kiwamu_057_tmp_057_ats_057_rbtree_057_rbtree_056_dats__rbtree_insert__2__1
(arg0=0x0, arg1=0x7fffffffd4e4, arg2=0x0) at
/home/kiwamu/tmp/ats/rbtree/rbtree.dats:235
235     val t = ins (t, x0)
(gdb) bt
#0  
_057_home_057_kiwamu_057_tmp_057_ats_057_rbtree_057_rbtree_056_dats__rbtree_insert__2__1
(arg0=0x0, arg1=0x7fffffffd4e4, arg2=0x0) at
/home/kiwamu/tmp/ats/rbtree/rbtree.dats:235
#1  0x000055555555540b in mainats_0_void () at
/home/kiwamu/tmp/ats/rbtree/rbtree.dats:311
#2  0x000055555555940b in main (argc=1, argv=0x7fffffffd668,
envp=0x7fffffffd678) at /home/kiwamu/tmp/ats/rbtree/rbtree.dats:322
(gdb) l
230           end else (fold@{a}{..}{..}{0} (t); t)
231         end // end of [cons]
232       | ~nil () => cons{a}{..}{..}{0}(R, nil, x0, nil)
233     ) (* end of [ins] *)
234     //
235     val t = ins (t, x0)
236     //
237     in
238     //
239     case+ t of @cons(c as R, _, _, _) => (c := B; fold@ (t); t) | _ =>> t
```

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%3DWsYbbfvCj8DFzSqPSRDfu%2BeDxxO%2BMZ6wfJuahyz5YTA%40mail.gmail.com.

Reply via email to