[Rose-public] can't call unparseToString() inside GDB

Chunhua (Leo) Liao liao6 at llnl.gov
Thu Aug 16 17:19:50 PDT 2012


unparseToString() needs full scope information to work properly (thinking about C++ name qualification and other nasty things)
It does fail on dangling AST pieces.

A workaround it is
1)to call it AFTER the AST pieces are attached to somewhere.
2) call other member functions like ->class_name(), ->get_name() etc for debugging.

We had discussion to relax it to handle partial AST. But it never made into our priority list.

Leo
On 08/16/2012 05:10 PM, Chuck Zhao wrote:
> Quite often I ran into issues when trying to call unparseToString() of
> any SgNode * or its sub type inside DGB,
>
> This is especially important when a new SgNode * is just created, and
> not linked into the AST yet.
>
> If I want to know what a SgNode * (or any type of its sub node *) holds
> at runtime, what is the right approach?
>
> Thank you
>
> Chuck
>
> --------------------------------------------------------------------------------------------------------------------------------------------
> (gdb) p newbody->unparseToString()
> Note: found IR node where parent was not set = 0xc95950 = SgBasicBlock
> (may not be required)
> Inside of Sg_File_Info::display(Location of problematic IR node)
>        isTransformation                      = true (part of a
> transformation)
>        isCompilerGenerated                   = false
>        isOutputInCodeGeneration              = true (output in code
> generator)
>        isShared                              = false
>        isFrontendSpecific                    = false
>        isSourcePositionUnavailableInFrontend = false
>        isCommentOrDirective                  = false
>        isToken                               = false
> Error: SgStatement has NULL parent at node = 0xc95950 = SgBasicBlock
> Inside of Sg_File_Info::display(Error: SgStatement has NULL parent)
>        isTransformation                      = true (part of a
> transformation)
>        isCompilerGenerated                   = false
>        isOutputInCodeGeneration              = true (output in code
> generator)
>        isShared                              = false
>        isFrontendSpecific                    = false
>        isSourcePositionUnavailableInFrontend = false
>        isCommentOrDirective                  = false
>        isToken                               = false
> snplcc: Cxx_Grammar.C:67865: virtual SgScopeStatement*
> SgStatement::get_scope() const: Assertion `stmt->get_parent() != __null'
> failed.
>
> Program received signal SIGABRT, Aborted.
> 0x00002aaaafe6aa75 in *__GI_raise (sig=<value optimized out>) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> 64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
>           in ../nptl/sysdeps/unix/sysv/linux/raise.c
> The program being debugged was signaled while in a function called from GDB.
> GDB remains in the frame where the signal was received.
> To change this behavior use "set unwindonsignal on".
> Evaluation of the expression containing the function
> (SgNode::unparseToString() const) will be abandoned.
> When the function is done executing, GDB will silently stop.
> (gdb)
>
>
> _______________________________________________
> rose-public mailing list
> rose-public at nersc.gov



More information about the rose-public mailing list