* symtab.c (lookup_symtab_1): Use lbasename (NAME) instead of
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 6cb8e963de4aa94b4a5b80cd4b02b56355286b46..108ace764d61ac350ef87890f803759226df5aed 100644 (file)
@@ -37,6 +37,7 @@
 #include "demangle.h"
 #include "inferior.h"
 #include "linespec.h"
+#include "filenames.h"         /* for FILENAME_CMP */
 
 #include "obstack.h"
 
@@ -45,6 +46,7 @@
 #include "gdb_string.h"
 #include "gdb_stat.h"
 #include <ctype.h>
+#include "cp-abi.h"
 
 /* Prototype for one function in parser-defs.h,
    instead of including that entire file. */
@@ -140,7 +142,6 @@ lookup_symtab_1 (char *name)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
-  register char *slash;
   register struct objfile *objfile;
 
 got_symtab:
@@ -148,23 +149,15 @@ got_symtab:
   /* First, search for an exact match */
 
   ALL_SYMTABS (objfile, s)
-    if (STREQ (name, s->filename))
-    return s;
-
-  slash = strchr (name, '/');
+    if (FILENAME_CMP (name, s->filename) == 0)
+      return s;
 
   /* Now, search for a matching tail (only if name doesn't have any dirs) */
 
-  if (!slash)
+  if (lbasename (name) == name)
     ALL_SYMTABS (objfile, s)
     {
-      char *p = s->filename;
-      char *tail = strrchr (p, '/');
-
-      if (tail)
-       p = tail + 1;
-
-      if (STREQ (p, name))
+      if (FILENAME_CMP (basename (s->filename), name) == 0)
        return s;
     }
 
@@ -243,7 +236,7 @@ lookup_partial_symtab (char *name)
 
   ALL_PSYMTABS (objfile, pst)
   {
-    if (STREQ (name, pst->filename))
+    if (FILENAME_CMP (name, pst->filename) == 0)
       {
        return (pst);
       }
@@ -251,16 +244,10 @@ lookup_partial_symtab (char *name)
 
   /* Now, search for a matching tail (only if name doesn't have any dirs) */
 
-  if (!strchr (name, '/'))
+  if (lbasename (name) == name)
     ALL_PSYMTABS (objfile, pst)
     {
-      char *p = pst->filename;
-      char *tail = strrchr (p, '/');
-
-      if (tail)
-       p = tail + 1;
-
-      if (STREQ (p, name))
+      if (FILENAME_CMP (basename (pst->filename), name) == 0)
        return (pst);
     }
 
@@ -288,20 +275,17 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
   int is_full_physname_constructor;
 
   int is_constructor;
-  int is_destructor = DESTRUCTOR_PREFIX_P (physname);
+  int is_destructor = is_destructor_name (physname);
   /* Need a new type prefix.  */
   char *const_prefix = method->is_const ? "C" : "";
   char *volatile_prefix = method->is_volatile ? "V" : "";
   char buf[20];
   int len = (newname == NULL ? 0 : strlen (newname));
 
-  if (OPNAME_PREFIX_P (field_name))
+  if (is_operator_name (field_name))
     return xstrdup (physname);
 
-  is_full_physname_constructor =
-    ((physname[0] == '_' && physname[1] == '_' &&
-      (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
-     || (strncmp (physname, "__ct", 4) == 0));
+  is_full_physname_constructor = is_constructor_name (physname);
 
   is_constructor =
     is_full_physname_constructor || (newname && STREQ (field_name, newname));
@@ -2660,9 +2644,17 @@ print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym,
 static void
 print_msymbol_info (struct minimal_symbol *msymbol)
 {
-  printf_filtered ("   %08lx  %s\n",
-                  (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
-                  SYMBOL_SOURCE_NAME (msymbol));
+  char *tmp;
+
+  if (TARGET_ADDR_BIT <= 32)
+    tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
+                                          & (CORE_ADDR) 0xffffffff,
+                                          "08l");
+  else
+    tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
+                                          "016l");
+  printf_filtered ("%s  %s\n",
+                  tmp, SYMBOL_SOURCE_NAME (msymbol));
 }
 
 /* This is the guts of the commands "info functions", "info types", and
This page took 0.025882 seconds and 4 git commands to generate.