From: Robert Hoehne <robert.hoehne@gmx.net>
To: gdb-patches@cygnus.com
Cc: DJ Delorie <dj@delorie.com>, shebs@cygnus.com
Subject: Add to go32-nat.c the code from coming DJGPP version
Date: Sun, 14 Mar 1999 14:41:00 -0000 [thread overview]
Message-ID: <199903142206.OAA18483@cygnus.com> (raw)
This patch for go32-nat.c (which is not yet part of the official
gdb snapshots) adds some code, which will be available in the
next DJGPP version. For now it is enclosed in a conditional
checking the DJGPP version.
Additionally I added the decls of all static function near the beginning
of the file.
This patch is against "a March 10th snapshot from DJ"
which I got from DJ Delorie.
Sun Mar 14 1999 Robert Hoehne <robert.hoehne@gmx.net>
* go32-nat.c: Add code for the FPU saving/restoring and adding
decls for all static functions
--- gdb-snap-march-10th-from-DJ/gdb/go32-nat.c.orig Thu Mar 11 19:56:56 1999
+++ gdb-snap-march-10th-from-DJ/gdb/go32-nat.c Sun Mar 14 16:28:42 1999
@@ -29,12 +29,72 @@
#include "command.h"
#include "floatformat.h"
+#include <stdio.h> /* required for __DJGPP_MINOR__ */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <debug/v2load.h>
#include <debug/dbgcom.h>
+#if __DJGPP_MINOR__ < 3
+/* This code will be provided from DJGPP 2.03 on. Until then I code it
+ here */
+typedef struct {
+ unsigned short sig0;
+ unsigned short sig1;
+ unsigned short sig2;
+ unsigned short sig3;
+ unsigned short exponent:15;
+ unsigned short sign:1;
+} NPXREG;
+
+typedef struct {
+ unsigned int control;
+ unsigned int status;
+ unsigned int tag;
+ unsigned int eip;
+ unsigned int cs;
+ unsigned int dataptr;
+ unsigned int datasel;
+ NPXREG reg[8];
+} NPX;
+
+static NPX npx;
+
+static void save_npx (void); /* Save the FPU of the debugged program */
+static void load_npx (void); /* Restore the FPU of the debugged program */
+
+/* ------------------------------------------------------------------------- */
+/* Store the contents of the NPX in the global variable `npx'. */
+
+static void
+save_npx (void)
+{
+ asm ("inb $0xa0, %%al
+ testb $0x20, %%al
+ jz 1f
+ xorb %%al, %%al
+ outb %%al, $0xf0
+ movb $0x20, %%al
+ outb %%al, $0xa0
+ outb %%al, $0x20
+1:
+ fnsave %0
+ fwait"
+ : "=m" (npx)
+ : /* No input */
+ : "%eax");
+}
+/* ------------------------------------------------------------------------- */
+/* Reload the contents of the NPX from the global variable `npx'. */
+
+static void
+load_npx (void)
+{
+ asm ("frstor %0" : "=m" (npx));
+}
+#endif /* __DJGPP_MINOR < 3 */
+
extern void _initialize_go32_nat (void);
struct env387
@@ -58,9 +118,54 @@
#define SOME_PID 42
-/* FIXME add decls of all static functions here */
-
static int prog_has_started = 0;
+static void
+print_387_status (unsigned short status, struct env387 *ep);
+static void
+go32_open (char *name, int from_tty);
+static void
+go32_close (int quitting);
+static void
+go32_attach (char *args, int from_tty);
+static void
+go32_detach (char *args, int from_tty);
+static void
+go32_resume (int pid, int step, enum target_signal siggnal);
+static int
+go32_wait (int pid, struct target_waitstatus *status);
+static void
+go32_fetch_registers (int regno);
+static void
+store_register (int regno);
+static void
+go32_store_registers (int regno);
+static void
+go32_prepare_to_store (void);
+static int
+go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct target_ops *target);
+static void
+go32_files_info (struct target_ops *target);
+static void
+go32_stop (void);
+static void
+go32_kill_inferior (void);
+static void
+go32_create_inferior (char *exec_file, char *args, char **env);
+static void
+go32_mourn_inferior (void);
+static int
+go32_can_run (void);
+static void
+ignore (void);
+static void
+ignore2 (char *a, int b);
+static int go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+static int go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+
+static struct target_ops go32_ops;
static void
print_387_status (unsigned short status, struct env387 *ep)
@@ -245,7 +350,13 @@
else
a_tss.tss_eflags &= 0xfeff;
+#if __DJGPP_MINOR__ < 3
+ save_npx ();
+#endif
run_child ();
+#if __DJGPP_MINOR__ < 3
+ load_npx ();
+#endif
if (a_tss.tss_irqn == 0x21)
{
@@ -522,12 +633,6 @@
#define SHOW_DR(text) do {} while (0)
#endif
-static int go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr,
- CORE_ADDR addr, int len, int rw);
-
-static int go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr,
- CORE_ADDR addr, int len, int rw);
-
/* Insert a watchpoint. */
int
@@ -705,8 +810,6 @@
return 0;
}
-
-static struct target_ops go32_ops;
static void
init_go32_ops (void)
******************************************************
* email: Robert Hoehne <robert.hoehne@gmx.net> *
* Post: Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW: http://www.tu-chemnitz.de/~sho/rho *
******************************************************
WARNING: multiple messages have this Message-ID
From: Robert Hoehne <robert.hoehne@gmx.net>
To: gdb-patches@cygnus.com
Cc: DJ Delorie <dj@delorie.com>, shebs@cygnus.com
Subject: Add to go32-nat.c the code from coming DJGPP version
Date: Thu, 01 Apr 1999 00:00:00 -0000 [thread overview]
Message-ID: <199903142206.OAA18483@cygnus.com> (raw)
Message-ID: <19990401000000.4_61yPVwwlMIIZbv6K9s2rAJLfesMthGF5QNQHQkI8c@z> (raw)
This patch for go32-nat.c (which is not yet part of the official
gdb snapshots) adds some code, which will be available in the
next DJGPP version. For now it is enclosed in a conditional
checking the DJGPP version.
Additionally I added the decls of all static function near the beginning
of the file.
This patch is against "a March 10th snapshot from DJ"
which I got from DJ Delorie.
Sun Mar 14 1999 Robert Hoehne <robert.hoehne@gmx.net>
* go32-nat.c: Add code for the FPU saving/restoring and adding
decls for all static functions
--- gdb-snap-march-10th-from-DJ/gdb/go32-nat.c.orig Thu Mar 11 19:56:56 1999
+++ gdb-snap-march-10th-from-DJ/gdb/go32-nat.c Sun Mar 14 16:28:42 1999
@@ -29,12 +29,72 @@
#include "command.h"
#include "floatformat.h"
+#include <stdio.h> /* required for __DJGPP_MINOR__ */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <debug/v2load.h>
#include <debug/dbgcom.h>
+#if __DJGPP_MINOR__ < 3
+/* This code will be provided from DJGPP 2.03 on. Until then I code it
+ here */
+typedef struct {
+ unsigned short sig0;
+ unsigned short sig1;
+ unsigned short sig2;
+ unsigned short sig3;
+ unsigned short exponent:15;
+ unsigned short sign:1;
+} NPXREG;
+
+typedef struct {
+ unsigned int control;
+ unsigned int status;
+ unsigned int tag;
+ unsigned int eip;
+ unsigned int cs;
+ unsigned int dataptr;
+ unsigned int datasel;
+ NPXREG reg[8];
+} NPX;
+
+static NPX npx;
+
+static void save_npx (void); /* Save the FPU of the debugged program */
+static void load_npx (void); /* Restore the FPU of the debugged program */
+
+/* ------------------------------------------------------------------------- */
+/* Store the contents of the NPX in the global variable `npx'. */
+
+static void
+save_npx (void)
+{
+ asm ("inb $0xa0, %%al
+ testb $0x20, %%al
+ jz 1f
+ xorb %%al, %%al
+ outb %%al, $0xf0
+ movb $0x20, %%al
+ outb %%al, $0xa0
+ outb %%al, $0x20
+1:
+ fnsave %0
+ fwait"
+ : "=m" (npx)
+ : /* No input */
+ : "%eax");
+}
+/* ------------------------------------------------------------------------- */
+/* Reload the contents of the NPX from the global variable `npx'. */
+
+static void
+load_npx (void)
+{
+ asm ("frstor %0" : "=m" (npx));
+}
+#endif /* __DJGPP_MINOR < 3 */
+
extern void _initialize_go32_nat (void);
struct env387
@@ -58,9 +118,54 @@
#define SOME_PID 42
-/* FIXME add decls of all static functions here */
-
static int prog_has_started = 0;
+static void
+print_387_status (unsigned short status, struct env387 *ep);
+static void
+go32_open (char *name, int from_tty);
+static void
+go32_close (int quitting);
+static void
+go32_attach (char *args, int from_tty);
+static void
+go32_detach (char *args, int from_tty);
+static void
+go32_resume (int pid, int step, enum target_signal siggnal);
+static int
+go32_wait (int pid, struct target_waitstatus *status);
+static void
+go32_fetch_registers (int regno);
+static void
+store_register (int regno);
+static void
+go32_store_registers (int regno);
+static void
+go32_prepare_to_store (void);
+static int
+go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct target_ops *target);
+static void
+go32_files_info (struct target_ops *target);
+static void
+go32_stop (void);
+static void
+go32_kill_inferior (void);
+static void
+go32_create_inferior (char *exec_file, char *args, char **env);
+static void
+go32_mourn_inferior (void);
+static int
+go32_can_run (void);
+static void
+ignore (void);
+static void
+ignore2 (char *a, int b);
+static int go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+static int go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+
+static struct target_ops go32_ops;
static void
print_387_status (unsigned short status, struct env387 *ep)
@@ -245,7 +350,13 @@
else
a_tss.tss_eflags &= 0xfeff;
+#if __DJGPP_MINOR__ < 3
+ save_npx ();
+#endif
run_child ();
+#if __DJGPP_MINOR__ < 3
+ load_npx ();
+#endif
if (a_tss.tss_irqn == 0x21)
{
@@ -522,12 +633,6 @@
#define SHOW_DR(text) do {} while (0)
#endif
-static int go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr,
- CORE_ADDR addr, int len, int rw);
-
-static int go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr,
- CORE_ADDR addr, int len, int rw);
-
/* Insert a watchpoint. */
int
@@ -705,8 +810,6 @@
return 0;
}
-
-static struct target_ops go32_ops;
static void
init_go32_ops (void)
******************************************************
* email: Robert Hoehne <robert.hoehne@gmx.net> *
* Post: Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW: http://www.tu-chemnitz.de/~sho/rho *
******************************************************
next reply other threads:[~1999-03-14 14:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-14 14:41 Robert Hoehne [this message]
1999-04-01 0:00 ` Robert Hoehne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199903142206.OAA18483@cygnus.com \
--to=robert.hoehne@gmx.net \
--cc=dj@delorie.com \
--cc=gdb-patches@cygnus.com \
--cc=shebs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox