Add debug output for recorded minsyms
authorSimon Marchi <simon.marchi@ericsson.com>
Sat, 22 Dec 2018 02:19:09 +0000 (21:19 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 22 Dec 2018 02:19:18 +0000 (21:19 -0500)
While discussing this issue:

  https://sourceware.org/ml/gdb-patches/2018-12/threads.html#00082

I added a printf gated by "set debug symtab-create" to be able to
quickly see all minimal symbols recorded by GDB.  I thought it would be
useful to have it built-in, for the future.  Here's how the output
looks:

  Recording minsym:  mst_data                         0x400780    15  _IO_stdin_used
  Recording minsym:  mst_text                         0x400700    13  __libc_csu_init
  Recording minsym:  mst_bss                          0x601058    25  _end

gdb/ChangeLog:

* minsyms.c (mst_str): New.
(minimal_symbol_reader::record_full): Add debug output.

gdb/ChangeLog
gdb/minsyms.c

index 4fcd2ebf4f65428f2c75e53c3656c619561d3636..b97500a18efb10be26f52754bdc190c709062f98 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-21  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * minsyms.c (mst_str): New.
+       (minimal_symbol_reader::record_full): Add debug output.
+
 2018-12-21  John Baldwin  <jhb@FreeBSD.org>
 
        * fbsd-nat.c (fbsd_handle_debug_trap): Require pl.pl_flags to
index 0f854422e0f7bdfc7dfb8efe2278428cdc46e72a..e0f3122a974f5547f732ffd952ee0b56ae8189fb 100644 (file)
@@ -1080,6 +1080,33 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address,
   record_with_info (name, address, ms_type, section);
 }
 
+/* Convert an enumerator of type minimal_symbol_type to its string
+   representation.  */
+
+static const char *
+mst_str (minimal_symbol_type t)
+{
+#define MST_TO_STR(x) case x: return #x;
+  switch (t)
+  {
+    MST_TO_STR (mst_unknown);
+    MST_TO_STR (mst_text);
+    MST_TO_STR (mst_text_gnu_ifunc);
+    MST_TO_STR (mst_slot_got_plt);
+    MST_TO_STR (mst_data);
+    MST_TO_STR (mst_bss);
+    MST_TO_STR (mst_abs);
+    MST_TO_STR (mst_solib_trampoline);
+    MST_TO_STR (mst_file_text);
+    MST_TO_STR (mst_file_data);
+    MST_TO_STR (mst_file_bss);
+
+    default:
+      return "mst_???";
+  }
+#undef MST_TO_STR
+}
+
 /* See minsyms.h.  */
 
 struct minimal_symbol *
@@ -1112,6 +1139,10 @@ minimal_symbol_reader::record_full (const char *name, int name_len,
   if (ms_type == mst_file_text && startswith (name, "__gnu_compiled"))
     return (NULL);
 
+  if (symtab_create_debug >= 2)
+    printf_unfiltered ("Recording minsym:  %-21s  %18s  %4d  %s\n",
+               mst_str (ms_type), hex_string (address), section, name);
+
   if (m_msym_bunch_index == BUNCH_SIZE)
     {
       newobj = XCNEW (struct msym_bunch);
This page took 0.030485 seconds and 4 git commands to generate.