-
-
Save HenrikBengtsson/34d9338848abc9e00731b3e2f584bdb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- R-3.2.1/src/main/memory.c.orig 2015-07-31 23:15:07.017151621 -0700 | |
+++ R-3.2.1/src/main/memory.c 2015-07-31 23:17:10.185150073 -0700 | |
@@ -3724,11 +3724,21 @@ | |
static FILE *R_MemReportingOutfile; | |
static R_size_t R_MemReportingThreshold; | |
+static void printLineNum(FILE *file, SEXP srcref) { | |
+ if (srcref && !isNull(srcref)) { | |
+ int line = asInteger(srcref); | |
+ fprintf(file, "#%d ", line); | |
+ } else { | |
+ fprintf(file, " "); | |
+ } | |
+} | |
+ | |
static void R_OutputStackTrace(FILE *file) | |
{ | |
int newline = 0; | |
RCNTXT *cptr; | |
+ SEXP srcref = R_Srcref; | |
for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) { | |
if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN)) | |
&& TYPEOF(cptr->call) == LANGSXP) { | |
@@ -3737,6 +3747,8 @@ | |
fprintf(file, "\"%s\" ", | |
TYPEOF(fun) == SYMSXP ? CHAR(PRINTNAME(fun)) : | |
"<Anonymous>"); | |
+ printLineNum(file, srcref); | |
+ srcref = cptr->srcref; | |
} | |
} | |
if (newline) fprintf(file, "\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment