drops and reorders
[nedit-bw.git] / InterpretDebug5-fix-stackDumpStr.diff
blobedbae0b40e35ddd44794e0352ea647d21da53cca
1 ---
3 source/interpret.c | 19 +++++++++++++------
4 1 file changed, 13 insertions(+), 6 deletions(-)
6 diff --quilt old/source/interpret.c new/source/interpret.c
7 --- old/source/interpret.c
8 +++ new/source/interpret.c
9 @@ -3106,6 +3106,7 @@ static char *stackDumpStr(DataValue *fp,
10 const char *op;
11 char *np;
12 DataValue *nfp = fp;
13 + Inst *pc;
15 #ifdef DEBUG_STACK
16 const char *dump;
17 @@ -3117,9 +3118,12 @@ static char *stackDumpStr(DataValue *fp,
19 /* first measure the lengths */
20 len = strlen(msg) + 1;
21 - for (nfp = fp; nfp; nfp = FP_GET_OLD_FP(nfp)) {
22 + nfp = fp;
23 + do {
24 len = len + FP_GET_ITEM(nfp, FP_FUNCTION_NAME).val.str.len + 1;
25 - }
26 + pc = FP_GET_RET_PC(nfp);
27 + nfp = FP_GET_OLD_FP(nfp);
28 + } while (pc);
29 #ifdef DEBUG_STACK
30 len += strlen(dump);
31 #endif
32 @@ -3134,12 +3138,15 @@ static char *stackDumpStr(DataValue *fp,
33 while (*op)
34 *np++ = *op++;
36 - for (nfp = fp; nfp; nfp = FP_GET_OLD_FP(nfp)) {
37 + nfp = fp;
38 + do {
39 *np++ = '\n';
40 op = FP_GET_ITEM(nfp, FP_FUNCTION_NAME).val.str.rep;
41 while (*op)
42 *np++ = *op++;
43 - }
44 + pc = FP_GET_RET_PC(nfp);
45 + nfp = FP_GET_OLD_FP(nfp);
46 + } while (pc);
47 #ifdef DEBUG_STACK
48 op = dump;
49 while (*op)
50 @@ -3427,8 +3434,8 @@ static void disasm(Inst *inst, int nInst
51 static void stackdumpframe(DataValue *arrow, DataValue *outpt, DataValue *fp,
52 DataValue *sp, char topMark)
54 - DataValue *baseF = &FP_GET_ITEM(fp, FP_OLD_FP_INDEX);
55 - DataValue *oldFP = baseF ? baseF->val.dataval : NULL;
56 + Inst *retPC = FP_GET_RET_PC(fp);
57 + DataValue *oldFP = retPC ? FP_GET_OLD_FP(fp) : NULL;
58 DataValue *arg1 = &FP_GET_ARG_N(fp, 0);
59 DataValue *fnNm = &FP_GET_ITEM(fp, FP_FUNCTION_NAME);
60 DataValue *dv;