Remove quick_symbol_functions::expand_symtabs_for_function
[deliverable/binutils-gdb.git] / gdb / symfile-debug.c
1 /* Debug logging for the symbol file functions for the GNU debugger, GDB.
2
3 Copyright (C) 2013-2021 Free Software Foundation, Inc.
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 "observable.h"
32 #include "source.h"
33 #include "symtab.h"
34 #include "symfile.h"
35 #include "block.h"
36 #include "filenames.h"
37
38 /* We need to save a pointer to the real symbol functions.
39 Plus, the debug versions are malloc'd because we have to NULL out the
40 ones that are NULL in the real copy. */
41
42 struct debug_sym_fns_data
43 {
44 const struct sym_fns *real_sf = nullptr;
45 struct sym_fns debug_sf {};
46 };
47
48 /* We need to record a pointer to the real set of functions for each
49 objfile. */
50 static const struct objfile_key<debug_sym_fns_data>
51 symfile_debug_objfile_data_key;
52
53 /* If true all calls to the symfile functions are logged. */
54 static bool debug_symfile = false;
55
56 /* Return non-zero if symfile debug logging is installed. */
57
58 static int
59 symfile_debug_installed (struct objfile *objfile)
60 {
61 return (objfile->sf != NULL
62 && symfile_debug_objfile_data_key.get (objfile) != NULL);
63 }
64
65 /* Utility return the name to print for SYMTAB. */
66
67 static const char *
68 debug_symtab_name (struct symtab *symtab)
69 {
70 return symtab_to_filename_for_display (symtab);
71 }
72 \f
73
74 /* See objfiles.h. */
75
76 bool
77 objfile::has_partial_symbols ()
78 {
79 bool retval = false;
80
81 /* If we have not read psymbols, but we have a function capable of reading
82 them, then that is an indication that they are in fact available. Without
83 this function the symbols may have been already read in but they also may
84 not be present in this objfile. */
85 for (const auto &iter : qf)
86 {
87 if ((flags & OBJF_PSYMTABS_READ) == 0
88 && iter->can_lazily_read_symbols ())
89 retval = true;
90 else
91 retval = iter->has_symbols (this);
92 if (retval)
93 break;
94 }
95
96 if (debug_symfile)
97 fprintf_filtered (gdb_stdlog, "qf->has_symbols (%s) = %d\n",
98 objfile_debug_name (this), retval);
99
100 return retval;
101 }
102
103 struct symtab *
104 objfile::find_last_source_symtab ()
105 {
106 struct symtab *retval = nullptr;
107
108 if (debug_symfile)
109 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (%s)\n",
110 objfile_debug_name (this));
111
112 for (const auto &iter : qf)
113 {
114 retval = iter->find_last_source_symtab (this);
115 if (retval != nullptr)
116 break;
117 }
118
119 if (debug_symfile)
120 fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (...) = %s\n",
121 retval ? debug_symtab_name (retval) : "NULL");
122
123 return retval;
124 }
125
126 void
127 objfile::forget_cached_source_info ()
128 {
129 if (debug_symfile)
130 fprintf_filtered (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
131 objfile_debug_name (this));
132
133 for (const auto &iter : qf)
134 iter->forget_cached_source_info (this);
135 }
136
137 bool
138 objfile::map_symtabs_matching_filename
139 (const char *name, const char *real_path,
140 gdb::function_view<bool (symtab *)> callback)
141 {
142 if (debug_symfile)
143 fprintf_filtered (gdb_stdlog,
144 "qf->map_symtabs_matching_filename (%s, \"%s\", "
145 "\"%s\", %s)\n",
146 objfile_debug_name (this), name,
147 real_path ? real_path : NULL,
148 host_address_to_string (&callback));
149
150 bool retval = true;
151 const char *name_basename = lbasename (name);
152
153 auto match_one_filename = [&] (const char *filename, bool basenames)
154 {
155 if (compare_filenames_for_search (filename, name))
156 return true;
157 if (basenames && FILENAME_CMP (name_basename, filename) == 0)
158 return true;
159 if (real_path != nullptr && IS_ABSOLUTE_PATH (filename)
160 && IS_ABSOLUTE_PATH (real_path))
161 return filename_cmp (filename, real_path) == 0;
162 return false;
163 };
164
165 compunit_symtab *last_made = this->compunit_symtabs;
166
167 auto on_expansion = [&] (compunit_symtab *symtab)
168 {
169 /* The callback to iterate_over_some_symtabs returns false to keep
170 going and true to continue, so we have to invert the result
171 here, for expand_symtabs_matching. */
172 bool result = !iterate_over_some_symtabs (name, real_path,
173 this->compunit_symtabs,
174 last_made,
175 callback);
176 last_made = this->compunit_symtabs;
177 return result;
178 };
179
180 for (const auto &iter : qf)
181 {
182 if (!iter->expand_symtabs_matching (this,
183 match_one_filename,
184 nullptr,
185 nullptr,
186 on_expansion,
187 (SEARCH_GLOBAL_BLOCK
188 | SEARCH_STATIC_BLOCK),
189 UNDEF_DOMAIN,
190 ALL_DOMAIN))
191 {
192 retval = false;
193 break;
194 }
195 }
196
197 if (debug_symfile)
198 fprintf_filtered (gdb_stdlog,
199 "qf->map_symtabs_matching_filename (...) = %d\n",
200 retval);
201
202 /* We must re-invert the return value here to match the caller's
203 expectations. */
204 return !retval;
205 }
206
207 struct compunit_symtab *
208 objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
209 {
210 struct compunit_symtab *retval = nullptr;
211
212 if (debug_symfile)
213 fprintf_filtered (gdb_stdlog,
214 "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
215 objfile_debug_name (this), kind, name,
216 domain_name (domain));
217
218 lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
219
220 auto search_one_symtab = [&] (compunit_symtab *stab)
221 {
222 struct symbol *sym, *with_opaque = NULL;
223 const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
224 const struct block *block = BLOCKVECTOR_BLOCK (bv, kind);
225
226 sym = block_find_symbol (block, name, domain,
227 block_find_non_opaque_type_preferred,
228 &with_opaque);
229
230 /* Some caution must be observed with overloaded functions
231 and methods, since the index will not contain any overload
232 information (but NAME might contain it). */
233
234 if (sym != NULL
235 && SYMBOL_MATCHES_SEARCH_NAME (sym, lookup_name))
236 {
237 retval = stab;
238 /* Found it. */
239 return false;
240 }
241 if (with_opaque != NULL
242 && SYMBOL_MATCHES_SEARCH_NAME (with_opaque, lookup_name))
243 retval = stab;
244
245 /* Keep looking through other psymtabs. */
246 return true;
247 };
248
249 for (const auto &iter : qf)
250 {
251 if (!iter->expand_symtabs_matching (this,
252 nullptr,
253 &lookup_name,
254 nullptr,
255 search_one_symtab,
256 kind == GLOBAL_BLOCK
257 ? SEARCH_GLOBAL_BLOCK
258 : SEARCH_STATIC_BLOCK,
259 domain,
260 ALL_DOMAIN))
261 break;
262 }
263
264 if (debug_symfile)
265 fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
266 retval
267 ? debug_symtab_name (compunit_primary_filetab (retval))
268 : "NULL");
269
270 return retval;
271 }
272
273 void
274 objfile::print_stats (bool print_bcache)
275 {
276 if (debug_symfile)
277 fprintf_filtered (gdb_stdlog, "qf->print_stats (%s, %d)\n",
278 objfile_debug_name (this), print_bcache);
279
280 for (const auto &iter : qf)
281 iter->print_stats (this, print_bcache);
282 }
283
284 void
285 objfile::dump ()
286 {
287 if (debug_symfile)
288 fprintf_filtered (gdb_stdlog, "qf->dump (%s)\n",
289 objfile_debug_name (this));
290
291 for (const auto &iter : qf)
292 iter->dump (this);
293 }
294
295 void
296 objfile::expand_symtabs_for_function (const char *func_name)
297 {
298 if (debug_symfile)
299 fprintf_filtered (gdb_stdlog,
300 "qf->expand_symtabs_for_function (%s, \"%s\")\n",
301 objfile_debug_name (this), func_name);
302
303 lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
304 lookup_name_info lookup_name = base_lookup.make_ignore_params ();
305
306 for (const auto &iter : qf)
307 iter->expand_symtabs_matching (this,
308 nullptr,
309 &lookup_name,
310 nullptr,
311 nullptr,
312 (SEARCH_GLOBAL_BLOCK
313 | SEARCH_STATIC_BLOCK),
314 VAR_DOMAIN,
315 ALL_DOMAIN);
316 }
317
318 void
319 objfile::expand_all_symtabs ()
320 {
321 if (debug_symfile)
322 fprintf_filtered (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
323 objfile_debug_name (this));
324
325 for (const auto &iter : qf)
326 iter->expand_all_symtabs (this);
327 }
328
329 void
330 objfile::expand_symtabs_with_fullname (const char *fullname)
331 {
332 if (debug_symfile)
333 fprintf_filtered (gdb_stdlog,
334 "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
335 objfile_debug_name (this), fullname);
336
337 for (const auto &iter : qf)
338 iter->expand_symtabs_with_fullname (this, fullname);
339 }
340
341 void
342 objfile::map_matching_symbols
343 (const lookup_name_info &name, domain_enum domain,
344 int global,
345 gdb::function_view<symbol_found_callback_ftype> callback,
346 symbol_compare_ftype *ordered_compare)
347 {
348 if (debug_symfile)
349 fprintf_filtered (gdb_stdlog,
350 "qf->map_matching_symbols (%s, %s, %d, %s)\n",
351 objfile_debug_name (this),
352 domain_name (domain), global,
353 host_address_to_string (ordered_compare));
354
355 for (const auto &iter : qf)
356 iter->map_matching_symbols (this, name, domain, global,
357 callback, ordered_compare);
358 }
359
360 bool
361 objfile::expand_symtabs_matching
362 (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
363 const lookup_name_info *lookup_name,
364 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
365 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
366 block_search_flags search_flags,
367 domain_enum domain,
368 enum search_domain kind)
369 {
370 if (debug_symfile)
371 fprintf_filtered (gdb_stdlog,
372 "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n",
373 objfile_debug_name (this),
374 host_address_to_string (&file_matcher),
375 host_address_to_string (&symbol_matcher),
376 host_address_to_string (&expansion_notify),
377 search_domain_name (kind));
378
379 for (const auto &iter : qf)
380 if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
381 symbol_matcher, expansion_notify,
382 search_flags, domain, kind))
383 return false;
384 return true;
385 }
386
387 struct compunit_symtab *
388 objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
389 CORE_ADDR pc,
390 struct obj_section *section,
391 int warn_if_readin)
392 {
393 struct compunit_symtab *retval = nullptr;
394
395 if (debug_symfile)
396 fprintf_filtered (gdb_stdlog,
397 "qf->find_pc_sect_compunit_symtab (%s, %s, %s, %s, %d)\n",
398 objfile_debug_name (this),
399 host_address_to_string (msymbol.minsym),
400 hex_string (pc),
401 host_address_to_string (section),
402 warn_if_readin);
403
404 for (const auto &iter : qf)
405 {
406 retval = iter->find_pc_sect_compunit_symtab (this, msymbol, pc, section,
407 warn_if_readin);
408 if (retval != nullptr)
409 break;
410 }
411
412 if (debug_symfile)
413 fprintf_filtered (gdb_stdlog,
414 "qf->find_pc_sect_compunit_symtab (...) = %s\n",
415 retval
416 ? debug_symtab_name (compunit_primary_filetab (retval))
417 : "NULL");
418
419 return retval;
420 }
421
422 void
423 objfile::map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
424 bool need_fullname)
425 {
426 if (debug_symfile)
427 fprintf_filtered (gdb_stdlog,
428 "qf->map_symbol_filenames (%s, ..., %d)\n",
429 objfile_debug_name (this),
430 need_fullname);
431
432 for (const auto &iter : qf)
433 iter->map_symbol_filenames (this, fun, need_fullname);
434 }
435
436 struct compunit_symtab *
437 objfile::find_compunit_symtab_by_address (CORE_ADDR address)
438 {
439 if (debug_symfile)
440 fprintf_filtered (gdb_stdlog,
441 "qf->find_compunit_symtab_by_address (%s, %s)\n",
442 objfile_debug_name (this),
443 hex_string (address));
444
445 struct compunit_symtab *result = NULL;
446 for (const auto &iter : qf)
447 {
448 result = iter->find_compunit_symtab_by_address (this, address);
449 if (result != nullptr)
450 break;
451 }
452
453 if (debug_symfile)
454 fprintf_filtered (gdb_stdlog,
455 "qf->find_compunit_symtab_by_address (...) = %s\n",
456 result
457 ? debug_symtab_name (compunit_primary_filetab (result))
458 : "NULL");
459
460 return result;
461 }
462
463 enum language
464 objfile::lookup_global_symbol_language (const char *name,
465 domain_enum domain,
466 bool *symbol_found_p)
467 {
468 enum language result = language_unknown;
469 *symbol_found_p = false;
470
471 for (const auto &iter : qf)
472 {
473 result = iter->lookup_global_symbol_language (this, name, domain,
474 symbol_found_p);
475 if (*symbol_found_p)
476 break;
477 }
478
479 return result;
480 }
481
482 void
483 objfile::require_partial_symbols (bool verbose)
484 {
485 if ((flags & OBJF_PSYMTABS_READ) == 0)
486 {
487 flags |= OBJF_PSYMTABS_READ;
488
489 bool printed = false;
490 for (const auto &iter : qf)
491 {
492 if (iter->can_lazily_read_symbols ())
493 {
494 if (verbose && !printed)
495 {
496 printf_filtered (_("Reading symbols from %s...\n"),
497 objfile_name (this));
498 printed = true;
499 }
500 iter->read_partial_symbols (this);
501 }
502 }
503 if (printed && !objfile_has_symbols (this))
504 printf_filtered (_("(No debugging symbols found in %s)\n"),
505 objfile_name (this));
506 }
507 }
508
509 \f
510 /* Debugging version of struct sym_probe_fns. */
511
512 static const std::vector<std::unique_ptr<probe>> &
513 debug_sym_get_probes (struct objfile *objfile)
514 {
515 const struct debug_sym_fns_data *debug_data
516 = symfile_debug_objfile_data_key.get (objfile);
517
518 const std::vector<std::unique_ptr<probe>> &retval
519 = debug_data->real_sf->sym_probe_fns->sym_get_probes (objfile);
520
521 fprintf_filtered (gdb_stdlog,
522 "probes->sym_get_probes (%s) = %s\n",
523 objfile_debug_name (objfile),
524 host_address_to_string (retval.data ()));
525
526 return retval;
527 }
528
529 static const struct sym_probe_fns debug_sym_probe_fns =
530 {
531 debug_sym_get_probes,
532 };
533 \f
534 /* Debugging version of struct sym_fns. */
535
536 static void
537 debug_sym_new_init (struct objfile *objfile)
538 {
539 const struct debug_sym_fns_data *debug_data
540 = symfile_debug_objfile_data_key.get (objfile);
541
542 fprintf_filtered (gdb_stdlog, "sf->sym_new_init (%s)\n",
543 objfile_debug_name (objfile));
544
545 debug_data->real_sf->sym_new_init (objfile);
546 }
547
548 static void
549 debug_sym_init (struct objfile *objfile)
550 {
551 const struct debug_sym_fns_data *debug_data
552 = symfile_debug_objfile_data_key.get (objfile);
553
554 fprintf_filtered (gdb_stdlog, "sf->sym_init (%s)\n",
555 objfile_debug_name (objfile));
556
557 debug_data->real_sf->sym_init (objfile);
558 }
559
560 static void
561 debug_sym_read (struct objfile *objfile, symfile_add_flags symfile_flags)
562 {
563 const struct debug_sym_fns_data *debug_data
564 = symfile_debug_objfile_data_key.get (objfile);
565
566 fprintf_filtered (gdb_stdlog, "sf->sym_read (%s, 0x%x)\n",
567 objfile_debug_name (objfile), (unsigned) symfile_flags);
568
569 debug_data->real_sf->sym_read (objfile, symfile_flags);
570 }
571
572 static void
573 debug_sym_finish (struct objfile *objfile)
574 {
575 const struct debug_sym_fns_data *debug_data
576 = symfile_debug_objfile_data_key.get (objfile);
577
578 fprintf_filtered (gdb_stdlog, "sf->sym_finish (%s)\n",
579 objfile_debug_name (objfile));
580
581 debug_data->real_sf->sym_finish (objfile);
582 }
583
584 static void
585 debug_sym_offsets (struct objfile *objfile,
586 const section_addr_info &info)
587 {
588 const struct debug_sym_fns_data *debug_data
589 = symfile_debug_objfile_data_key.get (objfile);
590
591 fprintf_filtered (gdb_stdlog, "sf->sym_offsets (%s, %s)\n",
592 objfile_debug_name (objfile),
593 host_address_to_string (&info));
594
595 debug_data->real_sf->sym_offsets (objfile, info);
596 }
597
598 static symfile_segment_data_up
599 debug_sym_segments (bfd *abfd)
600 {
601 /* This API function is annoying, it doesn't take a "this" pointer.
602 Fortunately it is only used in one place where we (re-)lookup the
603 sym_fns table to use. Thus we will never be called. */
604 gdb_assert_not_reached ("debug_sym_segments called");
605 }
606
607 static void
608 debug_sym_read_linetable (struct objfile *objfile)
609 {
610 const struct debug_sym_fns_data *debug_data
611 = symfile_debug_objfile_data_key.get (objfile);
612
613 fprintf_filtered (gdb_stdlog, "sf->sym_read_linetable (%s)\n",
614 objfile_debug_name (objfile));
615
616 debug_data->real_sf->sym_read_linetable (objfile);
617 }
618
619 static bfd_byte *
620 debug_sym_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
621 {
622 const struct debug_sym_fns_data *debug_data
623 = symfile_debug_objfile_data_key.get (objfile);
624 bfd_byte *retval;
625
626 retval = debug_data->real_sf->sym_relocate (objfile, sectp, buf);
627
628 fprintf_filtered (gdb_stdlog,
629 "sf->sym_relocate (%s, %s, %s) = %s\n",
630 objfile_debug_name (objfile),
631 host_address_to_string (sectp),
632 host_address_to_string (buf),
633 host_address_to_string (retval));
634
635 return retval;
636 }
637
638 /* Template of debugging version of struct sym_fns.
639 A copy is made, with sym_flavour updated, and a pointer to the real table
640 installed in real_sf, and then a pointer to the copy is installed in the
641 objfile. */
642
643 static const struct sym_fns debug_sym_fns =
644 {
645 debug_sym_new_init,
646 debug_sym_init,
647 debug_sym_read,
648 debug_sym_finish,
649 debug_sym_offsets,
650 debug_sym_segments,
651 debug_sym_read_linetable,
652 debug_sym_relocate,
653 &debug_sym_probe_fns,
654 };
655 \f
656 /* Install the debugging versions of the symfile functions for OBJFILE.
657 Do not call this if the debug versions are already installed. */
658
659 static void
660 install_symfile_debug_logging (struct objfile *objfile)
661 {
662 const struct sym_fns *real_sf;
663 struct debug_sym_fns_data *debug_data;
664
665 /* The debug versions should not already be installed. */
666 gdb_assert (!symfile_debug_installed (objfile));
667
668 real_sf = objfile->sf;
669
670 /* Alas we have to preserve NULL entries in REAL_SF. */
671 debug_data = new struct debug_sym_fns_data;
672
673 #define COPY_SF_PTR(from, to, name, func) \
674 do { \
675 if ((from)->name) \
676 (to)->debug_sf.name = func; \
677 } while (0)
678
679 COPY_SF_PTR (real_sf, debug_data, sym_new_init, debug_sym_new_init);
680 COPY_SF_PTR (real_sf, debug_data, sym_init, debug_sym_init);
681 COPY_SF_PTR (real_sf, debug_data, sym_read, debug_sym_read);
682 COPY_SF_PTR (real_sf, debug_data, sym_finish, debug_sym_finish);
683 COPY_SF_PTR (real_sf, debug_data, sym_offsets, debug_sym_offsets);
684 COPY_SF_PTR (real_sf, debug_data, sym_segments, debug_sym_segments);
685 COPY_SF_PTR (real_sf, debug_data, sym_read_linetable,
686 debug_sym_read_linetable);
687 COPY_SF_PTR (real_sf, debug_data, sym_relocate, debug_sym_relocate);
688 if (real_sf->sym_probe_fns)
689 debug_data->debug_sf.sym_probe_fns = &debug_sym_probe_fns;
690
691 #undef COPY_SF_PTR
692
693 debug_data->real_sf = real_sf;
694 symfile_debug_objfile_data_key.set (objfile, debug_data);
695 objfile->sf = &debug_data->debug_sf;
696 }
697
698 /* Uninstall the debugging versions of the symfile functions for OBJFILE.
699 Do not call this if the debug versions are not installed. */
700
701 static void
702 uninstall_symfile_debug_logging (struct objfile *objfile)
703 {
704 struct debug_sym_fns_data *debug_data;
705
706 /* The debug versions should be currently installed. */
707 gdb_assert (symfile_debug_installed (objfile));
708
709 debug_data = symfile_debug_objfile_data_key.get (objfile);
710
711 objfile->sf = debug_data->real_sf;
712 symfile_debug_objfile_data_key.clear (objfile);
713 }
714
715 /* Call this function to set OBJFILE->SF.
716 Do not set OBJFILE->SF directly. */
717
718 void
719 objfile_set_sym_fns (struct objfile *objfile, const struct sym_fns *sf)
720 {
721 if (symfile_debug_installed (objfile))
722 {
723 gdb_assert (debug_symfile);
724 /* Remove the current one, and reinstall a new one later. */
725 uninstall_symfile_debug_logging (objfile);
726 }
727
728 /* Assume debug logging is disabled. */
729 objfile->sf = sf;
730
731 /* Turn debug logging on if enabled. */
732 if (debug_symfile)
733 install_symfile_debug_logging (objfile);
734 }
735
736 static void
737 set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
738 {
739 for (struct program_space *pspace : program_spaces)
740 for (objfile *objfile : pspace->objfiles ())
741 {
742 if (debug_symfile)
743 {
744 if (!symfile_debug_installed (objfile))
745 install_symfile_debug_logging (objfile);
746 }
747 else
748 {
749 if (symfile_debug_installed (objfile))
750 uninstall_symfile_debug_logging (objfile);
751 }
752 }
753 }
754
755 static void
756 show_debug_symfile (struct ui_file *file, int from_tty,
757 struct cmd_list_element *c, const char *value)
758 {
759 fprintf_filtered (file, _("Symfile debugging is %s.\n"), value);
760 }
761
762 void _initialize_symfile_debug ();
763 void
764 _initialize_symfile_debug ()
765 {
766 add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _("\
767 Set debugging of the symfile functions."), _("\
768 Show debugging of the symfile functions."), _("\
769 When enabled, all calls to the symfile functions are logged."),
770 set_debug_symfile, show_debug_symfile,
771 &setdebuglist, &showdebuglist);
772
773 /* Note: We don't need a new-objfile observer because debug logging
774 will be installed when objfile init'n calls objfile_set_sym_fns. */
775 }
This page took 0.052041 seconds and 4 git commands to generate.