Hui,

We discussed the topic of line numbers within the group the last time you 
raised it and did not have consensus to make any changes. The topic is still 
open.

Meanwhile...

* Have you compiled with --preserve-inlined-line-numbers ? What do you get?

* Currently to get debug info for an inlined function, I can only suggest to remove the 
"inline" mark on those functions. (This won't work on parallel iterators.)

* I am attaching a patch I developed at that time, you could try it out. A 
piece of it may already be on master.

Vassily

On 03/18/16 14:03, Hui Zhang wrote:
Hello,

I found the debug information of inlined functions in Chapel program
missing.
All the code inside an inlined func has the same line# info as this
function call inside its caller. .e.g:
foo call bar, bar is inlined, the debug info of foo is like below:
foo(){
    foo:line 1;
    foo:line 2;
​   foo:line 3;
    ...
}​

i*nstead of *
foo(){
    foo:line 1;
    foo:line 2;
​     bar:line 1;
      bar:line 2;
      bar: line 3;
       ....
    ...
}​

And there is no debug info(no such symbol at all) for function bar, is
there anyway that debug info can include the inlined funcs in Chapel ?

Thanks



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140



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

diff --git compiler/AST/astutil.cpp compiler/AST/astutil.cpp
--- compiler/AST/astutil.cpp
+++ compiler/AST/astutil.cpp
@@ -244,6 +244,14 @@
   AST_CHILDREN_CALL(destNode, reset_ast_loc, astlocArg);
 }
 
+void reset_ast_loc_if_needed(FnSymbol* ref, BaseAST* dest, Expr* source) {
+  if (!preserveInlinedLineNumbers &&
+      (ref->hasFlag(FLAG_FIELD_ACCESSOR) ||
+       ref->hasFlag(FLAG_INVISIBLE_FN)   ||
+       ref->getModule()->modTag != MOD_USER))
+    reset_ast_loc(dest, source);
+}
+
 
 void compute_call_sites() {
   forv_Vec(FnSymbol, fn, gFnSymbols) {
diff --git compiler/include/astutil.h compiler/include/astutil.h
--- compiler/include/astutil.h
+++ compiler/include/astutil.h
@@ -58,6 +58,7 @@
 // utility routines for clearing and resetting lineno and filename
 void reset_ast_loc(BaseAST* destNode, astlocT astloc);
 void reset_ast_loc(BaseAST* destNode, BaseAST* sourceNode);
+void reset_ast_loc_if_needed(FnSymbol* ref, BaseAST* dest, Expr* source);
 
 // compute call sites FnSymbol::calls
 void compute_call_sites();
diff --git compiler/optimizations/inlineFunctions.cpp compiler/optimizations/inlineFunctions.cpp
--- compiler/optimizations/inlineFunctions.cpp
+++ compiler/optimizations/inlineFunctions.cpp
@@ -73,8 +73,7 @@
   // copy function body, inline it at call site, and update return
   //
   BlockStmt* block = fn->body->copy(&map);
-  if (!preserveInlinedLineNumbers)
-    reset_ast_loc(block, call);
+  reset_ast_loc_if_needed(fn, block, call);
   CallExpr* return_stmt = toCallExpr(block->body.last());
   if (!return_stmt || !return_stmt->isPrimitive(PRIM_RETURN))
     INT_FATAL(call, "function is not normalized");
diff --git compiler/resolution/lowerIterators.cpp compiler/resolution/lowerIterators.cpp
--- compiler/resolution/lowerIterators.cpp
+++ compiler/resolution/lowerIterators.cpp
@@ -1174,16 +1174,13 @@
 
     Symbol*       index = forLoop->indexGet()->var;
     BlockStmt*    ibody = iterator->body->copy();
-    std::vector<BaseAST*> asts;
-
-    bool isOrderIndependent = forLoop->isOrderIndependent();
-    if (preserveInlinedLineNumbers == false) {
-      reset_ast_loc(ibody, forLoop);
-    }
+    reset_ast_loc_if_needed(iterator, ibody, forLoop);
 
     // and the entire for loop block is replaced by the iterator body.
     forLoop->replace(ibody);
 
+    bool isOrderIndependent = forLoop->isOrderIndependent();
+
     // if the loop being expanded was order independent, all of the yielding
     // loops in the body are also order independent. Note that this must occur
     // after the ibody replaces the forLoop since findEnclosingLoop() requires
@@ -1209,6 +1206,7 @@
     // the yielded index for the iterator formal.
     expandBodyForIteratorInline(forLoop, ibody, index);
 
+    std::vector<BaseAST*> asts;
     collect_asts(ibody, asts);
 
     replaceIteratorFormalsWithIteratorFields(iterator, ic, asts);
@@ -1303,6 +1301,7 @@
         if (!fcopy) {
           // Clone the function. Just once per 'body' should suffice.
           fcopy = cfn->copy();
+          reset_ast_loc_if_needed(cfn, fcopy, call);
 
           // Note that 'fcopy' will likely get a copy of 'body',
           // so we need to preserve correct scoping of its SymExprs.
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to