www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/10/12/04:59:06

Date: Tue, 12 Oct 1999 10:24:04 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
Subject: Debugging under emulator
Message-ID: <Pine.SUN.3.91.991012102218.7576R-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

With the following two patches to dbgcom.c and go32-nat.c, I can run
an FP program under GDB when the emulator is in use.  There are still
problems to solve: if I set a breakpoint, the debuggee gets SIGSEGV
when I continue it after the breakpoint.  But at least I was able to
run a large number-cruncher under GDB, and it produced correct results
(although abyssmally slow).

If you try this, remember to say "handle SIGEMT noprint nostop" before
running the debuggee, otherwise each SIGNOFP will stop the debuggee
and GDB will announce it.

The patch for dbgcom.c is already checked into the CVS tree.

*** src/debug/common/dbgcom.c1~	Sat Oct  9 16:40:46 1999
--- src/debug/common/dbgcom.c	Sun Oct 10 19:48:22 1999
*************** void _clear_break_DPMI(void)
*** 297,302 ****
--- 297,304 ----
  static __dpmi_paddr old_i31,old_i21,user_i31,user_i21;
  static int user_int_set = 0;
  static __dpmi_paddr my_i9,user_i9,my_i8,user_i8;
+ static void (*oldNOFP)(int);
+ static void dbgsig(int);
  
  static void hook_dpmi(void)
  {
*************** static void hook_dpmi(void)
*** 341,346 ****
--- 343,349 ----
          __dpmi_set_processor_exception_handler_vector(i,&app_handler[i]);
      } */
    load_npx();
+   oldNOFP = signal(SIGNOFP, dbgsig); /* if we run under FP emulation */
    /* Crtl-C renders app code unreadable */
    __djgpp_app_DS = app_ds;
  }
*************** static void unhook_dpmi(void)
*** 1009,1014 ****
--- 1012,1018 ----
    int i;
    /* Crtl-C renders debugger code unreadable */
    __djgpp_app_DS = __djgpp_our_DS;
+   signal(SIGNOFP, oldNOFP);	/* in case we run under FP emulation */
    save_npx();
    /* save app i31 and i21 if changed */
    __dpmi_get_protected_mode_interrupt_vector(0x31, &user_i31);

1999-10-11  Eli Zaretskii  <eliz AT is DOT elta DOT co DOT il>

	* go32-nat.c (sig_map): Map exception 7 (no coprocessor) to
	SIGEMT, to support debugging on FPU-less machines.

*** gdb/go32-nat.~16	Tue Aug 31 18:18:28 1999
--- gdb/go32-nat.c	Sat Oct  9 14:25:46 1999
*************** sig_map[] =
*** 345,351 ****
      4, TARGET_SIGNAL_FPE,
      5, TARGET_SIGNAL_SEGV,
      6, TARGET_SIGNAL_ILL,
!     7, TARGET_SIGNAL_FPE,
      8, TARGET_SIGNAL_SEGV,
      9, TARGET_SIGNAL_SEGV,
      10, TARGET_SIGNAL_BUS,
--- 345,351 ----
      4, TARGET_SIGNAL_FPE,
      5, TARGET_SIGNAL_SEGV,
      6, TARGET_SIGNAL_ILL,
!     7, TARGET_SIGNAL_EMT,
      8, TARGET_SIGNAL_SEGV,
      9, TARGET_SIGNAL_SEGV,
      10, TARGET_SIGNAL_BUS,

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019