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