π
<-
Chat plein-écran
[^]

ICE Compiler

Assembleur, Axe, C/C++, ICE...

Re: ICE Compiler

Message non lude PT_ » 19 Sep 2018, 20:29

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:

Image

Huge thanks to Runer112 for helping with setting breakpoints and a breakpoint handler!
Age of CEmpires I - In progress!
40%
Avatar de l’utilisateur
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Prochain niv.: 57.2%
 
Messages: 259
Inscription: 09 Fév 2016, 23:06
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: ICE Compiler

Message non lude PT_ » 02 Oct 2018, 11:38

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) = 0
dbd(0           2       (2 - 1) = 1
3->A            3       (3 - 1) = 2
AsmComp(C       4       (4 - 1) = 3
AsmComp(F       14      (14 - 1) - (13 - 5 + 1) = 4
3->A            18      (18 - 1) - (13 - 5 + 1) - (17 - 15 + 1) = 5

C
[i]B            5       (5 - 5) = 0
9->B            6       (6 - 5) = 1
AsmComp(D       7       (7 - 5) = 2
10->B           13      (13 - 5) - (12 - 8 + 1) = 3

D
[i]B            8       (8 - 8) = 0
AsmComp(E       9       (9 - 8) = 1
5->D            12      (12 - 8) - (11 - 10 + 1) = 2

E
[i]B            10      (10 - 10) = 0
3->F            11      (11 - 10) = 1

F
[i]B            15      (15 - 15) = 0
dbd(0           16      (16 - 15) = 1
5->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%
Avatar de l’utilisateur
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Prochain niv.: 57.2%
 
Messages: 259
Inscription: 09 Fév 2016, 23:06
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: ICE Compiler

Message non lude PT_ » 01 Déc 2018, 21:20

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! :)

Download ICE Compiler
Age of CEmpires I - In progress!
40%
Avatar de l’utilisateur
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Prochain niv.: 57.2%
 
Messages: 259
Inscription: 09 Fév 2016, 23:06
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: ICE Compiler

Message non lude Adriweb » 02 Déc 2018, 16:55

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

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80.2%
 
Messages: 14615
Images: 1218
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Précédente

Retourner vers Langages alternatifs

Qui est en ligne

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

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1236 utilisateurs:
>1209 invités
>23 membres
>4 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)