[gnome-shell] main: add logStackTrace(), for debugging
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] main: add logStackTrace(), for debugging
- Date: Wed, 20 Jul 2011 19:45:54 +0000 (UTC)
commit 4405d993c983a9735c68d4be596e00e1b3b4d9b9
Author: Dan Winship <danw gnome org>
Date: Wed Jul 20 13:45:31 2011 -0400
main: add logStackTrace(), for debugging
Add Main.logStackTrace(), to print a (javascript) stack trace, which
is often useful when debugging.
https://bugzilla.gnome.org/show_bug.cgi?id=654987
js/ui/main.js | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 6cb58fd..47f6af2 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -486,6 +486,18 @@ function _getAndClearErrorStack() {
return errors;
}
+function logStackTrace(msg) {
+ try {
+ throw new Error();
+ } catch (e) {
+ // e.stack must have at least two lines, with the first being
+ // logStackTrace() (which we strip off), and the second being
+ // our caller.
+ let trace = e.stack.substr(e.stack.indexOf('\n') + 1);
+ log(msg ? (msg + '\n' + trace) : trace);
+ }
+}
+
function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) {
return win.get_workspace() == workspaceIndex ||
(win.get_meta_window() && win.get_meta_window().is_on_all_workspaces());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]