Debug stacktrace?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Debug stacktrace?
Hi all,
Just wondering if the stack trace (you know, that long incomprehensible text the OS serves up on a crash) can be accessed with LiveCode?
Many thanks
Stam
Just wondering if the stack trace (you know, that long incomprehensible text the OS serves up on a crash) can be accessed with LiveCode?
Many thanks
Stam
-
- Livecode Opensource Backer
- Posts: 10115
- Joined: Fri Feb 19, 2010 10:17 am
Re: Debug stacktrace?
Recently I was merrily crashing an "alternative IDE" during what is called 'beta testing', but more accurately should be termed 'cursing, crying, and clamping one's mouth shut' on both MacOS 12 and MacOS 15 beta: the crash 'thing' was presented in a window that allowed it to be copy-pasted into a text document.
Therefore I would assume, on MacOS at least. that that 'thing' is stored somewhere as a text document (especially as the crash window said it would be sent to Apple) . . .
So: the first thing has to be to work out WHERE that text document is stored and whether you have the necessary user permissions to access it.
After that everything should be all rather easy.
Therefore I would assume, on MacOS at least. that that 'thing' is stored somewhere as a text document (especially as the crash window said it would be sent to Apple) . . .
So: the first thing has to be to work out WHERE that text document is stored and whether you have the necessary user permissions to access it.
After that everything should be all rather easy.
-
- Livecode Opensource Backer
- Posts: 10115
- Joined: Fri Feb 19, 2010 10:17 am
Re: Debug stacktrace?
Oh, look: I used my brain and asked Google:
where does MacOS store crash reports?
and I got an answer:
where does MacOS store crash reports?
and I got an answer:
Rocket Science!crash log files are stored in the user's ~/Library/Logs/DiagnosticReports/ folder
-
- Livecode Opensource Backer
- Posts: 10115
- Joined: Fri Feb 19, 2010 10:17 am
Re: Debug stacktrace?
Obviously time to learn that 'без кавичките' means 'without quotation marks' in Bulgarian.

That's 'bez kavichkiteh' for those of you who cannot cope with non-Latin writing systems. बेवकूफों
- -
Re: Debug stacktrace?
Thanks Richmond, but that's not quite what I need. I am aware of the crash logs - but these are only generated on a hard crash.richmond62 wrote: ↑Fri Jun 28, 2024 10:07 amOh, look: I used my brain and asked Google:
where does MacOS store crash reports?
and I got an answer:
Rocket Science!crash log files are stored in the user's ~/Library/Logs/DiagnosticReports/ folder
As I don't want my apps to actually crash, my scripts of full of try/catch blocks to actually manage the errors without crashing, so such a log entry will not be created. But it would still be useful to have a picture of what's going on in the system.
In other languages this is possible - I was just wondering if anyone has done this in LiveCode.
I'm slowly working on an error-management solution for standalones, but like everything else, progress is slow as my day job is currently using 99% of my time... hopefully I'll post something more about this at some point.
Stam
-
- Livecode Opensource Backer
- Posts: 10115
- Joined: Fri Feb 19, 2010 10:17 am
Re: Debug stacktrace?
Doesn't that mean when the IDE crashes, and NOT something 'baby' like this:that long incomprehensible text the OS serves up on a crash
-
Re: Debug stacktrace?
a stack trace is a picture of what is in memory at the time (the stack refers to dynamically allocated memory - nothing to do with LC stacks - as opposed to memory in the heap) - this does not need to related to error/hang/crash although typically the OS will generate a stack trace on crash.richmond62 wrote: ↑Fri Jun 28, 2024 12:12 pmDoesn't that mean when the IDE crashes, and NOT something 'baby' like this:that long incomprehensible text the OS serves up on a crash
-
SShot 2024-06-28 at 14.11.24.png
It's not about putting a livecode error into a text box or generating an individual log for that one app running but of course that would be the main thing to address anyway, and there are elegant methods for doing this.
I was hoping there was a way to getting to a stack trace via livecode, but it's not the end of the world if not.
I'll post more about this in the future when I've had more time to work on something I'm doing for this...
-
- Livecode Opensource Backer
- Posts: 10115
- Joined: Fri Feb 19, 2010 10:17 am
Re: Debug stacktrace?
https://stackoverflow.com/questions/222 ... -exception
"In program debugging, a stack trace is a report of the computer's internal processing operations. It generally identifies the last routine called in the program before it crashed."
Aha: well, there must be somewhere that stack trace is stored.
viewtopic.php?f=7&t=7950
"In program debugging, a stack trace is a report of the computer's internal processing operations. It generally identifies the last routine called in the program before it crashed."
Aha: well, there must be somewhere that stack trace is stored.
viewtopic.php?f=7&t=7950
-
- VIP Livecode Opensource Backer
- Posts: 10054
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Debug stacktrace?
System calls are useful for system programmers, script execution details more useful for scripters.
There are likely low-level system call tracers for macOS, to strace on Linux. But if scripting is your focus:
LC's Message Watcher kind of attempts the latter, but has been largely unchanged since Dr Raney made it decades ago, with an output format that's not very useful.
Many years ago I made 4W Flight Recorder to obtain a list of all handlers triggered in the calling chain while I'm using my apps. The format is indented with initial ystem message from the triggering user action leftmost, everything called from that cascading indented below, allowing easy skimming/reading.
It also allows filters so things like IDE message and the nearly-constant stream of mousemove messages aren't littering the list.
As a bonus it also keeps track of relative time spent in each handler, providing reasonable profiling.
4W Flight Recorder is available in the IDE via LiveNet. See Development -> Plugins -> GoLiveNet, and in the LiveNet window see the Stacks section.
There are likely low-level system call tracers for macOS, to strace on Linux. But if scripting is your focus:
LC's Message Watcher kind of attempts the latter, but has been largely unchanged since Dr Raney made it decades ago, with an output format that's not very useful.
Many years ago I made 4W Flight Recorder to obtain a list of all handlers triggered in the calling chain while I'm using my apps. The format is indented with initial ystem message from the triggering user action leftmost, everything called from that cascading indented below, allowing easy skimming/reading.
It also allows filters so things like IDE message and the nearly-constant stream of mousemove messages aren't littering the list.
As a bonus it also keeps track of relative time spent in each handler, providing reasonable profiling.
4W Flight Recorder is available in the IDE via LiveNet. See Development -> Plugins -> GoLiveNet, and in the LiveNet window see the Stacks section.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Debug stacktrace?
Thanks Richard -- I am aware and use flight recorder.
But that can't be used with standalone apps to collect data from users in a sensible way.
Working on a solution having been inspired from something I recently came across - if it works will post on the forums...
S.
But that can't be used with standalone apps to collect data from users in a sensible way.
Working on a solution having been inspired from something I recently came across - if it works will post on the forums...
S.
-
- VIP Livecode Opensource Backer
- Posts: 10054
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Debug stacktrace?
Why not? It's just a stack with no dependencies. All you need it a way for your stack to open it, no?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Debug stacktrace?
Yeah you’re right - the script of this can be incorporated to derive a trail of livecode events that could be activated from where the user enters the handler, so it reports a list of events up to the crash - not sure how else this could be used.
I’m looking at creating a generalisable error reporting system for standalones, similar to what other platforms have. I’ll go into it in detail if this ever materialises, but an important part of this is viewing errors both at user level but more importantly as collated / grouped data.
The idea being that if the user does something unexpected and causes an error/crash (because users will always break your code), have some way of automating and collating crash data (ie if a particular error is reported 500 times, did 1 user cause 500 crashes or did 500 users experience 1 crash).
As far as I know there is no error management system like this for LC standalones - yes you can report individual errors, but that’s only usable if you have a small number of users and a small number of errors.
It would be very useful to include a breadcrumb trail like what flight recorder provides as well - I’ll see how that goes and might reach out if needed, if that’s OK.
The biggest hurdle is time which just seems to be less and less available :-/
I’m looking at creating a generalisable error reporting system for standalones, similar to what other platforms have. I’ll go into it in detail if this ever materialises, but an important part of this is viewing errors both at user level but more importantly as collated / grouped data.
The idea being that if the user does something unexpected and causes an error/crash (because users will always break your code), have some way of automating and collating crash data (ie if a particular error is reported 500 times, did 1 user cause 500 crashes or did 500 users experience 1 crash).
As far as I know there is no error management system like this for LC standalones - yes you can report individual errors, but that’s only usable if you have a small number of users and a small number of errors.
It would be very useful to include a breadcrumb trail like what flight recorder provides as well - I’ll see how that goes and might reach out if needed, if that’s OK.
The biggest hurdle is time which just seems to be less and less available :-/
-
- VIP Livecode Opensource Backer
- Posts: 10054
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Debug stacktrace?
The engine is the engine. Trace, debug, context details, all available. Sometimes folks make UIs for them and give them away, a window that can be opened like any other,
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn