Mail Archives: djgpp/1997/03/19/06:41:52
On 18 Mar 1997, Robrecht Jacques wrote:
> I just installed DJGPP2.0 (binaries) on my Dos6.2/Win3.1
> system and was able to compile/link/etc... but when I
> runned GDB to debug the programs it gives segfaults.
[snip]
> Did I forget to install something? Am I missing
> something? I read the faq, but didn't find anything.
Maybe you have an old version of the FAQ, because the latest version
explains this in section 12.9 (below). And the index has an entry like
this:
* GDB GP Faults on breakpoint/watchpoint under Windows: Section 12.9.
Btw, if you indeed have DJGPP v2.0, not v2.01, upgrade to v2.01, because
the GDB port in v2.0 doesn't support the hardware breakpoints that you
need on Windows (see below).
-------------------- From the FAQ v2.10, section 12.9 ----------------
**Q*: When my program hits a breakpoint in GDB, the debugger reports
SIGSEGV, but only under Windows...*
[...]
Another known problem is that `GDB' GP Faults when the program hits a
breakpoint under Windows 3.x (Windows 9x doesn't have this problem). This
is because the breakpoint instruction causes a software interrupt (as
opposed to an exception) under Windows 3.x, and the DJGPP debug support
currently only catches debug exceptions. The only work-around is to use
the *hardware* breakpoints (which use the special debug registers of the
i386 and higher CPUs, and which do work with DJGPP on Windows 3), and
never have more than 4 of them active at the same time. `FSDB' will
automatically use the hardware breakpoints for the first 4 breakpoints (so
it works on Windows 3.x unless you set more than 4 breakpoints
simultaneously), but with `GDB', you will have to explicitly use the
`hbreak' and `thbreak' (instead of `break' and `hbreak') commands which
set hardware breakpoints. This works with DJGPP ports of GDB 4.16 and
later. Note that `GDB' uses the ordinary breakpoints to implement the
`step', `next' and similar commands, so you can't use these on Windows
3.x; use the temporary hardware breakpoints instead. The above is also
true for watchpoints (which watch for variables to change value): you need
to use hardware watchpoints with GDB (the total number of breakpoints and
watchpoints cannot exceed 4). Same considerations apply to the debugger
built into RHIDE.
- Raw text -