-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add Dart API method for getting current stack trace. #2573
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
Comments
This comment was originally written by [email protected] Looks like Dart_GetStackTrace works only from breakpoint handler. To properly implement console.log we need a function that returns current stack trace when vm is not actually paused, like v8::StackTrace::CurrentStackTrace does. Matthias, could you please fix the Dart_GetStackTrace function so that it works from arbitrary embedder's callback? Added Triaged label. |
This comment was originally written by [email protected] Why do we need to stop the VM from another thread to get current stack trace of an isolate in a native function? Here is some context: In c++: Here is a very rough implementation of what is needed https://chromiumcodereview.appspot.com/10808032/. Sorry for not stating the problem clearly from the beginning. |
This comment was originally written by @mhausner You want a stack trace of an isolate that is "not actually paused" as you say above. I interpret this as "an isolate that is currently running code". That's why I said we need a way to stop the isolate to collect the stack trace. If you are talking about an isolate that is not currently running (but not paused), then it's easier. But in that case, the stack is empty, isn't it? I still don't know what exactly it is you would like to have... |
This comment was originally written by [email protected] Why do you expect the stack trace to be empty while executing a c++ calback? There should always be at least one dart frame which invoked the native function. |
This comment was originally written by [email protected] Issue #5851 has been merged into this issue. |
This comment was originally written by [email protected] Marked this as blocking #5851. |
Removed Priority-Medium label. |
Removed this from the Later milestone. |
Do I understand this request as equivalent to calling this helper method in Dart from a native method? _getStackTrace() { cc @a-siva. |
Siva, this request came from Dartium land. Is this still an issue? |
Unmarked this as blocking #5851. |
Removed debugger label. |
This isn't a high priority Dartium issue at the moment. It would be nice if we had direct support like V8 does. Dart_ExceptionPauseInfo previousPauseInfo = Dart_GetExceptionPauseInfo(); if (previousPauseInfo != kNoPauseOnExceptions) |
I'm wondering if we can revisit the decision to not do this- the primary issue that I see is that relying on throwing exceptions causes issues with 'break on all exceptions'. For example, Angular tests log the stack trace with all injections (https://github.com/angular/angular.dart/blob/9d190120f329bb766c7291dd96eb2f62b23f6f2f/lib/mock/test_injection.dart#L84), which throws hundreds of exceptions on start. This makes it incredibly difficult to debug these tests. In JS, this can be accomplished by using 'new Error().stack' |
This bug is for a request to provide a mechanism for getting a stack trace from the C/C++ Dart API. The example you have above with the Angular test case is more a request for a stacktrace from Dart code. I think you should redirect that to the library team. |
> git log --oneline 04b054b62cc437cf23451785fdc50e49cd9de139..master 0d185a39 (HEAD -> master, origin/master, origin/HEAD) Push null-safety forwards to 2.11 (#2604) 56f9f27f Hide outdated --mode flag (#2603) 61ce6f81 Avoid double loop (#2605) fa6e57d7 (disable_mixed_mode_validation) Fix outdated latest ordering (#2598) 6549e4aa Remove unused dependency from pubspec.yaml (#2592) 61543d07 Don't look for external package foo during testing (#2599) 590b448f Fixed license headers (#2595) 04e0601e Don't show entries for dev-dependencies in outdated --json --no-dev-dependencies (#2591) 8c3778c4 Configure GitHub move app (#2578) eec7beca (top_level_command) Pass --(no-)sound-null-safety arg through to VM. (#2542) 152e4740 Warn about publishing in mixed mode (#2583) 0b7a3abe Removed april fools toys (#2325) b74a5b73 Actually print hints (#2582) 8ec3a66d (pub2) Fix outdated --no-color (#2572) 7bb3d4e6 Use getSdkPath() in NullSafetyAnalysis (#2573) 3c578f24 Drop the "magic" package concept (#2577) 0e967ff0 Remove unused function (#2570) 988fefef Remove dependency overrides (#2568) Change-Id: I58bf14234ed55bf9d825de60a40ded1d65281195 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158003 Reviewed-by: Jonas Jensen <[email protected]> Commit-Queue: Sigurd Meldgaard <[email protected]>
This issue was originally filed by [email protected]
This is needed to implement console.trace() which dumps current stack trace to inspector console.
The text was updated successfully, but these errors were encountered: