View Single Post
Old 17 May 2019, 01:23   #1
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 118
Debug: evaluate a variable built with vbcc

I'm working on the amiga assembly extension for visual studio code.
I've added a feature to step and stop on breakpoints in C code. So it's possible to debug C and ASM in the same editor.

I would like to add the possibility to evaluate a C variable.
Someone has a clue to achieve that ?

My simple program:
Code:
#include <stdio.h>

extern int mul_by_ten(short input);

int main()
{
    short i;
    char* s="My Text";

    for (i = 0; i < 10; i++)
    {
        printf("Line %d\n", i);
        printf("10 * %d = %d\n", i, mul_by_ten(i));
        printf("--------\n");
    }

    return 0;
}

 }
Disassembled
Code:
c14234: 48 e7 20 20               movem.l   d2/a2, -(a7)
c14238: 45 fa 00 7a               lea.l     $94(pc), a2
c1423c: 74 00                     moveq     #$0, d2
c1423e: 60 3e                     bra.b     $5e
c14240: 30 02                     move.w    d2, d0
c14242: 48 c0                     ext.l     d0
c14244: 2f 00                     move.l    d0, -(a7)
c14246: 48 7a 00 44               pea.l     $6c(pc)
c1424a: 4e b9 00 c1 4b 1c         jsr       $c14b1c.l
c14250: 30 02                     move.w    d2, d0
c14252: 48 c0                     ext.l     d0
c14254: 2f 00                     move.l    d0, -(a7)
c14256: 4e b9 00 c0 2f f0         jsr       $c02ff0.l
c1425c: 2f 00                     move.l    d0, -(a7)
c1425e: 30 02                     move.w    d2, d0
c14260: 48 c0                     ext.l     d0
c14262: 2f 00                     move.l    d0, -(a7)
c14264: 48 7a 00 32               pea.l     $78(pc)
c14268: 4e b9 00 c1 4b 1c         jsr       $c14b1c.l
c1426e: 48 7a 00 38               pea.l     $88(pc)
c14272: 4e b9 00 c1 42 bc         jsr       $c142bc.l
c14278: 4f ef 00 1c               lea.l     $1c(a7), a7
c1427c: 52 42                     addq.w    #$1, d2
c1427e: b4 7c 00 0a               cmp.w     #$a, d2
c14282: 6d bc                     blt.b     $20
c14284: 70 00                     moveq     #$0, d0
c14286: 4c df 04 04               movem.l   (a7)+, d2/a2
c1428a: 4e 75                     rts
How do I know that 'i' is in d2?
How do I know the address of 's'?
prb28 is offline  
 
Page generated in 0.04233 seconds with 11 queries