aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2003-09-20 02:38:39 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2003-09-20 02:38:39 +0000
commitf4f99b11c4d67717803e4dc62e1d522c8ce9c898 (patch)
tree81244048099954e700202ed1f9ff9d18f00ebac6
parent99f24a0cc61dec97da71c8f45c7c35a68a9c66a6 (diff)
downloadgdb-f4f99b11c4d67717803e4dc62e1d522c8ce9c898.zip
gdb-f4f99b11c4d67717803e4dc62e1d522c8ce9c898.tar.gz
gdb-f4f99b11c4d67717803e4dc62e1d522c8ce9c898.tar.bz2
* win32-nat.c (mappings): Remove HAVE_SSE conditional.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/symtab.c37
-rw-r--r--gdb/win32-nat.c2
-rw-r--r--gdb/windows-nat.c2
4 files changed, 41 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 39d5a98..d4e9877 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-19 Christopher Faylor <cgf@redhat.com>
+
+ * win32-nat.c (mappings): Remove HAVE_SSE conditional.
+
2003-09-19 Jim Blandy <jimb@redhat.com>
* macrotab.c (macro_include): Use the correct comparison to find
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d984a35..9f4e72f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -434,6 +434,10 @@ create_demangled_names_hash (struct objfile *objfile)
NULL, objfile->md, xmcalloc, xmfree);
}
+#ifndef LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES
+#define LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES (0)
+#endif
+
/* Try to determine the demangled name for a symbol, based on the
language of that symbol. If the language is set to language_auto,
it will attempt to find any demangling algorithm that works and
@@ -446,6 +450,39 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
{
char *demangled = NULL;
+ /* On Windows, some functions use the `stdcall' calling convention,
+ in which the callee is expected to pop the arguments off the
+ stack. Normally, the caller takes care of this, because only the
+ caller knows how many arguments it really passed. To avoid
+ confusion, the linker symbols for `stdcall' functions have names
+ with a suffix "@N" attached to them, where "N" is the number of
+ bytes they'll pop. That way, if a caller thinks some `stdcall'
+ function `foo' expects M argument bytes, but the definition of
+ `foo' expects N argument bytes, N != M, then the call will be a
+ reference to `foo@M', but the definition will have a linker
+ symbol `foo@N', and you'll get a link-time `symbol not found'
+ error, instead of a crash at run-time.
+
+ (Note how this fails to address calls through function pointers,
+ since the byte count isn't part of the function pointer's type.
+ Go, Microsoft!)
+
+ Whatever. But our demangler doesn't like that '@N' suffix, so we
+ need to strip it off. */
+ if (LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES)
+ {
+ char *arg_byte_suffix = strchr (mangled, '@');
+ if (arg_byte_suffix)
+ {
+ int prefix_len = arg_byte_suffix - mangled;
+ char *mangled_sans_suffix = alloca (prefix_len + 1);
+ memcpy (mangled_sans_suffix, mangled, prefix_len);
+ mangled_sans_suffix[prefix_len] = '\0';
+
+ mangled = mangled_sans_suffix;
+ }
+ }
+
if (gsymbol->language == language_unknown)
gsymbol->language = language_auto;
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index f0d87ef..0fed828 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -182,7 +182,6 @@ static const int mappings[] =
context_offset (FloatSave.DataSelector),
context_offset (FloatSave.DataOffset),
context_offset (FloatSave.ErrorSelector)
-#ifdef HAVE_SSE_REGS
/* XMM0-7 */ ,
context_offset (ExtendedRegisters[10*16]),
context_offset (ExtendedRegisters[11*16]),
@@ -194,7 +193,6 @@ static const int mappings[] =
context_offset (ExtendedRegisters[17*16]),
/* MXCSR */
context_offset (ExtendedRegisters[24])
-#endif
};
#undef context_offset
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index f0d87ef..0fed828 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -182,7 +182,6 @@ static const int mappings[] =
context_offset (FloatSave.DataSelector),
context_offset (FloatSave.DataOffset),
context_offset (FloatSave.ErrorSelector)
-#ifdef HAVE_SSE_REGS
/* XMM0-7 */ ,
context_offset (ExtendedRegisters[10*16]),
context_offset (ExtendedRegisters[11*16]),
@@ -194,7 +193,6 @@ static const int mappings[] =
context_offset (ExtendedRegisters[17*16]),
/* MXCSR */
context_offset (ExtendedRegisters[24])
-#endif
};
#undef context_offset