windows-nat: Don't change current_event.dwThreadId in handle_output_debug_string()
[deliverable/binutils-gdb.git] / gdb / symfile-debug.c
CommitLineData
8fb8eb5c
DE
1/* Debug logging for the symbol file functions for the GNU debugger, GDB.
2
32d0add0 3 Copyright (C) 2013-2015 Free Software Foundation, Inc.
8fb8eb5c
DE
4
5 Contributed by Cygnus Support, using pieces from other GDB modules.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22/* Note: Be careful with functions that can throw errors.
23 We want to see a logging message regardless of whether an error was thrown.
24 This typically means printing a message before calling the real function
25 and then if the function returns a result printing a message after it
26 returns. */
27
28#include "defs.h"
29#include "gdbcmd.h"
30#include "objfiles.h"
31#include "observer.h"
32#include "source.h"
33#include "symtab.h"
34#include "symfile.h"
35
36/* We need to save a pointer to the real symbol functions.
37 Plus, the debug versions are malloc'd because we have to NULL out the
38 ones that are NULL in the real copy. */
39
40struct debug_sym_fns_data
41{
42 const struct sym_fns *real_sf;
43 struct sym_fns debug_sf;
44};
45
46/* We need to record a pointer to the real set of functions for each
47 objfile. */
48static const struct objfile_data *symfile_debug_objfile_data_key;
49
50/* If non-zero all calls to the symfile functions are logged. */
51static int debug_symfile = 0;
52
53/* Return non-zero if symfile debug logging is installed. */
54
55static int
56symfile_debug_installed (struct objfile *objfile)
57{
58 return (objfile->sf != NULL
59 && objfile_data (objfile, symfile_debug_objfile_data_key) != NULL);
60}
61
8fb8eb5c
DE
62/* Utility return the name to print for SYMTAB. */
63
64static const char *
65debug_symtab_name (struct symtab *symtab)
66{
67 return symtab_to_filename_for_display (symtab);
68}
69\f
70/* Debugging version of struct quick_symbol_functions. */
71
72static int
73debug_qf_has_symbols (struct objfile *objfile)
74{
75 const struct debug_sym_fns_data *debug_data =
76 objfile_data (objfile, symfile_debug_objfile_data_key);
77 int retval;
78
79 retval = debug_data->real_sf->qf->has_symbols (objfile);
80
81 fprintf_filtered (gdb_stdlog, "qf->has_symbols (%s) = %d\n",
cc485e62 82 objfile_debug_name (objfile), retval);
8fb8eb5c
DE
83
84 return retval;
85}
86
87static struct symtab *
88debug_qf_find_last_source_symtab (struct objfile *objfile)
89{
90 const struct debug_sym_fns_data *debug_data =
91 objfile_data (objfile, symfile_debug_objfile_data_key);
92 struct symtab *retval;
93
94 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (%s)\n",
cc485e62 95 objfile_debug_name (objfile));
8fb8eb5c
DE
96
97 retval = debug_data->real_sf->qf->find_last_source_symtab (objfile);
98
99 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (...) = %s\n",
100 retval ? debug_symtab_name (retval) : "NULL");
101
102 return retval;
103}
104
105static void
106debug_qf_forget_cached_source_info (struct objfile *objfile)
107{
108 const struct debug_sym_fns_data *debug_data =
109 objfile_data (objfile, symfile_debug_objfile_data_key);
110
111 fprintf_filtered (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
cc485e62 112 objfile_debug_name (objfile));
8fb8eb5c
DE
113
114 debug_data->real_sf->qf->forget_cached_source_info (objfile);
115}
116
117static int
118debug_qf_map_symtabs_matching_filename (struct objfile *objfile,
119 const char *name,
120 const char *real_path,
121 int (*callback) (struct symtab *,
122 void *),
123 void *data)
124{
125 const struct debug_sym_fns_data *debug_data =
126 objfile_data (objfile, symfile_debug_objfile_data_key);
127 int retval;
128
129 fprintf_filtered (gdb_stdlog,
130 "qf->map_symtabs_matching_filename (%s, \"%s\", \"%s\", %s, %s)\n",
cc485e62 131 objfile_debug_name (objfile), name,
8fb8eb5c
DE
132 real_path ? real_path : NULL,
133 host_address_to_string (callback),
134 host_address_to_string (data));
135
136 retval = debug_data->real_sf->qf->map_symtabs_matching_filename
137 (objfile, name, real_path, callback, data);
138
139 fprintf_filtered (gdb_stdlog,
140 "qf->map_symtabs_matching_filename (...) = %d\n",
141 retval);
142
143 return retval;
144}
145
43f3e411 146static struct compunit_symtab *
8fb8eb5c
DE
147debug_qf_lookup_symbol (struct objfile *objfile, int kind, const char *name,
148 domain_enum domain)
149{
150 const struct debug_sym_fns_data *debug_data =
151 objfile_data (objfile, symfile_debug_objfile_data_key);
43f3e411 152 struct compunit_symtab *retval;
8fb8eb5c
DE
153
154 fprintf_filtered (gdb_stdlog,
155 "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
cc485e62 156 objfile_debug_name (objfile), kind, name,
8fb8eb5c
DE
157 domain_name (domain));
158
159 retval = debug_data->real_sf->qf->lookup_symbol (objfile, kind, name,
160 domain);
161
162 fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
43f3e411
DE
163 retval
164 ? debug_symtab_name (compunit_primary_filetab (retval))
165 : "NULL");
8fb8eb5c
DE
166
167 return retval;
168}
169
170static void
171debug_qf_print_stats (struct objfile *objfile)
172{
173 const struct debug_sym_fns_data *debug_data =
174 objfile_data (objfile, symfile_debug_objfile_data_key);
175
176 fprintf_filtered (gdb_stdlog, "qf->print_stats (%s)\n",
cc485e62 177 objfile_debug_name (objfile));
8fb8eb5c
DE
178
179 debug_data->real_sf->qf->print_stats (objfile);
180}
181
182static void
183debug_qf_dump (struct objfile *objfile)
184{
185 const struct debug_sym_fns_data *debug_data =
186 objfile_data (objfile, symfile_debug_objfile_data_key);
187
188 fprintf_filtered (gdb_stdlog, "qf->dump (%s)\n",
cc485e62 189 objfile_debug_name (objfile));
8fb8eb5c
DE
190
191 debug_data->real_sf->qf->dump (objfile);
192}
193
194static void
195debug_qf_relocate (struct objfile *objfile,
196 const struct section_offsets *new_offsets,
197 const struct section_offsets *delta)
198{
199 const struct debug_sym_fns_data *debug_data =
200 objfile_data (objfile, symfile_debug_objfile_data_key);
201
202 fprintf_filtered (gdb_stdlog, "qf->relocate (%s, %s, %s)\n",
cc485e62 203 objfile_debug_name (objfile),
8fb8eb5c
DE
204 host_address_to_string (new_offsets),
205 host_address_to_string (delta));
206
207 debug_data->real_sf->qf->relocate (objfile, new_offsets, delta);
208}
209
210static void
211debug_qf_expand_symtabs_for_function (struct objfile *objfile,
212 const char *func_name)
213{
214 const struct debug_sym_fns_data *debug_data =
215 objfile_data (objfile, symfile_debug_objfile_data_key);
216
217 fprintf_filtered (gdb_stdlog,
218 "qf->expand_symtabs_for_function (%s, \"%s\")\n",
cc485e62 219 objfile_debug_name (objfile), func_name);
8fb8eb5c
DE
220
221 debug_data->real_sf->qf->expand_symtabs_for_function (objfile, func_name);
222}
223
224static void
225debug_qf_expand_all_symtabs (struct objfile *objfile)
226{
227 const struct debug_sym_fns_data *debug_data =
228 objfile_data (objfile, symfile_debug_objfile_data_key);
229
230 fprintf_filtered (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
cc485e62 231 objfile_debug_name (objfile));
8fb8eb5c
DE
232
233 debug_data->real_sf->qf->expand_all_symtabs (objfile);
234}
235
236static void
237debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
238 const char *fullname)
239{
240 const struct debug_sym_fns_data *debug_data =
241 objfile_data (objfile, symfile_debug_objfile_data_key);
242
243 fprintf_filtered (gdb_stdlog,
244 "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
cc485e62 245 objfile_debug_name (objfile), fullname);
8fb8eb5c
DE
246
247 debug_data->real_sf->qf->expand_symtabs_with_fullname (objfile, fullname);
248}
249
250static void
251debug_qf_map_matching_symbols (struct objfile *objfile,
fe978cb0 252 const char *name, domain_enum domain,
8fb8eb5c
DE
253 int global,
254 int (*callback) (struct block *,
255 struct symbol *, void *),
256 void *data,
257 symbol_compare_ftype *match,
258 symbol_compare_ftype *ordered_compare)
259{
260 const struct debug_sym_fns_data *debug_data =
261 objfile_data (objfile, symfile_debug_objfile_data_key);
262
263 fprintf_filtered (gdb_stdlog,
264 "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
cc485e62 265 objfile_debug_name (objfile), name,
fe978cb0 266 domain_name (domain), global,
8fb8eb5c
DE
267 host_address_to_string (callback),
268 host_address_to_string (data),
269 host_address_to_string (match),
270 host_address_to_string (ordered_compare));
271
272 debug_data->real_sf->qf->map_matching_symbols (objfile, name,
fe978cb0 273 domain, global,
8fb8eb5c
DE
274 callback, data,
275 match,
276 ordered_compare);
277}
278
279static void
e86b67d3
JB
280debug_qf_expand_symtabs_matching
281 (struct objfile *objfile,
282 expand_symtabs_file_matcher_ftype *file_matcher,
283 expand_symtabs_symbol_matcher_ftype *symbol_matcher,
276d885b 284 expand_symtabs_exp_notify_ftype *expansion_notify,
e86b67d3 285 enum search_domain kind, void *data)
8fb8eb5c
DE
286{
287 const struct debug_sym_fns_data *debug_data =
288 objfile_data (objfile, symfile_debug_objfile_data_key);
289
290 fprintf_filtered (gdb_stdlog,
276d885b 291 "qf->expand_symtabs_matching (%s, %s, %s, %s, %s, %s)\n",
cc485e62 292 objfile_debug_name (objfile),
8fb8eb5c 293 host_address_to_string (file_matcher),
3f03e7b1 294 host_address_to_string (symbol_matcher),
276d885b 295 host_address_to_string (expansion_notify),
8fb8eb5c
DE
296 search_domain_name (kind),
297 host_address_to_string (data));
298
299 debug_data->real_sf->qf->expand_symtabs_matching (objfile,
300 file_matcher,
3f03e7b1 301 symbol_matcher,
276d885b 302 expansion_notify,
8fb8eb5c
DE
303 kind, data);
304}
305
43f3e411
DE
306static struct compunit_symtab *
307debug_qf_find_pc_sect_compunit_symtab (struct objfile *objfile,
308 struct bound_minimal_symbol msymbol,
309 CORE_ADDR pc,
310 struct obj_section *section,
311 int warn_if_readin)
8fb8eb5c
DE
312{
313 const struct debug_sym_fns_data *debug_data =
314 objfile_data (objfile, symfile_debug_objfile_data_key);
43f3e411 315 struct compunit_symtab *retval;
8fb8eb5c
DE
316
317 fprintf_filtered (gdb_stdlog,
43f3e411 318 "qf->find_pc_sect_compunit_symtab (%s, %s, %s, %s, %d)\n",
cc485e62 319 objfile_debug_name (objfile),
77e371c0 320 host_address_to_string (msymbol.minsym),
8fb8eb5c
DE
321 hex_string (pc),
322 host_address_to_string (section),
323 warn_if_readin);
324
43f3e411
DE
325 retval
326 = debug_data->real_sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
327 pc, section,
328 warn_if_readin);
8fb8eb5c 329
43f3e411
DE
330 fprintf_filtered (gdb_stdlog,
331 "qf->find_pc_sect_compunit_symtab (...) = %s\n",
332 retval
333 ? debug_symtab_name (compunit_primary_filetab (retval))
334 : "NULL");
8fb8eb5c
DE
335
336 return retval;
337}
338
339static void
340debug_qf_map_symbol_filenames (struct objfile *objfile,
341 symbol_filename_ftype *fun, void *data,
342 int need_fullname)
343{
344 const struct debug_sym_fns_data *debug_data =
345 objfile_data (objfile, symfile_debug_objfile_data_key);
346 fprintf_filtered (gdb_stdlog,
347 "qf->map_symbol_filenames (%s, %s, %s, %d)\n",
cc485e62 348 objfile_debug_name (objfile),
8fb8eb5c
DE
349 host_address_to_string (fun),
350 host_address_to_string (data),
351 need_fullname);
352
353 debug_data->real_sf->qf->map_symbol_filenames (objfile, fun, data,
354 need_fullname);
355}
356
357static const struct quick_symbol_functions debug_sym_quick_functions =
358{
359 debug_qf_has_symbols,
360 debug_qf_find_last_source_symtab,
361 debug_qf_forget_cached_source_info,
362 debug_qf_map_symtabs_matching_filename,
363 debug_qf_lookup_symbol,
364 debug_qf_print_stats,
365 debug_qf_dump,
366 debug_qf_relocate,
367 debug_qf_expand_symtabs_for_function,
368 debug_qf_expand_all_symtabs,
369 debug_qf_expand_symtabs_with_fullname,
370 debug_qf_map_matching_symbols,
371 debug_qf_expand_symtabs_matching,
43f3e411 372 debug_qf_find_pc_sect_compunit_symtab,
8fb8eb5c
DE
373 debug_qf_map_symbol_filenames
374};
375\f
376/* Debugging version of struct sym_probe_fns. */
377
378static VEC (probe_p) *
379debug_sym_get_probes (struct objfile *objfile)
380{
381 const struct debug_sym_fns_data *debug_data =
382 objfile_data (objfile, symfile_debug_objfile_data_key);
383 VEC (probe_p) *retval;
384
385 retval = debug_data->real_sf->sym_probe_fns->sym_get_probes (objfile);
386
387 fprintf_filtered (gdb_stdlog,
388 "probes->sym_get_probes (%s) = %s\n",
cc485e62 389 objfile_debug_name (objfile),
8fb8eb5c
DE
390 host_address_to_string (retval));
391
392 return retval;
393}
394
8fb8eb5c
DE
395static const struct sym_probe_fns debug_sym_probe_fns =
396{
397 debug_sym_get_probes,
8fb8eb5c
DE
398};
399\f
400/* Debugging version of struct sym_fns. */
401
402static void
403debug_sym_new_init (struct objfile *objfile)
404{
405 const struct debug_sym_fns_data *debug_data =
406 objfile_data (objfile, symfile_debug_objfile_data_key);
407
408 fprintf_filtered (gdb_stdlog, "sf->sym_new_init (%s)\n",
cc485e62 409 objfile_debug_name (objfile));
8fb8eb5c
DE
410
411 debug_data->real_sf->sym_new_init (objfile);
412}
413
414static void
415debug_sym_init (struct objfile *objfile)
416{
417 const struct debug_sym_fns_data *debug_data =
418 objfile_data (objfile, symfile_debug_objfile_data_key);
419
420 fprintf_filtered (gdb_stdlog, "sf->sym_init (%s)\n",
cc485e62 421 objfile_debug_name (objfile));
8fb8eb5c
DE
422
423 debug_data->real_sf->sym_init (objfile);
424}
425
426static void
427debug_sym_read (struct objfile *objfile, int symfile_flags)
428{
429 const struct debug_sym_fns_data *debug_data =
430 objfile_data (objfile, symfile_debug_objfile_data_key);
431
432 fprintf_filtered (gdb_stdlog, "sf->sym_read (%s, 0x%x)\n",
cc485e62 433 objfile_debug_name (objfile), symfile_flags);
8fb8eb5c
DE
434
435 debug_data->real_sf->sym_read (objfile, symfile_flags);
436}
437
438static void
439debug_sym_read_psymbols (struct objfile *objfile)
440{
441 const struct debug_sym_fns_data *debug_data =
442 objfile_data (objfile, symfile_debug_objfile_data_key);
443
444 fprintf_filtered (gdb_stdlog, "sf->sym_read_psymbols (%s)\n",
cc485e62 445 objfile_debug_name (objfile));
8fb8eb5c
DE
446
447 debug_data->real_sf->sym_read_psymbols (objfile);
448}
449
450static void
451debug_sym_finish (struct objfile *objfile)
452{
453 const struct debug_sym_fns_data *debug_data =
454 objfile_data (objfile, symfile_debug_objfile_data_key);
455
456 fprintf_filtered (gdb_stdlog, "sf->sym_finish (%s)\n",
cc485e62 457 objfile_debug_name (objfile));
8fb8eb5c
DE
458
459 debug_data->real_sf->sym_finish (objfile);
460}
461
462static void
463debug_sym_offsets (struct objfile *objfile,
464 const struct section_addr_info *info)
465{
466 const struct debug_sym_fns_data *debug_data =
467 objfile_data (objfile, symfile_debug_objfile_data_key);
468
469 fprintf_filtered (gdb_stdlog, "sf->sym_offsets (%s, %s)\n",
cc485e62 470 objfile_debug_name (objfile),
8fb8eb5c
DE
471 host_address_to_string (info));
472
473 debug_data->real_sf->sym_offsets (objfile, info);
474}
475
476static struct symfile_segment_data *
477debug_sym_segments (bfd *abfd)
478{
479 /* This API function is annoying, it doesn't take a "this" pointer.
480 Fortunately it is only used in one place where we (re-)lookup the
481 sym_fns table to use. Thus we will never be called. */
482 gdb_assert_not_reached ("debug_sym_segments called");
483}
484
485static void
486debug_sym_read_linetable (struct objfile *objfile)
487{
488 const struct debug_sym_fns_data *debug_data =
489 objfile_data (objfile, symfile_debug_objfile_data_key);
490
491 fprintf_filtered (gdb_stdlog, "sf->sym_read_linetable (%s)\n",
cc485e62 492 objfile_debug_name (objfile));
8fb8eb5c
DE
493
494 debug_data->real_sf->sym_read_linetable (objfile);
495}
496
497static bfd_byte *
498debug_sym_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
499{
500 const struct debug_sym_fns_data *debug_data =
501 objfile_data (objfile, symfile_debug_objfile_data_key);
502 bfd_byte *retval;
503
504 retval = debug_data->real_sf->sym_relocate (objfile, sectp, buf);
505
506 fprintf_filtered (gdb_stdlog,
507 "sf->sym_relocate (%s, %s, %s) = %s\n",
cc485e62 508 objfile_debug_name (objfile),
8fb8eb5c
DE
509 host_address_to_string (sectp),
510 host_address_to_string (buf),
511 host_address_to_string (retval));
512
513 return retval;
514}
515
516/* Template of debugging version of struct sym_fns.
517 A copy is made, with sym_flavour updated, and a pointer to the real table
518 installed in real_sf, and then a pointer to the copy is installed in the
519 objfile. */
520
521static const struct sym_fns debug_sym_fns =
522{
523 debug_sym_new_init,
524 debug_sym_init,
525 debug_sym_read,
526 debug_sym_read_psymbols,
527 debug_sym_finish,
528 debug_sym_offsets,
529 debug_sym_segments,
530 debug_sym_read_linetable,
531 debug_sym_relocate,
532 &debug_sym_probe_fns,
533 &debug_sym_quick_functions
534};
535\f
536/* Free the copy of sym_fns recorded in the registry. */
537
538static void
539symfile_debug_free_objfile (struct objfile *objfile, void *datum)
540{
541 xfree (datum);
542}
543
544/* Install the debugging versions of the symfile functions for OBJFILE.
545 Do not call this if the debug versions are already installed. */
546
547static void
548install_symfile_debug_logging (struct objfile *objfile)
549{
550 const struct sym_fns *real_sf;
551 struct debug_sym_fns_data *debug_data;
552
553 /* The debug versions should not already be installed. */
554 gdb_assert (!symfile_debug_installed (objfile));
555
556 real_sf = objfile->sf;
557
558 /* Alas we have to preserve NULL entries in REAL_SF. */
41bf6aca 559 debug_data = XCNEW (struct debug_sym_fns_data);
8fb8eb5c
DE
560
561#define COPY_SF_PTR(from, to, name, func) \
562 do { \
563 if ((from)->name) \
564 (to)->debug_sf.name = func; \
565 } while (0)
566
567 COPY_SF_PTR (real_sf, debug_data, sym_new_init, debug_sym_new_init);
568 COPY_SF_PTR (real_sf, debug_data, sym_init, debug_sym_init);
569 COPY_SF_PTR (real_sf, debug_data, sym_read, debug_sym_read);
570 COPY_SF_PTR (real_sf, debug_data, sym_read_psymbols,
571 debug_sym_read_psymbols);
572 COPY_SF_PTR (real_sf, debug_data, sym_finish, debug_sym_finish);
573 COPY_SF_PTR (real_sf, debug_data, sym_offsets, debug_sym_offsets);
574 COPY_SF_PTR (real_sf, debug_data, sym_segments, debug_sym_segments);
575 COPY_SF_PTR (real_sf, debug_data, sym_read_linetable,
576 debug_sym_read_linetable);
577 COPY_SF_PTR (real_sf, debug_data, sym_relocate, debug_sym_relocate);
578 if (real_sf->sym_probe_fns)
579 debug_data->debug_sf.sym_probe_fns = &debug_sym_probe_fns;
580 debug_data->debug_sf.qf = &debug_sym_quick_functions;
581
582#undef COPY_SF_PTR
583
584 debug_data->real_sf = real_sf;
585 set_objfile_data (objfile, symfile_debug_objfile_data_key, debug_data);
586 objfile->sf = &debug_data->debug_sf;
587}
588
589/* Uninstall the debugging versions of the symfile functions for OBJFILE.
590 Do not call this if the debug versions are not installed. */
591
592static void
593uninstall_symfile_debug_logging (struct objfile *objfile)
594{
595 struct debug_sym_fns_data *debug_data;
596
597 /* The debug versions should be currently installed. */
598 gdb_assert (symfile_debug_installed (objfile));
599
600 debug_data = objfile_data (objfile, symfile_debug_objfile_data_key);
601
602 objfile->sf = debug_data->real_sf;
603 xfree (debug_data);
604 set_objfile_data (objfile, symfile_debug_objfile_data_key, NULL);
605}
606
607/* Call this function to set OBJFILE->SF.
608 Do not set OBJFILE->SF directly. */
609
610void
611objfile_set_sym_fns (struct objfile *objfile, const struct sym_fns *sf)
612{
613 if (symfile_debug_installed (objfile))
614 {
615 gdb_assert (debug_symfile);
616 /* Remove the current one, and reinstall a new one later. */
617 uninstall_symfile_debug_logging (objfile);
618 }
619
620 /* Assume debug logging is disabled. */
621 objfile->sf = sf;
622
623 /* Turn debug logging on if enabled. */
624 if (debug_symfile)
625 install_symfile_debug_logging (objfile);
626}
627
628static void
629set_debug_symfile (char *args, int from_tty, struct cmd_list_element *c)
630{
631 struct program_space *pspace;
632 struct objfile *objfile;
633
634 ALL_PSPACES (pspace)
635 ALL_PSPACE_OBJFILES (pspace, objfile)
636 {
637 if (debug_symfile)
638 {
639 if (!symfile_debug_installed (objfile))
640 install_symfile_debug_logging (objfile);
641 }
642 else
643 {
644 if (symfile_debug_installed (objfile))
645 uninstall_symfile_debug_logging (objfile);
646 }
647 }
648}
649
650static void
651show_debug_symfile (struct ui_file *file, int from_tty,
652 struct cmd_list_element *c, const char *value)
653{
654 fprintf_filtered (file, _("Symfile debugging is %s.\n"), value);
655}
656
657initialize_file_ftype _initialize_symfile_debug;
658
659void
660_initialize_symfile_debug (void)
661{
662 symfile_debug_objfile_data_key
663 = register_objfile_data_with_cleanup (NULL, symfile_debug_free_objfile);
664
665 add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _("\
666Set debugging of the symfile functions."), _("\
667Show debugging of the symfile functions."), _("\
668When enabled, all calls to the symfile functions are logged."),
669 set_debug_symfile, show_debug_symfile,
670 &setdebuglist, &showdebuglist);
671
672 /* Note: We don't need a new-objfile observer because debug logging
673 will be installed when objfile init'n calls objfile_set_sym_fns. */
674}
This page took 0.256226 seconds and 4 git commands to generate.