Hi Hui -

On 10/29/15, 12:12 AM, "Hui Zhang" <[email protected]> wrote:

>
>I need to check the information of a specific AST node(a *BlockStmt)
>during the compilation, so I did:
> print print_view(block)
>
>in gdb, but I don't quite understand the tree-like information I got from
>that, any instructions ?

I don't think we have a reference for it or anything like that, but
one thing that might help is to look through some simple programs
with --log. E.g.
 chpl hello.chpl --log=

will create a log directory with AST dumps for each module for each pass.

>
>
>Besides, I found a bug in Chapel compiler, when I compiled a chapel code
>with forall loop inside, using llvm backend, instructions in the
>generated function "coforall_fn_chp" gets
> mapped to the wrong filename but correct line number. However this debug
>information came from the original AST node member variable called
>"astloc". Therefore, I'm wondering if anyone can help me point out where
>this astloc was initialized for each AST node
> ?

The compiler generally uses a global variable for the file/line.
This variable is set with SET_LINENO and the file/line from it are
stored in each new AST node.

If you have identified the AST node with the wrong line number, you
can get its id number (ast->id) and instruct the compiler to
call gdbShouldBreakHere when that id is created with --break-on-id.
It's possible that some code adding AST elements called
SET_LINENO with the wrong argument.

See doc/developer/bestPractices/CompilerIRTricks.txt
and doc/developer/bestPractices/CompilerDebugging.txt


Cheers,

-michael


------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to