aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2009-04-18 08:16:34 +0000
committerEli Zaretskii <eliz@gnu.org>2009-04-18 08:16:34 +0000
commitd647eed6d56c7cf8cfa4fb35e610e7d7433760b8 (patch)
tree9c9a2af9cd4debabb820c8b4aad9d2398d7c8d29
parent45be3704c822b201bb2ec4734a550237f3aa2f74 (diff)
downloadgdb-d647eed6d56c7cf8cfa4fb35e610e7d7433760b8.zip
gdb-d647eed6d56c7cf8cfa4fb35e610e7d7433760b8.tar.gz
gdb-d647eed6d56c7cf8cfa4fb35e610e7d7433760b8.tar.bz2
* go32-nat.c (go32_sysinfo): Check if the call to
__dpmi_get_capabilities fills the buffer with information, and don't use the buffer if not.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/go32-nat.c19
2 files changed, 22 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f0cbe8e..d24dbb2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-18 Eli Zaretskii <eliz@gnu.org>
+
+ * go32-nat.c (go32_sysinfo): Check if the call to
+ __dpmi_get_capabilities fills the buffer with information, and
+ don't use the buffer if not.
+
2009-04-17 Tom Tromey <tromey@redhat.com>
* charset.c (_initialize_charset): Add special case for "646".
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index f5dd8b7..267df62 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -983,6 +983,10 @@ print_mem (unsigned long datum, const char *header, int in_pages_p)
static void
go32_sysinfo (char *arg, int from_tty)
{
+ static const char test_pattern[] =
+ "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
+ "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
+ "deadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeaf";
struct utsname u;
char cpuid_vendor[13];
unsigned cpuid_max = 0, cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
@@ -990,8 +994,7 @@ go32_sysinfo (char *arg, int from_tty)
unsigned advertized_dos_version = ((unsigned int)_osmajor << 8) | _osminor;
int dpmi_flags;
char dpmi_vendor_info[129];
- int dpmi_vendor_available =
- __dpmi_get_capabilities (&dpmi_flags, dpmi_vendor_info);
+ int dpmi_vendor_available;
__dpmi_version_ret dpmi_version_data;
long eflags;
__dpmi_free_mem_info mem_info;
@@ -1218,7 +1221,15 @@ go32_sysinfo (char *arg, int from_tty)
else if (true_dos_version == 0x532 && advertized_dos_version == 0x500)
printf_filtered ("Windows Version................Windows NT family (W2K/XP/W2K3/Vista/W2K8)\n");
puts_filtered ("\n");
- if (dpmi_vendor_available == 0)
+ /* On some versions of Windows, __dpmi_get_capabilities returns
+ zero, but the buffer is not filled with info, so we fill the
+ buffer with a known pattern and test for it afterwards. */
+ memcpy (dpmi_vendor_info, test_pattern, sizeof(dpmi_vendor_info));
+ dpmi_vendor_available =
+ __dpmi_get_capabilities (&dpmi_flags, dpmi_vendor_info);
+ if (dpmi_vendor_available == 0
+ && memcmp (dpmi_vendor_info, test_pattern,
+ sizeof(dpmi_vendor_info)) != 0)
{
/* The DPMI spec says the vendor string should be ASCIIZ, but
I don't trust the vendors to follow that... */
@@ -1230,6 +1241,8 @@ go32_sysinfo (char *arg, int from_tty)
(unsigned)dpmi_vendor_info[1],
((unsigned)dpmi_flags & 0x7f));
}
+ else
+ printf_filtered ("DPMI Host......................(Info not available)\n");
__dpmi_get_version (&dpmi_version_data);
printf_filtered ("DPMI Version...................%d.%02d\n",
dpmi_version_data.major, dpmi_version_data.minor);