Comments (3)
Hi,
This is not what traceback is meant for. Traceback is used internally to give a return stacktrace upon an unhandled exception. Although I think it should work that way too (but there is an abort at the end of traceback that makes it less useful in your scenario).
For example:
(stack) exception: EXC
(stack) : w1 EXC throw ;
(stack) : w2 w1 ;
(stack) : w3 w2 ;
(stack) : w4 w3 ;
(stack) : w5 w4 ;
(stack)
(stack) w5
Exeption: EXC rdepth: 9
at unhandled (140296)
at throw (140488)
at w1 (148484)
at w2 (148508)
at w3 (148528)
at w4 (148548)
w5 is not visible in the trace for some reason, this is probably a bug that need to be investigated.
If I add some nested calls to your example it works but has the same problem.
(stack) exception: EXC
(stack)
(stack) : w1 EXC traceback ;
(stack) : w2 w1 ;
(stack) : w3 w2 ;
(stack) : w4 w3 ;
(stack) : w5 w4 ;
(stack)
(stack) w5
Exeption: EXC rdepth: 7
at w1 (148484)
at w2 (148508)
at w3 (148528)
at w4 (148548)
The reason for not working this with only one call might be the same that causes that the last call is not visible in the nested case. I'll take a look at the problem more deeply sometime later.
from punyforth.
The problem is that w5 is called from the outer interpreter by an execute primitive that doesn't pushes down any return address to the rstack. I'll think about how to fix this.
from punyforth.
I modified the traceback word a bit. Now it gives the following output for this code
exception: E
: a 10 0 do i 5 = if E throw then loop ;
: b a ;
: c b ;
: d c ;
: e d ;
e
Exeption: E rdepth: 10
at throw (1073648592)
at a (1073653432)
at ??? (5)
at ??? (10)
at b (1073653500)
at c (1073653520)
at d (1073653540)
at e (1073653560)
This is the correct trace. As you can see now, the call ('e') is presented in the stack trace. (the number 5 and 10 are the loop variables).
Without nested calls:
exception: EXC : test-trace EXC throw ; test-trace
Exeption: EXC rdepth: 4
at throw (1073648592)
at test-trace (1073653388)
The usage of the traceback word might be revised in the future because currently it's not that useful from a user perspective.
from punyforth.
Related Issues (20)
- Complete word list with usage HOT 2
- Just for fun
- Mistype in README.md HOT 1
- A new fast flash utility HOT 1
- An interesting bug in the example dht22-data-loger or in netcon?
- highbit HOT 6
- Seriously? Python?
- Contributions HOT 2
- Convert flash.py to python3 HOT 1
- Flash starts but doesn't finish properly HOT 5
- Different speeds for multiple motors
- Word Glossary I have written HOT 3
- TASKS - when restarting a task, the data and return stack are not empty HOT 1
- Connected but no sending from the terminal HOT 1
- port on ESP-01 ? HOT 1
- Can TCP REPL eval be replicated using just strings? HOT 2
- TCP-REPL triggers ESP8266 Restart? HOT 3
- Receiving binary data via UDP
- This line should be.... .int xt_drop2
- Feature request: forth repl on tcp/ip or i2c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from punyforth.