]>
Commit | Line | Data |
---|---|---|
1c95d7ab JK |
1 | /* Annotation routines for GDB. |
2 | Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | #include "defs.h" | |
21 | #include "annotate.h" | |
22 | #include "value.h" | |
23 | #include "target.h" | |
9c036bd8 | 24 | #include "gdbtypes.h" |
d2a85f11 | 25 | #include "breakpoint.h" |
9c036bd8 JK |
26 | \f |
27 | static void print_value_flags PARAMS ((struct type *)); | |
1c95d7ab | 28 | |
9c036bd8 JK |
29 | static void |
30 | print_value_flags (t) | |
31 | struct type *t; | |
32 | { | |
33 | if (can_dereference (t)) | |
34 | printf_filtered ("*"); | |
35 | else | |
36 | printf_filtered ("-"); | |
37 | } | |
38 | \f | |
1c95d7ab JK |
39 | void |
40 | breakpoints_changed () | |
41 | { | |
42 | if (annotation_level > 1) | |
43 | { | |
44 | target_terminal_ours (); | |
45 | printf_unfiltered ("\n\032\032breakpoints-invalid\n"); | |
46 | } | |
47 | } | |
48 | ||
49 | void | |
50 | annotate_breakpoint (num) | |
51 | int num; | |
52 | { | |
53 | if (annotation_level > 1) | |
54 | printf_filtered ("\n\032\032breakpoint %d\n", num); | |
55 | } | |
56 | ||
57 | void | |
58 | annotate_watchpoint (num) | |
59 | int num; | |
60 | { | |
61 | if (annotation_level > 1) | |
62 | printf_filtered ("\n\032\032watchpoint %d\n", num); | |
63 | } | |
64 | ||
65 | void | |
66 | annotate_starting () | |
67 | { | |
68 | if (annotation_level > 1) | |
0c070b57 JK |
69 | { |
70 | printf_filtered ("\n\032\032starting\n"); | |
71 | /* The starting annotation needs to appear before any output | |
72 | from the inferior process. */ | |
73 | gdb_flush (gdb_stdout); | |
74 | } | |
1c95d7ab JK |
75 | } |
76 | ||
77 | void | |
78 | annotate_stopped () | |
79 | { | |
80 | if (annotation_level > 1) | |
81 | printf_filtered ("\n\032\032stopped\n"); | |
82 | } | |
83 | ||
84 | void | |
85 | annotate_exited (exitstatus) | |
86 | int exitstatus; | |
87 | { | |
88 | if (annotation_level > 1) | |
89 | printf_filtered ("\n\032\032exited %d\n", exitstatus); | |
90 | } | |
91 | ||
92 | void | |
93 | annotate_signalled () | |
94 | { | |
95 | if (annotation_level > 1) | |
96 | printf_filtered ("\n\032\032signalled\n"); | |
97 | } | |
98 | ||
99 | void | |
100 | annotate_signal_name () | |
101 | { | |
102 | if (annotation_level > 1) | |
103 | printf_filtered ("\n\032\032signal-name\n"); | |
104 | } | |
105 | ||
106 | void | |
107 | annotate_signal_name_end () | |
108 | { | |
109 | if (annotation_level > 1) | |
110 | printf_filtered ("\n\032\032signal-name-end\n"); | |
111 | } | |
112 | ||
113 | void | |
114 | annotate_signal_string () | |
115 | { | |
116 | if (annotation_level > 1) | |
117 | printf_filtered ("\n\032\032signal-string\n"); | |
118 | } | |
119 | ||
120 | void | |
121 | annotate_signal_string_end () | |
122 | { | |
123 | if (annotation_level > 1) | |
124 | printf_filtered ("\n\032\032signal-string-end\n"); | |
125 | } | |
126 | ||
127 | void | |
128 | annotate_signal () | |
129 | { | |
130 | if (annotation_level > 1) | |
131 | printf_filtered ("\n\032\032signal\n"); | |
132 | } | |
133 | \f | |
134 | void | |
135 | annotate_breakpoints_headers () | |
136 | { | |
137 | if (annotation_level > 1) | |
138 | printf_filtered ("\n\032\032breakpoints-headers\n"); | |
139 | } | |
140 | ||
141 | void | |
142 | annotate_field (num) | |
143 | int num; | |
144 | { | |
145 | if (annotation_level > 1) | |
146 | printf_filtered ("\n\032\032field %d\n", num); | |
147 | } | |
148 | ||
149 | void | |
150 | annotate_breakpoints_table () | |
151 | { | |
152 | if (annotation_level > 1) | |
153 | printf_filtered ("\n\032\032breakpoints-table\n"); | |
154 | } | |
155 | ||
156 | void | |
157 | annotate_record () | |
158 | { | |
159 | if (annotation_level > 1) | |
160 | printf_filtered ("\n\032\032record\n"); | |
161 | } | |
162 | ||
163 | void | |
164 | annotate_breakpoints_table_end () | |
165 | { | |
166 | if (annotation_level > 1) | |
167 | printf_filtered ("\n\032\032breakpoints-table-end\n"); | |
168 | } | |
169 | ||
170 | void | |
171 | annotate_frames_invalid () | |
172 | { | |
173 | if (annotation_level > 1) | |
174 | { | |
175 | target_terminal_ours (); | |
176 | printf_unfiltered ("\n\032\032frames-invalid\n"); | |
177 | } | |
178 | } | |
179 | ||
180 | void | |
181 | annotate_field_begin (type) | |
182 | struct type *type; | |
183 | { | |
184 | if (annotation_level > 1) | |
185 | { | |
186 | printf_filtered ("\n\032\032field-begin "); | |
187 | print_value_flags (type); | |
188 | printf_filtered ("\n"); | |
189 | } | |
190 | } | |
191 | ||
192 | void | |
193 | annotate_field_name_end () | |
194 | { | |
195 | if (annotation_level > 1) | |
196 | printf_filtered ("\n\032\032field-name-end\n"); | |
197 | } | |
198 | ||
199 | void | |
200 | annotate_field_value () | |
201 | { | |
202 | if (annotation_level > 1) | |
203 | printf_filtered ("\n\032\032field-value\n"); | |
204 | } | |
205 | ||
206 | void | |
207 | annotate_field_end () | |
208 | { | |
209 | if (annotation_level > 1) | |
20b3c1aa | 210 | printf_filtered ("\n\032\032field-end\n"); |
1c95d7ab JK |
211 | } |
212 | \f | |
213 | void | |
214 | annotate_quit () | |
215 | { | |
216 | if (annotation_level > 1) | |
217 | printf_filtered ("\n\032\032quit\n"); | |
218 | } | |
219 | ||
220 | void | |
221 | annotate_error () | |
222 | { | |
223 | if (annotation_level > 1) | |
224 | printf_filtered ("\n\032\032error\n"); | |
225 | } | |
226 | ||
227 | void | |
228 | annotate_error_begin () | |
229 | { | |
230 | if (annotation_level > 1) | |
231 | fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); | |
232 | } | |
233 | ||
234 | void | |
235 | annotate_value_history_begin (histindex, type) | |
236 | int histindex; | |
237 | struct type *type; | |
238 | { | |
239 | if (annotation_level > 1) | |
240 | { | |
241 | printf_filtered ("\n\032\032value-history-begin %d ", histindex); | |
242 | print_value_flags (type); | |
243 | printf_filtered ("\n"); | |
244 | } | |
245 | } | |
246 | ||
247 | void | |
248 | annotate_value_begin (type) | |
249 | struct type *type; | |
250 | { | |
251 | if (annotation_level > 1) | |
252 | { | |
253 | printf_filtered ("\n\032\032value-begin "); | |
254 | print_value_flags (type); | |
255 | printf_filtered ("\n"); | |
256 | } | |
257 | } | |
258 | ||
259 | void | |
260 | annotate_value_history_value () | |
261 | { | |
262 | if (annotation_level > 1) | |
263 | printf_filtered ("\n\032\032value-history-value\n"); | |
264 | } | |
265 | ||
266 | void | |
267 | annotate_value_history_end () | |
268 | { | |
269 | if (annotation_level > 1) | |
270 | printf_filtered ("\n\032\032value-history-end\n"); | |
271 | } | |
272 | ||
273 | void | |
274 | annotate_value_end () | |
275 | { | |
276 | if (annotation_level > 1) | |
277 | printf_filtered ("\n\032\032value-end\n"); | |
278 | } | |
279 | ||
280 | void | |
281 | annotate_display_begin () | |
282 | { | |
283 | if (annotation_level > 1) | |
284 | printf_filtered ("\n\032\032display-begin\n"); | |
285 | } | |
286 | ||
287 | void | |
288 | annotate_display_number_end () | |
289 | { | |
290 | if (annotation_level > 1) | |
291 | printf_filtered ("\n\032\032display-number-end\n"); | |
292 | } | |
293 | ||
294 | void | |
295 | annotate_display_format () | |
296 | { | |
297 | if (annotation_level > 1) | |
298 | printf_filtered ("\n\032\032display-format\n"); | |
299 | } | |
300 | ||
301 | void | |
302 | annotate_display_expression () | |
303 | { | |
304 | if (annotation_level > 1) | |
305 | printf_filtered ("\n\032\032display-expression\n"); | |
306 | } | |
307 | ||
308 | void | |
309 | annotate_display_expression_end () | |
310 | { | |
311 | if (annotation_level > 1) | |
312 | printf_filtered ("\n\032\032display-expression-end\n"); | |
313 | } | |
314 | ||
315 | void | |
316 | annotate_display_value () | |
317 | { | |
318 | if (annotation_level > 1) | |
319 | printf_filtered ("\n\032\032display-value\n"); | |
320 | } | |
321 | ||
322 | void | |
323 | annotate_display_end () | |
324 | { | |
325 | if (annotation_level > 1) | |
326 | printf_filtered ("\n\032\032display-end\n"); | |
327 | } | |
328 | ||
329 | void | |
330 | annotate_arg_begin () | |
331 | { | |
332 | if (annotation_level > 1) | |
333 | printf_filtered ("\n\032\032arg-begin\n"); | |
334 | } | |
335 | ||
336 | void | |
337 | annotate_arg_name_end () | |
338 | { | |
339 | if (annotation_level > 1) | |
340 | printf_filtered ("\n\032\032arg-name-end\n"); | |
341 | } | |
342 | ||
343 | void | |
344 | annotate_arg_value (type) | |
345 | struct type *type; | |
346 | { | |
347 | if (annotation_level > 1) | |
348 | { | |
349 | printf_filtered ("\n\032\032arg-value "); | |
350 | print_value_flags (type); | |
351 | printf_filtered ("\n"); | |
352 | } | |
353 | } | |
354 | ||
355 | void | |
356 | annotate_arg_end () | |
357 | { | |
358 | if (annotation_level > 1) | |
359 | printf_filtered ("\n\032\032arg-end\n"); | |
360 | } | |
361 | ||
362 | void | |
363 | annotate_source (filename, line, character, mid, pc) | |
364 | char *filename; | |
365 | int line; | |
366 | int character; | |
367 | int mid; | |
368 | CORE_ADDR pc; | |
369 | { | |
370 | if (annotation_level > 1) | |
371 | printf_filtered ("\n\032\032source "); | |
372 | else | |
373 | printf_filtered ("\032\032"); | |
374 | ||
375 | printf_filtered ("%s:%d:%d:%s:", filename, | |
376 | line, character, | |
377 | mid ? "middle" : "beg"); | |
378 | print_address_numeric (pc, 0, gdb_stdout); | |
379 | printf_filtered ("\n"); | |
380 | } | |
381 | ||
382 | void | |
383 | annotate_frame_begin (level, pc) | |
384 | int level; | |
385 | CORE_ADDR pc; | |
386 | { | |
387 | if (annotation_level > 1) | |
388 | { | |
389 | printf_filtered ("\n\032\032frame-begin %d ", level); | |
390 | print_address_numeric (pc, 0, gdb_stdout); | |
391 | printf_filtered ("\n"); | |
392 | } | |
393 | } | |
394 | ||
395 | void | |
396 | annotate_function_call () | |
397 | { | |
398 | if (annotation_level > 1) | |
399 | printf_filtered ("\n\032\032function-call\n"); | |
400 | } | |
401 | ||
402 | void | |
403 | annotate_signal_handler_caller () | |
404 | { | |
405 | if (annotation_level > 1) | |
406 | printf_filtered ("\n\032\032signal-handler-caller\n"); | |
407 | } | |
408 | ||
409 | void | |
410 | annotate_frame_address () | |
411 | { | |
412 | if (annotation_level > 1) | |
413 | printf_filtered ("\n\032\032frame-address\n"); | |
414 | } | |
415 | ||
416 | void | |
417 | annotate_frame_address_end () | |
418 | { | |
419 | if (annotation_level > 1) | |
420 | printf_filtered ("\n\032\032frame-address-end\n"); | |
421 | } | |
422 | ||
423 | void | |
424 | annotate_frame_function_name () | |
425 | { | |
426 | if (annotation_level > 1) | |
427 | printf_filtered ("\n\032\032frame-function-name\n"); | |
428 | } | |
429 | ||
430 | void | |
431 | annotate_frame_args () | |
432 | { | |
433 | if (annotation_level > 1) | |
434 | printf_filtered ("\n\032\032frame-args\n"); | |
435 | } | |
436 | ||
437 | void | |
438 | annotate_frame_source_begin () | |
439 | { | |
440 | if (annotation_level > 1) | |
441 | printf_filtered ("\n\032\032frame-source-begin\n"); | |
442 | } | |
443 | ||
444 | void | |
445 | annotate_frame_source_file () | |
446 | { | |
447 | if (annotation_level > 1) | |
448 | printf_filtered ("\n\032\032frame-source-file\n"); | |
449 | } | |
450 | ||
451 | void | |
452 | annotate_frame_source_file_end () | |
453 | { | |
454 | if (annotation_level > 1) | |
455 | printf_filtered ("\n\032\032frame-source-file-end\n"); | |
456 | } | |
457 | ||
458 | void | |
459 | annotate_frame_source_line () | |
460 | { | |
461 | if (annotation_level > 1) | |
462 | printf_filtered ("\n\032\032frame-source-line\n"); | |
463 | } | |
464 | ||
465 | void | |
466 | annotate_frame_source_end () | |
467 | { | |
468 | if (annotation_level > 1) | |
469 | printf_filtered ("\n\032\032frame-source-end\n"); | |
470 | } | |
471 | ||
472 | void | |
473 | annotate_frame_where () | |
474 | { | |
475 | if (annotation_level > 1) | |
476 | printf_filtered ("\n\032\032frame-where\n"); | |
477 | } | |
478 | ||
479 | void | |
480 | annotate_frame_end () | |
481 | { | |
482 | if (annotation_level > 1) | |
483 | printf_filtered ("\n\032\032frame-end\n"); | |
484 | } | |
485 | \f | |
486 | void | |
487 | annotate_array_section_begin (index, elttype) | |
488 | int index; | |
489 | struct type *elttype; | |
490 | { | |
491 | if (annotation_level > 1) | |
492 | { | |
493 | printf_filtered ("\n\032\032array-section-begin %d ", index); | |
494 | print_value_flags (elttype); | |
495 | printf_filtered ("\n"); | |
496 | } | |
497 | } | |
498 | ||
499 | void | |
500 | annotate_elt_rep (repcount) | |
501 | unsigned int repcount; | |
502 | { | |
503 | if (annotation_level > 1) | |
504 | printf_filtered ("\n\032\032elt-rep %u\n", repcount); | |
505 | } | |
506 | ||
507 | void | |
508 | annotate_elt_rep_end () | |
509 | { | |
510 | if (annotation_level > 1) | |
511 | printf_filtered ("\n\032\032elt-rep-end\n"); | |
512 | } | |
513 | ||
514 | void | |
515 | annotate_elt () | |
516 | { | |
517 | if (annotation_level > 1) | |
518 | printf_filtered ("\n\032\032elt\n"); | |
519 | } | |
520 | ||
521 | void | |
522 | annotate_array_section_end () | |
523 | { | |
524 | if (annotation_level > 1) | |
525 | printf_filtered ("\n\032\032array-section-end\n"); | |
526 | } | |
527 | ||
d2a85f11 JMD |
528 | static void |
529 | breakpoint_changed (b) | |
530 | struct breakpoint *b; | |
531 | { | |
532 | breakpoints_changed (); | |
533 | } | |
534 | ||
535 | void | |
536 | _initialize_annotate () | |
537 | { | |
538 | if (annotation_level > 1) | |
539 | { | |
540 | delete_breakpoint_hook = breakpoint_changed; | |
541 | enable_breakpoint_hook = breakpoint_changed; | |
542 | disable_breakpoint_hook = breakpoint_changed; | |
543 | } | |
544 | } |