π
<-
Chat plein-écran
[^]

ICE Compiler

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

Re: ICE Compiler

Unread postby 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%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: ICE Compiler

Unread postby 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: Select all
                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%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: ICE Compiler

Unread postby PT_ » 01 Dec 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%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: ICE Compiler

Unread postby Adriweb » 02 Dec 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...)
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 80.2%
 
Posts: 14613
Images: 1218
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Previous

Return to Langages alternatifs

Who is online

Users browsing this forum: No registered users and 10 guests

-
Search
-
Social TI-Planet
-
Featured topics
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
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1528 utilisateurs:
>1499 invités
>24 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)