Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: gdb/go32-nat.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/go-valprint.c ('k') | gdb/gregset.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/go32-nat.c
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index b8fe284026169fa810a51cc2235f7d2bdeb3d2a7..c1172f6f0c51c7ee052849ce5595b00c0de7ed04 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -1,6 +1,5 @@
/* Native debugging support for Intel x86 running DJGPP.
- Copyright (C) 1997, 1999-2001, 2005-2012 Free Software Foundation,
- Inc.
+ Copyright (C) 1997-2013 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of GDB.
@@ -82,9 +81,10 @@
GDB does not use those as of this writing, and will never need
to. */
+#include "defs.h"
+
#include <fcntl.h>
-#include "defs.h"
#include "i386-nat.h"
#include "inferior.h"
#include "gdbthread.h"
@@ -96,10 +96,12 @@
#include "buildsym.h"
#include "i387-tdep.h"
#include "i386-tdep.h"
+#include "i386-cpuid.h"
#include "value.h"
#include "regcache.h"
-#include "gdb_string.h"
+#include <string.h>
#include "top.h"
+#include "cli/cli-utils.h"
#include <stdio.h> /* might be required for __DJGPP_MINOR__ */
#include <stdlib.h>
@@ -233,7 +235,7 @@ static int dr_ref_count[4];
static int prog_has_started = 0;
static void go32_open (char *name, int from_tty);
-static void go32_close (int quitting);
+static void go32_close (void);
static void go32_attach (struct target_ops *ops, char *args, int from_tty);
static void go32_detach (struct target_ops *ops, char *args, int from_tty);
static void go32_resume (struct target_ops *ops,
@@ -369,7 +371,7 @@ go32_open (char *name, int from_tty)
}
static void
-go32_close (int quitting)
+go32_close (void)
{
}
@@ -382,7 +384,7 @@ Use the `run' command to run DJGPP programs."));
}
static void
-go32_detach (struct target_ops *ops, char *args, int from_tty)
+go32_detach (struct target_ops *ops, const char *args, int from_tty)
{
}
@@ -875,7 +877,7 @@ go32_terminal_init (void)
}
static void
-go32_terminal_info (char *args, int from_tty)
+go32_terminal_info (const char *args, int from_tty)
{
printf_unfiltered ("Inferior's terminal is in %s mode.\n",
!inf_mode_valid
@@ -1026,9 +1028,6 @@ init_go32_ops (void)
/* We are always processing GCC-compiled programs. */
processing_gcc_compilation = 2;
-
- /* Override the default name of the GDB init file. */
- strcpy (gdbinit, "gdb.ini");
}
/* Return the current DOS codepage number. */
@@ -1140,6 +1139,21 @@ go32_sysinfo (char *arg, int from_tty)
else if (u.machine[0] == 'i' && u.machine[1] > 4)
{
/* CPUID with EAX = 0 returns the Vendor ID. */
+#if 0
+ /* Ideally we would use i386_cpuid(), but it needs someone to run
+ native tests first to make sure things actually work. They should.
+ http://sourceware.org/ml/gdb-patches/2013-05/msg00164.html */
+ unsigned int eax, ebx, ecx, edx;
+
+ if (i386_cpuid (0, &eax, &ebx, &ecx, &edx))
+ {
+ cpuid_max = eax;
+ memcpy (&vendor[0], &ebx, 4);
+ memcpy (&vendor[4], &ecx, 4);
+ memcpy (&vendor[8], &edx, 4);
+ cpuid_vendor[12] = '\0';
+ }
+#else
__asm__ __volatile__ ("xorl %%ebx, %%ebx;"
"xorl %%ecx, %%ecx;"
"xorl %%edx, %%edx;"
@@ -1156,6 +1170,7 @@ go32_sysinfo (char *arg, int from_tty)
:
: "%eax", "%ebx", "%ecx", "%edx");
cpuid_vendor[12] = '\0';
+#endif
}
printf_filtered ("CPU Type.......................%s", u.machine);
@@ -1181,6 +1196,10 @@ go32_sysinfo (char *arg, int from_tty)
int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
unsigned cpu_family, cpu_model;
+#if 0
+ /* See comment above about cpuid usage. */
+ i386_cpuid (1, &cpuid_eax, &cpuid_ebx, NULL, &cpuid_edx);
+#else
__asm__ __volatile__ ("movl $1, %%eax;"
"cpuid;"
: "=a" (cpuid_eax),
@@ -1188,6 +1207,7 @@ go32_sysinfo (char *arg, int from_tty)
"=d" (cpuid_edx)
:
: "%ecx");
+#endif
brand_idx = cpuid_ebx & 0xff;
cpu_family = (cpuid_eax >> 8) & 0xf;
cpu_model = (cpuid_eax >> 4) & 0xf;
@@ -1272,9 +1292,9 @@ go32_sysinfo (char *arg, int from_tty)
break;
}
}
- sprintf (cpu_string, "%s%s Model %d Stepping %d",
- intel_p ? "Pentium" : (amd_p ? "AMD" : "ix86"),
- cpu_brand, cpu_model, cpuid_eax & 0xf);
+ xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
+ intel_p ? "Pentium" : (amd_p ? "AMD" : "ix86"),
+ cpu_brand, cpu_model, cpuid_eax & 0xf);
printfi_filtered (31, "%s\n", cpu_string);
if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
|| ((cpuid_edx & 1) == 0)
@@ -1702,8 +1722,7 @@ go32_sldt (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
{
@@ -1773,8 +1792,7 @@ go32_sgdt (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
{
@@ -1815,8 +1833,7 @@ go32_sidt (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
{
@@ -1986,8 +2003,7 @@ go32_pde (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
{
@@ -2037,8 +2053,7 @@ go32_pte (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
{
@@ -2065,8 +2080,7 @@ go32_pte_for_address (char *arg, int from_tty)
if (arg && *arg)
{
- while (*arg && isspace(*arg))
- arg++;
+ arg = skip_spaces (arg);
if (*arg)
addr = parse_and_eval_address (arg);
@@ -2097,6 +2111,9 @@ go32_info_dos_command (char *args, int from_tty)
help_list (info_dos_cmdlist, "info dos ", class_info, gdb_stdout);
}
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_go32_nat;
+
void
_initialize_go32_nat (void)
{
« no previous file with comments | « gdb/go-valprint.c ('k') | gdb/gregset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698