What tricks do people use to examine 'GenRet' structs when debugging
Chapel compiler's codegen in non-LLVM mode?
I noticed a couple of weird things:
* Printing <a GenRet value>.c.c_str() sometimes does not work:
.....
Run till exit from #0 baseASTCodegen (ast=0x1980bf0) at baseAST.cpp:415
Value returned is $9 = {c = {_M_dataplus = {<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data
fields>}, _M_p = 0xdc9a08 "rfun(&rGlob, iGlob)"}}, val = 0x0, type =
0x0, chplType = 0x85ed50, isLVPtr = 0 '\000', isUnsigned = false}
(gdb) p $9.c.c_str()
Attempt to take address of value not located in memory.
When/because that happens, I resort to printing <a GenRet
value>.c._M_dataplus._M_p. Other suggestions?
* GDB sometimes shows garbage in _M_p of a local 'ret' variable where it
should be legit. For example, at the end of this function:
GenRet SymExpr::codegen() {
GenInfo* info = gGenInfo;
FILE* outfile = info->cfile;
GenRet ret;
if( outfile ) {
if (getStmtExpr() && getStmtExpr() == this)
codegenStmt(this);
ret = var->codegen();
} else {
#ifdef HAVE_LLVM
.....
#endif
}
return ret;
}
I get:
(gdb) p ret.c._M_dataplus._M_p
$5 = 0x7fffffff1360 "(`\033\005"
However, when I type 'finish', the result is happy:
Run till exit from #0 SymExpr::codegen (this=0x1d535d0) at expr.cpp:305
baseASTCodegen (ast=0x1d535d0) at baseAST.cpp:415
Value returned is $6 = {c = {_M_dataplus = {<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data
fields>}, _M_p = 0x51b6028 "&this8"}}, val = 0x0, type = 0x0, chplType =
0x8592d0, isLVPtr = 1 '\001', isUnsigned = false}
(gdb)
i.e. _M_p is happy now. But then in the caller of the above, GenRet
baseASTCodegen(BaseAST* ast), _M_p is back to "(`\033\005".
Is this just a glitch with debugging info/symbols?
Vass
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers