Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question/suggestion] can print stack backtraces? #10

Open
atesin opened this issue Aug 19, 2022 · 0 comments
Open

[question/suggestion] can print stack backtraces? #10

atesin opened this issue Aug 19, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@atesin
Copy link

atesin commented Aug 19, 2022

hi.... could be a way to print something like a stack backtrace? ... i mean, a backward chain of function calls in a given point,,,, imagine something like

void setup(){
  Serial.begin(9600);
  subSetup1();
}

void loop(){
  subLoop1();
}

void subSetup(){
  STACK();
}

void subLoop1(){
  subLoop2();
}

void subLoop2()
  STACK("running");
  BREAK();
}

... that prints something like...

mySketch.ino:11: stack[0] "" = void subSetup()
mySketch.ino:3: stack[1] "" = void setup()
mySketch.ino:19: stack[0] "running" = void subLoop2()
mySketch.ino:15: stack[1] "running" = void subLoop1()
mySketch.ino:7: stack[2] "running" = void loop()

that will look like a collection of TRACE()'s... that would be very useful to follow the program flow and tracking back possible errors or understand the program better.... but i don't imagine how this could be achieved, i am not skilled in c/c++

i got the idea from java, where you can specifically print a backtrace anytime at will, and that backtrace contains all function calls from current point, passing by all involved functions, back to main() ... https://en.wikipedia.org/wiki/Stack_trace

@bblanchon bblanchon added the enhancement New feature or request label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants