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) | |
69 | printf_filtered ("\n\032\032starting\n"); | |
70 | } | |
71 | ||
72 | void | |
73 | annotate_stopped () | |
74 | { | |
75 | if (annotation_level > 1) | |
76 | printf_filtered ("\n\032\032stopped\n"); | |
77 | } | |
78 | ||
79 | void | |
80 | annotate_exited (exitstatus) | |
81 | int exitstatus; | |
82 | { | |
83 | if (annotation_level > 1) | |
84 | printf_filtered ("\n\032\032exited %d\n", exitstatus); | |
85 | } | |
86 | ||
87 | void | |
88 | annotate_signalled () | |
89 | { | |
90 | if (annotation_level > 1) | |
91 | printf_filtered ("\n\032\032signalled\n"); | |
92 | } | |
93 | ||
94 | void | |
95 | annotate_signal_name () | |
96 | { | |
97 | if (annotation_level > 1) | |
98 | printf_filtered ("\n\032\032signal-name\n"); | |
99 | } | |
100 | ||
101 | void | |
102 | annotate_signal_name_end () | |
103 | { | |
104 | if (annotation_level > 1) | |
105 | printf_filtered ("\n\032\032signal-name-end\n"); | |
106 | } | |
107 | ||
108 | void | |
109 | annotate_signal_string () | |
110 | { | |
111 | if (annotation_level > 1) | |
112 | printf_filtered ("\n\032\032signal-string\n"); | |
113 | } | |
114 | ||
115 | void | |
116 | annotate_signal_string_end () | |
117 | { | |
118 | if (annotation_level > 1) | |
119 | printf_filtered ("\n\032\032signal-string-end\n"); | |
120 | } | |
121 | ||
122 | void | |
123 | annotate_signal () | |
124 | { | |
125 | if (annotation_level > 1) | |
126 | printf_filtered ("\n\032\032signal\n"); | |
127 | } | |
128 | \f | |
129 | void | |
130 | annotate_breakpoints_headers () | |
131 | { | |
132 | if (annotation_level > 1) | |
133 | printf_filtered ("\n\032\032breakpoints-headers\n"); | |
134 | } | |
135 | ||
136 | void | |
137 | annotate_field (num) | |
138 | int num; | |
139 | { | |
140 | if (annotation_level > 1) | |
141 | printf_filtered ("\n\032\032field %d\n", num); | |
142 | } | |
143 | ||
144 | void | |
145 | annotate_breakpoints_table () | |
146 | { | |
147 | if (annotation_level > 1) | |
148 | printf_filtered ("\n\032\032breakpoints-table\n"); | |
149 | } | |
150 | ||
151 | void | |
152 | annotate_record () | |
153 | { | |
154 | if (annotation_level > 1) | |
155 | printf_filtered ("\n\032\032record\n"); | |
156 | } | |
157 | ||
158 | void | |
159 | annotate_breakpoints_table_end () | |
160 | { | |
161 | if (annotation_level > 1) | |
162 | printf_filtered ("\n\032\032breakpoints-table-end\n"); | |
163 | } | |
164 | ||
165 | void | |
166 | annotate_frames_invalid () | |
167 | { | |
168 | if (annotation_level > 1) | |
169 | { | |
170 | target_terminal_ours (); | |
171 | printf_unfiltered ("\n\032\032frames-invalid\n"); | |
172 | } | |
173 | } | |
174 | ||
175 | void | |
176 | annotate_field_begin (type) | |
177 | struct type *type; | |
178 | { | |
179 | if (annotation_level > 1) | |
180 | { | |
181 | printf_filtered ("\n\032\032field-begin "); | |
182 | print_value_flags (type); | |
183 | printf_filtered ("\n"); | |
184 | } | |
185 | } | |
186 | ||
187 | void | |
188 | annotate_field_name_end () | |
189 | { | |
190 | if (annotation_level > 1) | |
191 | printf_filtered ("\n\032\032field-name-end\n"); | |
192 | } | |
193 | ||
194 | void | |
195 | annotate_field_value () | |
196 | { | |
197 | if (annotation_level > 1) | |
198 | printf_filtered ("\n\032\032field-value\n"); | |
199 | } | |
200 | ||
201 | void | |
202 | annotate_field_end () | |
203 | { | |
204 | if (annotation_level > 1) | |
20b3c1aa | 205 | printf_filtered ("\n\032\032field-end\n"); |
1c95d7ab JK |
206 | } |
207 | \f | |
208 | void | |
209 | annotate_quit () | |
210 | { | |
211 | if (annotation_level > 1) | |
212 | printf_filtered ("\n\032\032quit\n"); | |
213 | } | |
214 | ||
215 | void | |
216 | annotate_error () | |
217 | { | |
218 | if (annotation_level > 1) | |
219 | printf_filtered ("\n\032\032error\n"); | |
220 | } | |
221 | ||
222 | void | |
223 | annotate_error_begin () | |
224 | { | |
225 | if (annotation_level > 1) | |
226 | fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); | |
227 | } | |
228 | ||
229 | void | |
230 | annotate_value_history_begin (histindex, type) | |
231 | int histindex; | |
232 | struct type *type; | |
233 | { | |
234 | if (annotation_level > 1) | |
235 | { | |
236 | printf_filtered ("\n\032\032value-history-begin %d ", histindex); | |
237 | print_value_flags (type); | |
238 | printf_filtered ("\n"); | |
239 | } | |
240 | } | |
241 | ||
242 | void | |
243 | annotate_value_begin (type) | |
244 | struct type *type; | |
245 | { | |
246 | if (annotation_level > 1) | |
247 | { | |
248 | printf_filtered ("\n\032\032value-begin "); | |
249 | print_value_flags (type); | |
250 | printf_filtered ("\n"); | |
251 | } | |
252 | } | |
253 | ||
254 | void | |
255 | annotate_value_history_value () | |
256 | { | |
257 | if (annotation_level > 1) | |
258 | printf_filtered ("\n\032\032value-history-value\n"); | |
259 | } | |
260 | ||
261 | void | |
262 | annotate_value_history_end () | |
263 | { | |
264 | if (annotation_level > 1) | |
265 | printf_filtered ("\n\032\032value-history-end\n"); | |
266 | } | |
267 | ||
268 | void | |
269 | annotate_value_end () | |
270 | { | |
271 | if (annotation_level > 1) | |
272 | printf_filtered ("\n\032\032value-end\n"); | |
273 | } | |
274 | ||
275 | void | |
276 | annotate_display_begin () | |
277 | { | |
278 | if (annotation_level > 1) | |
279 | printf_filtered ("\n\032\032display-begin\n"); | |
280 | } | |
281 | ||
282 | void | |
283 | annotate_display_number_end () | |
284 | { | |
285 | if (annotation_level > 1) | |
286 | printf_filtered ("\n\032\032display-number-end\n"); | |
287 | } | |
288 | ||
289 | void | |
290 | annotate_display_format () | |
291 | { | |
292 | if (annotation_level > 1) | |
293 | printf_filtered ("\n\032\032display-format\n"); | |
294 | } | |
295 | ||
296 | void | |
297 | annotate_display_expression () | |
298 | { | |
299 | if (annotation_level > 1) | |
300 | printf_filtered ("\n\032\032display-expression\n"); | |
301 | } | |
302 | ||
303 | void | |
304 | annotate_display_expression_end () | |
305 | { | |
306 | if (annotation_level > 1) | |
307 | printf_filtered ("\n\032\032display-expression-end\n"); | |
308 | } | |
309 | ||
310 | void | |
311 | annotate_display_value () | |
312 | { | |
313 | if (annotation_level > 1) | |
314 | printf_filtered ("\n\032\032display-value\n"); | |
315 | } | |
316 | ||
317 | void | |
318 | annotate_display_end () | |
319 | { | |
320 | if (annotation_level > 1) | |
321 | printf_filtered ("\n\032\032display-end\n"); | |
322 | } | |
323 | ||
324 | void | |
325 | annotate_arg_begin () | |
326 | { | |
327 | if (annotation_level > 1) | |
328 | printf_filtered ("\n\032\032arg-begin\n"); | |
329 | } | |
330 | ||
331 | void | |
332 | annotate_arg_name_end () | |
333 | { | |
334 | if (annotation_level > 1) | |
335 | printf_filtered ("\n\032\032arg-name-end\n"); | |
336 | } | |
337 | ||
338 | void | |
339 | annotate_arg_value (type) | |
340 | struct type *type; | |
341 | { | |
342 | if (annotation_level > 1) | |
343 | { | |
344 | printf_filtered ("\n\032\032arg-value "); | |
345 | print_value_flags (type); | |
346 | printf_filtered ("\n"); | |
347 | } | |
348 | } | |
349 | ||
350 | void | |
351 | annotate_arg_end () | |
352 | { | |
353 | if (annotation_level > 1) | |
354 | printf_filtered ("\n\032\032arg-end\n"); | |
355 | } | |
356 | ||
357 | void | |
358 | annotate_source (filename, line, character, mid, pc) | |
359 | char *filename; | |
360 | int line; | |
361 | int character; | |
362 | int mid; | |
363 | CORE_ADDR pc; | |
364 | { | |
365 | if (annotation_level > 1) | |
366 | printf_filtered ("\n\032\032source "); | |
367 | else | |
368 | printf_filtered ("\032\032"); | |
369 | ||
370 | printf_filtered ("%s:%d:%d:%s:", filename, | |
371 | line, character, | |
372 | mid ? "middle" : "beg"); | |
373 | print_address_numeric (pc, 0, gdb_stdout); | |
374 | printf_filtered ("\n"); | |
375 | } | |
376 | ||
377 | void | |
378 | annotate_frame_begin (level, pc) | |
379 | int level; | |
380 | CORE_ADDR pc; | |
381 | { | |
382 | if (annotation_level > 1) | |
383 | { | |
384 | printf_filtered ("\n\032\032frame-begin %d ", level); | |
385 | print_address_numeric (pc, 0, gdb_stdout); | |
386 | printf_filtered ("\n"); | |
387 | } | |
388 | } | |
389 | ||
390 | void | |
391 | annotate_function_call () | |
392 | { | |
393 | if (annotation_level > 1) | |
394 | printf_filtered ("\n\032\032function-call\n"); | |
395 | } | |
396 | ||
397 | void | |
398 | annotate_signal_handler_caller () | |
399 | { | |
400 | if (annotation_level > 1) | |
401 | printf_filtered ("\n\032\032signal-handler-caller\n"); | |
402 | } | |
403 | ||
404 | void | |
405 | annotate_frame_address () | |
406 | { | |
407 | if (annotation_level > 1) | |
408 | printf_filtered ("\n\032\032frame-address\n"); | |
409 | } | |
410 | ||
411 | void | |
412 | annotate_frame_address_end () | |
413 | { | |
414 | if (annotation_level > 1) | |
415 | printf_filtered ("\n\032\032frame-address-end\n"); | |
416 | } | |
417 | ||
418 | void | |
419 | annotate_frame_function_name () | |
420 | { | |
421 | if (annotation_level > 1) | |
422 | printf_filtered ("\n\032\032frame-function-name\n"); | |
423 | } | |
424 | ||
425 | void | |
426 | annotate_frame_args () | |
427 | { | |
428 | if (annotation_level > 1) | |
429 | printf_filtered ("\n\032\032frame-args\n"); | |
430 | } | |
431 | ||
432 | void | |
433 | annotate_frame_source_begin () | |
434 | { | |
435 | if (annotation_level > 1) | |
436 | printf_filtered ("\n\032\032frame-source-begin\n"); | |
437 | } | |
438 | ||
439 | void | |
440 | annotate_frame_source_file () | |
441 | { | |
442 | if (annotation_level > 1) | |
443 | printf_filtered ("\n\032\032frame-source-file\n"); | |
444 | } | |
445 | ||
446 | void | |
447 | annotate_frame_source_file_end () | |
448 | { | |
449 | if (annotation_level > 1) | |
450 | printf_filtered ("\n\032\032frame-source-file-end\n"); | |
451 | } | |
452 | ||
453 | void | |
454 | annotate_frame_source_line () | |
455 | { | |
456 | if (annotation_level > 1) | |
457 | printf_filtered ("\n\032\032frame-source-line\n"); | |
458 | } | |
459 | ||
460 | void | |
461 | annotate_frame_source_end () | |
462 | { | |
463 | if (annotation_level > 1) | |
464 | printf_filtered ("\n\032\032frame-source-end\n"); | |
465 | } | |
466 | ||
467 | void | |
468 | annotate_frame_where () | |
469 | { | |
470 | if (annotation_level > 1) | |
471 | printf_filtered ("\n\032\032frame-where\n"); | |
472 | } | |
473 | ||
474 | void | |
475 | annotate_frame_end () | |
476 | { | |
477 | if (annotation_level > 1) | |
478 | printf_filtered ("\n\032\032frame-end\n"); | |
479 | } | |
480 | \f | |
481 | void | |
482 | annotate_array_section_begin (index, elttype) | |
483 | int index; | |
484 | struct type *elttype; | |
485 | { | |
486 | if (annotation_level > 1) | |
487 | { | |
488 | printf_filtered ("\n\032\032array-section-begin %d ", index); | |
489 | print_value_flags (elttype); | |
490 | printf_filtered ("\n"); | |
491 | } | |
492 | } | |
493 | ||
494 | void | |
495 | annotate_elt_rep (repcount) | |
496 | unsigned int repcount; | |
497 | { | |
498 | if (annotation_level > 1) | |
499 | printf_filtered ("\n\032\032elt-rep %u\n", repcount); | |
500 | } | |
501 | ||
502 | void | |
503 | annotate_elt_rep_end () | |
504 | { | |
505 | if (annotation_level > 1) | |
506 | printf_filtered ("\n\032\032elt-rep-end\n"); | |
507 | } | |
508 | ||
509 | void | |
510 | annotate_elt () | |
511 | { | |
512 | if (annotation_level > 1) | |
513 | printf_filtered ("\n\032\032elt\n"); | |
514 | } | |
515 | ||
516 | void | |
517 | annotate_array_section_end () | |
518 | { | |
519 | if (annotation_level > 1) | |
520 | printf_filtered ("\n\032\032array-section-end\n"); | |
521 | } | |
522 | ||
d2a85f11 JMD |
523 | static void |
524 | breakpoint_changed (b) | |
525 | struct breakpoint *b; | |
526 | { | |
527 | breakpoints_changed (); | |
528 | } | |
529 | ||
530 | void | |
531 | _initialize_annotate () | |
532 | { | |
533 | if (annotation_level > 1) | |
534 | { | |
535 | delete_breakpoint_hook = breakpoint_changed; | |
536 | enable_breakpoint_hook = breakpoint_changed; | |
537 | disable_breakpoint_hook = breakpoint_changed; | |
538 | } | |
539 | } |