π
<-

ICE Compiler

Assembleur, Axe, ICE, BBC Basic...

Re: ICE Compiler

The most important part of the debugger is pretty much ready: stepping through code! It was quite some work, but after all not very hard:

Huge thanks to Runer112 for helping with setting breakpoints and a breakpoint handler!
Age of CEmpires I - In progress!
40%

PT_Prog.

Niveau 13: CU (Calculateur Universel)
Prochain niv.: 51.1%

Messages: 257
Inscription: 09 Fév 2016, 23:06
Genre:
Calculatrice(s):

Re: ICE Compiler

Welp, I need some help with the debugger, stepping through subprograms and stuff Runer and I tried some methods, but they all had huge drawbacks, and I'm not sure if there's a better way to do this:

When the debugger is called, I can get the global number (global = all (sub)programs combined in a large program) using the return address. When the user selects "Step through code", it needs to display the proper program and line. However, global line number != line number in correct program if you have some subprograms, so that's where problems arise. ICE outputs all the (sub)programs during prescanning, as well as the global start line, global end line and the depth of the subprogram (main program = 1, subprogram = 2, subsubprogram = 3 etc..).

My current method to select the right program and line is this: loop through all programs backwards, and the first program that matches startLine <= global line <= endLine is the right program (that is always true). Getting the
local
line number is quite harder. I have to loop through all subprograms with the depth being equal to inputDepth + 1 (so get all the subprograms from that program), and substract the amount of lines from the input line, as well as the startLine. See this:
Code: Tout sélectionner
                Line:   Line in prog:A[i]B            1       (1 - 1) = 0dbd(0           2       (2 - 1) = 13->A            3       (3 - 1) = 2AsmComp(C       4       (4 - 1) = 3AsmComp(F       14      (14 - 1) - (13 - 5 + 1) = 43->A            18      (18 - 1) - (13 - 5 + 1) - (17 - 15 + 1) = 5C[i]B            5       (5 - 5) = 09->B            6       (6 - 5) = 1AsmComp(D       7       (7 - 5) = 210->B           13      (13 - 5) - (12 - 8 + 1) = 3D[i]B            8       (8 - 8) = 0AsmComp(E       9       (9 - 8) = 15->D            12      (12 - 8) - (11 - 10 + 1) = 2E[i]B            10      (10 - 10) = 03->F            11      (11 - 10) = 1F[i]B            15      (15 - 15) = 0dbd(0           16      (16 - 15) = 15->G            17      (17 - 15) = 2

This method is currently up and running (it was pretty hard though!). However, this is still far from done. When displaying the program it also shows you the breakpoints. Thus, for each line in the program, I have to get the global number and check if a breakpoint is placed at that line. However, this part is almost impossible. I can't get the right global line number where it starts drawing, unless I want to loop through all programs ~25 times when displaying the program and that doesn't seem right to me. If this is already done, I also need to add setting/removing a breakpoint, which is pretty much the same idea, so yeah.

Runer had another idea where the first program gets lines 1-X, the first subprogram X+1-Y, the second Y+1-Z etc. This has the disadvantage that you have to loop through all single lines to see where the call address matched. Also, placing a breakpoint on the next line would be much harder.

Is there anyone with a better idea? ICE can output many things related to subprograms, so that is not the problem. The debugger only gets the call address where it can get the global line number from, but that's it.
Age of CEmpires I - In progress!
40%

PT_Prog.

Niveau 13: CU (Calculateur Universel)
Prochain niv.: 51.1%

Messages: 257
Inscription: 09 Fév 2016, 23:06
Genre:
Calculatrice(s):

Re: ICE Compiler

I've updated the documentation! Everything can be found on the Github Wiki, and everything will be converted into a single HTML documentation, replacing the old pdf file. Check it out, I'd love to hear feedback!

Age of CEmpires I - In progress!
40%

PT_Prog.

Niveau 13: CU (Calculateur Universel)
Prochain niv.: 51.1%

Messages: 257
Inscription: 09 Fév 2016, 23:06
Genre:
Calculatrice(s):

Re: ICE Compiler

Ah nice - and the wiki being a git repo itself, the doc can be versioned

Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 42.2%

Messages: 12048
Images: 847
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre:
Calculatrice(s):
Classe: (ingénieur)

Précédente

Retourner vers Langages alternatifs

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités

-
Rechercher
-
Sujets à la une
12345
-
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...

Découvrez les avantages d'un compte donateur !

Partenaires et pub

-
Stats.
583 utilisateurs:
>489 invités
>89 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
(English / Français)
Banque de programmes TI
ticalc.org
(English)
La communauté TI-82
tout82.free.fr
(Français)