From e2bbe8e9c2b77af0b974ba1c4895b63a46aab44e Mon Sep 17 00:00:00 2001 From: Zeex Date: Mon, 1 Sep 2014 19:01:16 +0700 Subject: [PATCH] Add #emit line numbers to debug info If you consider the following code: 1 #include 2 3 main() { 4 new x; 5 #emit halt 1 6 #emit halt 2 7 #emit halt 3 8 return 1; 9 } This is what pawndisasm would output before: 00000008 proc 1.pwn:3 0000000c break 1.pwn:4 00000010 break 00000014 stack fffffffc 0000001c zero.pri 00000020 stor.s.pri fffffffc 00000028 halt 00000001 00000030 halt 00000002 00000038 halt 00000003 1.pwn:8 00000040 break 00000044 const.pri 00000001 0000004c stack 00000004 00000054 retn Now it outputs this: 00000008 proc 1.pwn:3 0000000c break 1.pwn:4 00000010 break 00000014 stack fffffffc 0000001c zero.pri 00000020 stor.s.pri fffffffc 1.pwn:5 00000028 halt 00000001 1.pwn:6 00000030 halt 00000002 1.pwn:7 00000038 halt 00000003 1.pwn:8 00000040 break 00000044 const.pri 00000001 0000004c stack 00000004 00000054 retn --- source/compiler/sc2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 1301724..93d321e 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -1232,6 +1232,7 @@ static int command(void) /* write opcode to output file */ char name[40]; int i; + insert_dbgline(fline); while (*lptr<=' ' && *lptr!='\0') lptr++; for (i=0; i<40 && (isalpha(*lptr) || *lptr=='.'); i++,lptr++)