]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/symfile-debug.c
Remove sym_fns::sym_read_psymbols
[thirdparty/binutils-gdb.git] / gdb / symfile-debug.c
CommitLineData
8fb8eb5c
DE
1/* Debug logging for the symbol file functions for the GNU debugger, GDB.
2
3666a048 3 Copyright (C) 2013-2021 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"
76727919 31#include "observable.h"
8fb8eb5c
DE
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{
8c42777c
TT
42 const struct sym_fns *real_sf = nullptr;
43 struct sym_fns debug_sf {};
8fb8eb5c
DE
44};
45
46/* We need to record a pointer to the real set of functions for each
47 objfile. */
8c42777c
TT
48static const struct objfile_key<debug_sym_fns_data>
49 symfile_debug_objfile_data_key;
8fb8eb5c 50
491144b5
CB
51/* If true all calls to the symfile functions are logged. */
52static bool debug_symfile = false;
8fb8eb5c
DE
53
54/* Return non-zero if symfile debug logging is installed. */
55
56static int
57symfile_debug_installed (struct objfile *objfile)
58{
59 return (objfile->sf != NULL
8c42777c 60 && symfile_debug_objfile_data_key.get (objfile) != NULL);
8fb8eb5c
DE
61}
62
8fb8eb5c
DE
63/* Utility return the name to print for SYMTAB. */
64
65static const char *
66debug_symtab_name (struct symtab *symtab)
67{
68 return symtab_to_filename_for_display (symtab);
69}
70\f
8fb8eb5c 71
4d080b46
TT
72/* See objfiles.h. */
73
74bool
75objfile::has_partial_symbols ()
8fb8eb5c 76{
4d080b46 77 bool retval = false;
8fb8eb5c 78
4d080b46
TT
79 /* If we have not read psymbols, but we have a function capable of reading
80 them, then that is an indication that they are in fact available. Without
81 this function the symbols may have been already read in but they also may
82 not be present in this objfile. */
83 if ((flags & OBJF_PSYMTABS_READ) == 0
eb00e468
TT
84 && qf != nullptr
85 && qf->can_lazily_read_symbols ())
4d080b46 86 retval = true;
5c3f1e5b
TT
87 else if (qf != nullptr)
88 retval = qf->has_symbols (this);
8fb8eb5c 89
4d080b46
TT
90 if (debug_symfile)
91 fprintf_filtered (gdb_stdlog, "qf->has_symbols (%s) = %d\n",
92 objfile_debug_name (this), retval);
8fb8eb5c
DE
93
94 return retval;
95}
96
4d080b46
TT
97struct symtab *
98objfile::find_last_source_symtab ()
8fb8eb5c 99{
4d080b46 100 struct symtab *retval = nullptr;
8fb8eb5c 101
4d080b46
TT
102 if (debug_symfile)
103 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (%s)\n",
104 objfile_debug_name (this));
8fb8eb5c 105
5c3f1e5b
TT
106 if (qf != nullptr)
107 retval = qf->find_last_source_symtab (this);
8fb8eb5c 108
4d080b46
TT
109 if (debug_symfile)
110 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (...) = %s\n",
111 retval ? debug_symtab_name (retval) : "NULL");
8fb8eb5c
DE
112
113 return retval;
114}
115
4d080b46
TT
116void
117objfile::forget_cached_source_info ()
8fb8eb5c 118{
4d080b46
TT
119 if (debug_symfile)
120 fprintf_filtered (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
121 objfile_debug_name (this));
8fb8eb5c 122
5c3f1e5b
TT
123 if (qf != nullptr)
124 qf->forget_cached_source_info (this);
8fb8eb5c
DE
125}
126
4d080b46
TT
127bool
128objfile::map_symtabs_matching_filename
129 (const char *name, const char *real_path,
14bc53a8 130 gdb::function_view<bool (symtab *)> callback)
8fb8eb5c 131{
4d080b46
TT
132 if (debug_symfile)
133 fprintf_filtered (gdb_stdlog,
134 "qf->map_symtabs_matching_filename (%s, \"%s\", "
135 "\"%s\", %s)\n",
136 objfile_debug_name (this), name,
137 real_path ? real_path : NULL,
138 host_address_to_string (&callback));
8fb8eb5c 139
4d080b46 140 bool retval = false;
5c3f1e5b
TT
141 if (qf != nullptr)
142 retval = (qf->map_symtabs_matching_filename
4d080b46 143 (this, name, real_path, callback));
8fb8eb5c 144
4d080b46
TT
145 if (debug_symfile)
146 fprintf_filtered (gdb_stdlog,
147 "qf->map_symtabs_matching_filename (...) = %d\n",
148 retval);
8fb8eb5c
DE
149
150 return retval;
151}
152
4d080b46
TT
153struct compunit_symtab *
154objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
8fb8eb5c 155{
4d080b46 156 struct compunit_symtab *retval = nullptr;
8fb8eb5c 157
4d080b46
TT
158 if (debug_symfile)
159 fprintf_filtered (gdb_stdlog,
160 "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
161 objfile_debug_name (this), kind, name,
162 domain_name (domain));
8fb8eb5c 163
5c3f1e5b
TT
164 if (qf != nullptr)
165 retval = qf->lookup_symbol (this, kind, name, domain);
8fb8eb5c 166
4d080b46
TT
167 if (debug_symfile)
168 fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
169 retval
170 ? debug_symtab_name (compunit_primary_filetab (retval))
171 : "NULL");
8fb8eb5c
DE
172
173 return retval;
174}
175
4d080b46 176void
4829711b 177objfile::print_stats (bool print_bcache)
8fb8eb5c 178{
4d080b46 179 if (debug_symfile)
4829711b
TT
180 fprintf_filtered (gdb_stdlog, "qf->print_stats (%s, %d)\n",
181 objfile_debug_name (this), print_bcache);
8fb8eb5c 182
5c3f1e5b 183 if (qf != nullptr)
4829711b 184 qf->print_stats (this, print_bcache);
8fb8eb5c
DE
185}
186
4d080b46
TT
187void
188objfile::dump ()
8fb8eb5c 189{
4d080b46
TT
190 if (debug_symfile)
191 fprintf_filtered (gdb_stdlog, "qf->dump (%s)\n",
192 objfile_debug_name (this));
8fb8eb5c 193
5c3f1e5b
TT
194 if (qf != nullptr)
195 qf->dump (this);
8fb8eb5c
DE
196}
197
4d080b46
TT
198void
199objfile::expand_symtabs_for_function (const char *func_name)
8fb8eb5c 200{
4d080b46
TT
201 if (debug_symfile)
202 fprintf_filtered (gdb_stdlog,
203 "qf->expand_symtabs_for_function (%s, \"%s\")\n",
204 objfile_debug_name (this), func_name);
8fb8eb5c 205
5c3f1e5b
TT
206 if (qf != nullptr)
207 qf->expand_symtabs_for_function (this, func_name);
8fb8eb5c
DE
208}
209
4d080b46
TT
210void
211objfile::expand_all_symtabs ()
8fb8eb5c 212{
4d080b46
TT
213 if (debug_symfile)
214 fprintf_filtered (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
215 objfile_debug_name (this));
8fb8eb5c 216
5c3f1e5b
TT
217 if (qf != nullptr)
218 qf->expand_all_symtabs (this);
8fb8eb5c
DE
219}
220
4d080b46
TT
221void
222objfile::expand_symtabs_with_fullname (const char *fullname)
8fb8eb5c 223{
4d080b46
TT
224 if (debug_symfile)
225 fprintf_filtered (gdb_stdlog,
226 "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
227 objfile_debug_name (this), fullname);
8fb8eb5c 228
5c3f1e5b
TT
229 if (qf != nullptr)
230 qf->expand_symtabs_with_fullname (this, fullname);
8fb8eb5c
DE
231}
232
4d080b46
TT
233void
234objfile::map_matching_symbols
235 (const lookup_name_info &name, domain_enum domain,
199b4314
TT
236 int global,
237 gdb::function_view<symbol_found_callback_ftype> callback,
199b4314 238 symbol_compare_ftype *ordered_compare)
8fb8eb5c 239{
4d080b46
TT
240 if (debug_symfile)
241 fprintf_filtered (gdb_stdlog,
242 "qf->map_matching_symbols (%s, %s, %d, %s)\n",
243 objfile_debug_name (this),
244 domain_name (domain), global,
245 host_address_to_string (ordered_compare));
8fb8eb5c 246
5c3f1e5b
TT
247 if (qf != nullptr)
248 qf->map_matching_symbols (this, name, domain, global,
249 callback, ordered_compare);
8fb8eb5c
DE
250}
251
4d080b46
TT
252void
253objfile::expand_symtabs_matching
254 (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
c1a66c06 255 const lookup_name_info *lookup_name,
14bc53a8
PA
256 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
257 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
258 enum search_domain kind)
8fb8eb5c 259{
4d080b46
TT
260 if (debug_symfile)
261 fprintf_filtered (gdb_stdlog,
262 "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n",
263 objfile_debug_name (this),
264 host_address_to_string (&file_matcher),
265 host_address_to_string (&symbol_matcher),
266 host_address_to_string (&expansion_notify),
267 search_domain_name (kind));
268
5c3f1e5b
TT
269 if (qf != nullptr)
270 qf->expand_symtabs_matching (this, file_matcher, lookup_name,
271 symbol_matcher, expansion_notify, kind);
8fb8eb5c
DE
272}
273
4d080b46
TT
274struct compunit_symtab *
275objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
43f3e411
DE
276 CORE_ADDR pc,
277 struct obj_section *section,
278 int warn_if_readin)
8fb8eb5c 279{
4d080b46
TT
280 struct compunit_symtab *retval = nullptr;
281
282 if (debug_symfile)
283 fprintf_filtered (gdb_stdlog,
284 "qf->find_pc_sect_compunit_symtab (%s, %s, %s, %s, %d)\n",
285 objfile_debug_name (this),
286 host_address_to_string (msymbol.minsym),
287 hex_string (pc),
288 host_address_to_string (section),
289 warn_if_readin);
290
5c3f1e5b
TT
291 if (qf != nullptr)
292 retval = qf->find_pc_sect_compunit_symtab (this, msymbol, pc, section,
293 warn_if_readin);
4d080b46
TT
294
295 if (debug_symfile)
296 fprintf_filtered (gdb_stdlog,
297 "qf->find_pc_sect_compunit_symtab (...) = %s\n",
298 retval
299 ? debug_symtab_name (compunit_primary_filetab (retval))
300 : "NULL");
8fb8eb5c
DE
301
302 return retval;
303}
304
4d080b46
TT
305void
306objfile::map_symbol_filenames (symbol_filename_ftype *fun, void *data,
8fb8eb5c
DE
307 int need_fullname)
308{
4d080b46
TT
309 if (debug_symfile)
310 fprintf_filtered (gdb_stdlog,
311 "qf->map_symbol_filenames (%s, %s, %s, %d)\n",
312 objfile_debug_name (this),
313 host_address_to_string (fun),
314 host_address_to_string (data),
315 need_fullname);
8fb8eb5c 316
5c3f1e5b
TT
317 if (qf != nullptr)
318 qf->map_symbol_filenames (this, fun, data, need_fullname);
8fb8eb5c
DE
319}
320
4d080b46
TT
321struct compunit_symtab *
322objfile::find_compunit_symtab_by_address (CORE_ADDR address)
71a3c369 323{
4d080b46
TT
324 if (debug_symfile)
325 fprintf_filtered (gdb_stdlog,
326 "qf->find_compunit_symtab_by_address (%s, %s)\n",
327 objfile_debug_name (this),
328 hex_string (address));
71a3c369
TT
329
330 struct compunit_symtab *result = NULL;
39298a5d 331 if (qf != nullptr)
5c3f1e5b 332 result = qf->find_compunit_symtab_by_address (this, address);
71a3c369 333
4d080b46
TT
334 if (debug_symfile)
335 fprintf_filtered (gdb_stdlog,
336 "qf->find_compunit_symtab_by_address (...) = %s\n",
337 result
338 ? debug_symtab_name (compunit_primary_filetab (result))
339 : "NULL");
340
341 return result;
342}
343
344enum language
345objfile::lookup_global_symbol_language (const char *name,
346 domain_enum domain,
347 bool *symbol_found_p)
348{
349 enum language result = language_unknown;
350
39298a5d 351 if (qf != nullptr)
5c3f1e5b
TT
352 result = qf->lookup_global_symbol_language (this, name, domain,
353 symbol_found_p);
4d080b46
TT
354 else
355 *symbol_found_p = false;
71a3c369
TT
356
357 return result;
358}
359
8fb8eb5c
DE
360\f
361/* Debugging version of struct sym_probe_fns. */
362
814cf43a 363static const std::vector<std::unique_ptr<probe>> &
8fb8eb5c
DE
364debug_sym_get_probes (struct objfile *objfile)
365{
19ba03f4 366 const struct debug_sym_fns_data *debug_data
8c42777c 367 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c 368
814cf43a 369 const std::vector<std::unique_ptr<probe>> &retval
aaa63a31 370 = debug_data->real_sf->sym_probe_fns->sym_get_probes (objfile);
8fb8eb5c
DE
371
372 fprintf_filtered (gdb_stdlog,
373 "probes->sym_get_probes (%s) = %s\n",
cc485e62 374 objfile_debug_name (objfile),
aaa63a31 375 host_address_to_string (retval.data ()));
8fb8eb5c
DE
376
377 return retval;
378}
379
8fb8eb5c
DE
380static const struct sym_probe_fns debug_sym_probe_fns =
381{
382 debug_sym_get_probes,
8fb8eb5c
DE
383};
384\f
385/* Debugging version of struct sym_fns. */
386
387static void
388debug_sym_new_init (struct objfile *objfile)
389{
19ba03f4 390 const struct debug_sym_fns_data *debug_data
8c42777c 391 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
392
393 fprintf_filtered (gdb_stdlog, "sf->sym_new_init (%s)\n",
cc485e62 394 objfile_debug_name (objfile));
8fb8eb5c
DE
395
396 debug_data->real_sf->sym_new_init (objfile);
397}
398
399static void
400debug_sym_init (struct objfile *objfile)
401{
19ba03f4 402 const struct debug_sym_fns_data *debug_data
8c42777c 403 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
404
405 fprintf_filtered (gdb_stdlog, "sf->sym_init (%s)\n",
cc485e62 406 objfile_debug_name (objfile));
8fb8eb5c
DE
407
408 debug_data->real_sf->sym_init (objfile);
409}
410
411static void
b15cc25c 412debug_sym_read (struct objfile *objfile, symfile_add_flags symfile_flags)
8fb8eb5c 413{
19ba03f4 414 const struct debug_sym_fns_data *debug_data
8c42777c 415 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
416
417 fprintf_filtered (gdb_stdlog, "sf->sym_read (%s, 0x%x)\n",
b15cc25c 418 objfile_debug_name (objfile), (unsigned) symfile_flags);
8fb8eb5c
DE
419
420 debug_data->real_sf->sym_read (objfile, symfile_flags);
421}
422
8fb8eb5c
DE
423static void
424debug_sym_finish (struct objfile *objfile)
425{
19ba03f4 426 const struct debug_sym_fns_data *debug_data
8c42777c 427 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
428
429 fprintf_filtered (gdb_stdlog, "sf->sym_finish (%s)\n",
cc485e62 430 objfile_debug_name (objfile));
8fb8eb5c
DE
431
432 debug_data->real_sf->sym_finish (objfile);
433}
434
435static void
436debug_sym_offsets (struct objfile *objfile,
37e136b1 437 const section_addr_info &info)
8fb8eb5c 438{
19ba03f4 439 const struct debug_sym_fns_data *debug_data
8c42777c 440 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
441
442 fprintf_filtered (gdb_stdlog, "sf->sym_offsets (%s, %s)\n",
cc485e62 443 objfile_debug_name (objfile),
37e136b1 444 host_address_to_string (&info));
8fb8eb5c
DE
445
446 debug_data->real_sf->sym_offsets (objfile, info);
447}
448
62982abd 449static symfile_segment_data_up
8fb8eb5c
DE
450debug_sym_segments (bfd *abfd)
451{
452 /* This API function is annoying, it doesn't take a "this" pointer.
453 Fortunately it is only used in one place where we (re-)lookup the
454 sym_fns table to use. Thus we will never be called. */
455 gdb_assert_not_reached ("debug_sym_segments called");
456}
457
458static void
459debug_sym_read_linetable (struct objfile *objfile)
460{
19ba03f4 461 const struct debug_sym_fns_data *debug_data
8c42777c 462 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
463
464 fprintf_filtered (gdb_stdlog, "sf->sym_read_linetable (%s)\n",
cc485e62 465 objfile_debug_name (objfile));
8fb8eb5c
DE
466
467 debug_data->real_sf->sym_read_linetable (objfile);
468}
469
470static bfd_byte *
471debug_sym_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
472{
19ba03f4 473 const struct debug_sym_fns_data *debug_data
8c42777c 474 = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
475 bfd_byte *retval;
476
477 retval = debug_data->real_sf->sym_relocate (objfile, sectp, buf);
478
479 fprintf_filtered (gdb_stdlog,
480 "sf->sym_relocate (%s, %s, %s) = %s\n",
cc485e62 481 objfile_debug_name (objfile),
8fb8eb5c
DE
482 host_address_to_string (sectp),
483 host_address_to_string (buf),
484 host_address_to_string (retval));
485
486 return retval;
487}
488
489/* Template of debugging version of struct sym_fns.
490 A copy is made, with sym_flavour updated, and a pointer to the real table
491 installed in real_sf, and then a pointer to the copy is installed in the
492 objfile. */
493
494static const struct sym_fns debug_sym_fns =
495{
496 debug_sym_new_init,
497 debug_sym_init,
498 debug_sym_read,
8fb8eb5c
DE
499 debug_sym_finish,
500 debug_sym_offsets,
501 debug_sym_segments,
502 debug_sym_read_linetable,
503 debug_sym_relocate,
504 &debug_sym_probe_fns,
8fb8eb5c
DE
505};
506\f
8fb8eb5c
DE
507/* Install the debugging versions of the symfile functions for OBJFILE.
508 Do not call this if the debug versions are already installed. */
509
510static void
511install_symfile_debug_logging (struct objfile *objfile)
512{
513 const struct sym_fns *real_sf;
514 struct debug_sym_fns_data *debug_data;
515
516 /* The debug versions should not already be installed. */
517 gdb_assert (!symfile_debug_installed (objfile));
518
519 real_sf = objfile->sf;
520
521 /* Alas we have to preserve NULL entries in REAL_SF. */
8c42777c 522 debug_data = new struct debug_sym_fns_data;
8fb8eb5c
DE
523
524#define COPY_SF_PTR(from, to, name, func) \
525 do { \
526 if ((from)->name) \
527 (to)->debug_sf.name = func; \
528 } while (0)
529
530 COPY_SF_PTR (real_sf, debug_data, sym_new_init, debug_sym_new_init);
531 COPY_SF_PTR (real_sf, debug_data, sym_init, debug_sym_init);
532 COPY_SF_PTR (real_sf, debug_data, sym_read, debug_sym_read);
8fb8eb5c
DE
533 COPY_SF_PTR (real_sf, debug_data, sym_finish, debug_sym_finish);
534 COPY_SF_PTR (real_sf, debug_data, sym_offsets, debug_sym_offsets);
535 COPY_SF_PTR (real_sf, debug_data, sym_segments, debug_sym_segments);
536 COPY_SF_PTR (real_sf, debug_data, sym_read_linetable,
537 debug_sym_read_linetable);
538 COPY_SF_PTR (real_sf, debug_data, sym_relocate, debug_sym_relocate);
539 if (real_sf->sym_probe_fns)
540 debug_data->debug_sf.sym_probe_fns = &debug_sym_probe_fns;
8fb8eb5c
DE
541
542#undef COPY_SF_PTR
543
544 debug_data->real_sf = real_sf;
8c42777c 545 symfile_debug_objfile_data_key.set (objfile, debug_data);
8fb8eb5c
DE
546 objfile->sf = &debug_data->debug_sf;
547}
548
549/* Uninstall the debugging versions of the symfile functions for OBJFILE.
550 Do not call this if the debug versions are not installed. */
551
552static void
553uninstall_symfile_debug_logging (struct objfile *objfile)
554{
555 struct debug_sym_fns_data *debug_data;
556
557 /* The debug versions should be currently installed. */
558 gdb_assert (symfile_debug_installed (objfile));
559
8c42777c 560 debug_data = symfile_debug_objfile_data_key.get (objfile);
8fb8eb5c
DE
561
562 objfile->sf = debug_data->real_sf;
8c42777c 563 symfile_debug_objfile_data_key.clear (objfile);
8fb8eb5c
DE
564}
565
566/* Call this function to set OBJFILE->SF.
567 Do not set OBJFILE->SF directly. */
568
569void
570objfile_set_sym_fns (struct objfile *objfile, const struct sym_fns *sf)
571{
572 if (symfile_debug_installed (objfile))
573 {
574 gdb_assert (debug_symfile);
575 /* Remove the current one, and reinstall a new one later. */
576 uninstall_symfile_debug_logging (objfile);
577 }
578
579 /* Assume debug logging is disabled. */
580 objfile->sf = sf;
581
582 /* Turn debug logging on if enabled. */
583 if (debug_symfile)
584 install_symfile_debug_logging (objfile);
585}
586
587static void
eb4c3f4a 588set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
8fb8eb5c 589{
94c93c35 590 for (struct program_space *pspace : program_spaces)
2030c079 591 for (objfile *objfile : pspace->objfiles ())
99d89cde
TT
592 {
593 if (debug_symfile)
594 {
595 if (!symfile_debug_installed (objfile))
596 install_symfile_debug_logging (objfile);
597 }
598 else
599 {
600 if (symfile_debug_installed (objfile))
601 uninstall_symfile_debug_logging (objfile);
602 }
603 }
8fb8eb5c
DE
604}
605
606static void
607show_debug_symfile (struct ui_file *file, int from_tty,
608 struct cmd_list_element *c, const char *value)
609{
610 fprintf_filtered (file, _("Symfile debugging is %s.\n"), value);
611}
612
6c265988 613void _initialize_symfile_debug ();
8fb8eb5c 614void
6c265988 615_initialize_symfile_debug ()
8fb8eb5c 616{
8fb8eb5c
DE
617 add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _("\
618Set debugging of the symfile functions."), _("\
619Show debugging of the symfile functions."), _("\
620When enabled, all calls to the symfile functions are logged."),
621 set_debug_symfile, show_debug_symfile,
622 &setdebuglist, &showdebuglist);
623
624 /* Note: We don't need a new-objfile observer because debug logging
625 will be installed when objfile init'n calls objfile_set_sym_fns. */
626}