author | mattman |
Mon, 28 Apr 2008 11:11:12 +0000 | |
changeset 12218 | 677915814a4f |
parent 12211 | 10f673786ff5 |
child 13341 | 846dca93b6b6 |
permissions | -rw-r--r-- |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
1 |
--- bug-buddy-2.22.0.old/src/bug-buddy.c 2008-04-28 11:59:20.005224000 +0100 |
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
2 |
+++ bug-buddy-2.22.0/src/bug-buddy.c 2008-04-28 12:00:04.933927000 +0100 |
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
3 |
@@ -963,19 +963,30 @@ |
10623 | 4 |
GtkTextView *text_view; |
5 |
GtkTextIter end; |
|
6 |
GtkTextBuffer *buffer; |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
7 |
+ char *gdb = g_find_program_in_path ("gdb"); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
8 |
+ char *pstack = g_find_program_in_path ("pstack"); |
10623 | 9 |
|
10 |
- /* FIXME: These strings are gdb specific, we should add here also dbx */ |
|
11 |
- const char *bt_step1 = "#1"; |
|
12 |
- const char *bt_step2 = "#2"; |
|
13 |
- const char *bt_step3 = "#3"; |
|
14 |
- |
|
15 |
- if (!g_strrstr (stacktrace, bt_step1) && |
|
16 |
- !g_strrstr (stacktrace, bt_step2) && |
|
17 |
- !g_strrstr (stacktrace, bt_step3)) { |
|
18 |
- return FALSE; |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
19 |
- } |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
20 |
- |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
21 |
- |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
22 |
+#if defined(sun) && defined(__SVR4) |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
23 |
+ if (pstack) { |
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
24 |
+ g_free (gdb); |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
25 |
+ gdb = NULL; |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
26 |
+ } |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
27 |
+#endif /* defined(sun) && defined(__SVR4) */ |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
28 |
+ |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
29 |
+ if (gdb) { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
30 |
+ /* FIXME: These strings are gdb specific, we should add here also dbx */ |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
31 |
+ const char *bt_step1 = "#1"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
32 |
+ const char *bt_step2 = "#2"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
33 |
+ const char *bt_step3 = "#3"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
34 |
+ |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
35 |
+ if (!g_strrstr (stacktrace, bt_step1) && |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
36 |
+ !g_strrstr (stacktrace, bt_step2) && |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
37 |
+ !g_strrstr (stacktrace, bt_step3)) { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
38 |
+ g_free (gdb); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
39 |
+ g_free (pstack); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
40 |
+ return FALSE; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
41 |
+ } |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
42 |
+ } |
10623 | 43 |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
44 |
text_view = GTK_TEXT_VIEW (gtk_builder_get_object (ui, "gdb-text")); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
45 |
buffer = gtk_text_view_get_buffer (text_view); |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
46 |
@@ -984,6 +995,8 @@ |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
47 |
/* add the stacktrace to the GtkTextView */ |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
48 |
gtk_text_buffer_insert (buffer, &end, stacktrace, strlen (stacktrace)); |
10623 | 49 |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
50 |
+ g_free (gdb); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
51 |
+ g_free (pstack); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
52 |
return TRUE; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
53 |
} |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
54 |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
55 |
--- bug-buddy-2.22.0.old/src/gdb-buddy.c 2008-04-28 11:59:20.026360000 +0100 |
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
56 |
+++ bug-buddy-2.22.0/src/gdb-buddy.c 2008-04-28 12:01:31.033484000 +0100 |
10387 | 57 |
@@ -191,11 +191,9 @@ |
58 |
GIOChannel *ioc; |
|
6182 | 59 |
GError *error = NULL; |
10387 | 60 |
GdbData *gdb_data = NULL; |
6182 | 61 |
- char *args[] = { "gdb", |
62 |
- "--batch", |
|
63 |
- "--quiet", |
|
64 |
- "--command=" BUDDY_DATADIR "/gdb-cmd", |
|
65 |
- NULL, NULL, NULL }; |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
66 |
+ char *args[7]; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
67 |
+ char *gdb = NULL; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
68 |
+ char *pstack = NULL; |
10387 | 69 |
|
70 |
g_return_val_if_fail (app != NULL, 0); |
|
71 |
g_return_val_if_fail (*app != '\0', 0); |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
72 |
@@ -206,6 +204,28 @@ |
10387 | 73 |
|
74 |
d (g_print ("app=%s\n", app)); |
|
75 |
||
11198
02b533546498
* patches/bug-buddy-01-use-pstack.diff : Update #define check
mattman
parents:
10623
diff
changeset
|
76 |
+#if defined(sun) && defined(__SVR4) |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
77 |
+ pstack = g_find_program_in_path ("pstack"); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
78 |
+ if (pstack) { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
79 |
+ args[0] = pstack; |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
80 |
+ args[2] = args[3] = args[4] = args[5] = args[6] = NULL; |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
81 |
+ } else { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
82 |
+ gdb = g_find_program_in_path ("gdb"); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
83 |
+ args[0] = gdb; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
84 |
+ args[1] = "--batch"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
85 |
+ args[2] = "--quiet"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
86 |
+ args[3] = "--command=" BUDDY_DATADIR "/gdb-cmd"; |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
87 |
+ args[4] = args[5] = args[6] = NULL; |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
88 |
+ } |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
89 |
+#else |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
90 |
+ gdb = g_find_program_in_path ("gdb"); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
91 |
+ args[0] = gdb; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
92 |
+ args[1] = "--batch"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
93 |
+ args[2] = "--quiet"; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
94 |
+ args[3] = "--command=" BUDDY_DATADIR "/gdb-cmd"; |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
95 |
+ args[4] = args[5] = args[6] = NULL; |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
96 |
+#endif /* defined(sun) && defined(__SVR4) */ |
10387 | 97 |
+ |
98 |
/* apply a SIGCONT to the process */ |
|
99 |
kill (pid, SIGCONT); |
|
6182 | 100 |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
101 |
@@ -226,33 +246,41 @@ |
10387 | 102 |
if (!long_app) { |
103 |
g_set_error (err, GDB_BUDDY_ERROR, GDB_BUDDY_BINARY_NOT_FOUND, |
|
104 |
_("The binary file could not be found. Try using an absolute path.")); |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
105 |
+ g_free (args[0]); |
10387 | 106 |
return 0; |
6182 | 107 |
} |
108 |
||
109 |
- args[0] = g_find_program_in_path ("gdb"); |
|
110 |
- args[4] = long_app; |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
111 |
+ if (!pstack) |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
112 |
+ args[4] = long_app; |
6182 | 113 |
|
10387 | 114 |
if (args[0] == NULL) { |
6182 | 115 |
d(g_message ("Path: %s", getenv ("PATH"))); |
10387 | 116 |
g_free (long_app); |
117 |
g_set_error (err, GDB_BUDDY_ERROR, GDB_BUDDY_GDB_NOT_FOUND, |
|
118 |
- _("GDB could not be found on your system. " |
|
119 |
- "Debugging information will not be obtained.")); |
|
120 |
+ _("%s could not be found on your system. " |
|
121 |
+ "Debugging information will not be obtained."), |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
122 |
+ pstack != NULL ? "pstack" : "gdb"); |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
123 |
+ g_free (args[0]); |
10387 | 124 |
return 0; |
125 |
} |
|
126 |
||
127 |
d(g_message ("About to debug '%s'", long_app)); |
|
10389 | 128 |
|
129 |
- if (!g_file_test (BUDDY_DATADIR "/gdb-cmd", G_FILE_TEST_EXISTS)) { |
|
130 |
- g_set_error (err, GDB_BUDDY_ERROR, GDB_BUDDY_GDB_CMD_NOT_FOUND, |
|
131 |
- _("Could not find the gdb-cmd file.\n" |
|
132 |
- "Please try reinstalling Bug Buddy.")); |
|
133 |
- g_free (args[0]); |
|
134 |
- g_free (long_app); |
|
135 |
- return 0; |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
136 |
- } |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
137 |
+ if (gdb) { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
138 |
+ if (!g_file_test (BUDDY_DATADIR "/gdb-cmd", G_FILE_TEST_EXISTS)) { |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
139 |
+ g_set_error (err, GDB_BUDDY_ERROR, GDB_BUDDY_GDB_CMD_NOT_FOUND, |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
140 |
+ _("Could not find the gdb-cmd file.\n" |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
141 |
+ "Please try reinstalling Bug Buddy.")); |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
142 |
+ g_free (args[0]); |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
143 |
+ g_free (long_app); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
144 |
+ return 0; |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
145 |
+ } |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
146 |
+ } |
10389 | 147 |
|
148 |
- args[5] = g_strdup_printf ("%d", pid); |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
149 |
+ if (pstack) |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
150 |
+ args[1] = g_strdup_printf ("%d", pid); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
151 |
+ else |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
152 |
+ args[5] = g_strdup_printf ("%d", pid); |
10387 | 153 |
|
154 |
if (!g_spawn_async_with_pipes (NULL, args, NULL, 0, NULL, NULL, |
|
155 |
&gdb_pid, |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
156 |
@@ -263,8 +291,11 @@ |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
157 |
_("There was an error running gdb:\n\n%s"), |
10387 | 158 |
error->message); |
159 |
g_error_free (error); |
|
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
160 |
- g_free (args[0]); |
10387 | 161 |
- g_free (args[5]); |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
162 |
+ if (pstack) |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
163 |
+ g_free (args[1]); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
164 |
+ else |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
165 |
+ g_free (args[5]); |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
166 |
+ g_free (args[0]); |
10387 | 167 |
g_free (long_app); |
168 |
return 0; |
|
169 |
} |
|
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
170 |
@@ -288,8 +319,11 @@ |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
171 |
gdb_handle_input, gdb_data, gdb_destroy); |
10387 | 172 |
g_io_channel_unref (ioc); |
173 |
||
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
174 |
- g_free (args[0]); |
10387 | 175 |
- g_free (args[5]); |
12211
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
176 |
+ if (pstack) |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
177 |
+ g_free (args[1]); |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
178 |
+ else |
10f673786ff5
* patches/bug-buddy-01-use-pstack : Update patch so that the default
mattman
parents:
11198
diff
changeset
|
179 |
+ g_free (args[5]); |
12218
677915814a4f
* patches/bug-buddy-01-use-pstack: Re-Work patch slightly, BTW this
mattman
parents:
12211
diff
changeset
|
180 |
+ g_free (args[0]); |
10387 | 181 |
g_free (long_app); |
182 |
||
183 |
return source_id; |