Commit Graph

61 Commits

Author SHA1 Message Date
bde
b2fde7f60d Fixed accesses to addresses between VM_MAXUSER_ADDRESS (normally
0xefbfe000) and kernel_start (normally 0xf0100000).

Things are unnecessarily (?) difficult because procfs is used to
access user addresses in the live-kernel case although we must have
access to /dev/mem to work at all, and whatever works for the
dead-kernel case should work in all cases (modulo volatility of
live kernel variables).  We used the wrong range [0, kernel_start)
for user addresses.  Procfs should only work up to VM_MAXUSER_ADDRESS,
but it bogusly works for reads up to the address 2 pages higher
(the user area, including the kernel stack, is mapped to where the
user area used to be (WTUAUTB)).  Procfs can not work at all for
addresses between WTUAUTB and kernel_start.

Now we use procfs only to access addresses up to VM_MAXUSER_ADDRESS.
Higher addresses are translated normally using kvtophys(), so the
user ptd is used for addresses below the real kernel start (0xf0000000;
see INKERNEL()) and nothing is found WTUAUTB.

Strange accesses that cross the user-kernel boundary are now handled,
but such ranges are currently always errors because they necessarily
overlap the hole WTUAUTB.

Short reads are still not handled.
1998-01-19 15:27:56 +00:00
bde
60aa5ea7f4 Removed `kstack' and associated mistranslations in kvtophys().
Correct translations would have been null.  However, kstack was
the top of the kernel stack instead of the base of the kernel stack
like it was when the kernel exported it, so the area above the
kernel stack was mistranslated and the kernel stack was not
translated.  This bug was depended on to compensate for the wrong
value of kstack - to read the pcb, instead of just using the address
of the pcb, we used the mistranslated address of kstack, which
happened to be the same (curpcb = kstack - 0x2000).

This area is simpler than it used to be now that the kernel stack
address is per-process.  The code still seems to be more complicated
than necessary - the `found_pcb == 0' case seems to be unused.
1998-01-19 14:27:41 +00:00
bde
b111406bb8 Fixed endless loop for `p/x *(int *)0xf0000000'. kvm_uread() in
gdb was cloned from the buggy version of kvm_uread() in libkvm and
had the same bugs.  It looped endlessly on EOF and checked errno
without setting it in the lseek() error check.  The first bug caused
gdb to loop endlessly for reads from addresses between the end of
the user area and the start of the kernel text.  kvm_uread() should
not be used for addresses beyond the end of the user area, but is
due to bugs elsewhere.
1998-01-18 13:18:55 +00:00
bde
4428561879 Don't override FRAME_CHAIN(). If the current frame is valid, then
the previous frame is in the usual place even for traps, interrupts
and syscalls in the kernel, because the assembly language stubs
don't change the frame pointer.  The previous frame is just not for
the calling function.  We may as well depend on this as on magic to
determine the trap frame address.  The magic is in FRAME_SAVED_PC()
which elides the correct number of stubs (1) to go back to a pc that
matches the previous frame.

Removing fbsd_kern_frame_chain() fixes bugs in it.  Xsyscall was
misspelled as _Xsyscall (gdb removes one leading underscore), so
the tf_syscall frame type was never found.  This was harmless
because tf_normal works in all cases in fbsd_kern_frame_chain()
and Xsyscall is spelled correctly in fbsd_kern_frame_saved_pc()
where it matters.  There were style bugs on almost every line,
starting with a primary indent of 7.
1998-01-18 12:35:48 +00:00
bde
e95ae06aaf Fixed sloppy definitions of SIGTRAMP_START and SIGTRAMP_END. The old
range was a little too large.
1998-01-18 11:51:48 +00:00
bde
4d40d6d2f0 Pass the system name to dmesg. Rev.1.7 only works when the symbols in
/kernel aren't too different form those in the kernel being debugged.
1998-01-17 17:07:53 +00:00
bde
e03e3017e5 Exec dmesg and awk to print everything in the message buffer
following "panic:" or "Fatal trap".  `panicstr' is still printed,
although it is redundant if there is a valid message buffer and
incomplete if it contains `%'s.  I think the awk command belongs
here and not in a script since a standard format with complete
messages is good for bug reports.
1997-12-19 21:37:18 +00:00
bde
c6f91d8591 Implemented "info float" for core files.
Implemented reading of %fs and %gs from core files.

Print weird floating point values better.  We have to convert long
doubles to doubles here because of limitations and bugs in printf()
and floatformat_to_double() (long doubles aren't really supported
and naive converion to double causes exceptions).  Conversion loses
information about weird formats (everything becomes a quiet NaN),
and printf() doesn't know about different types of NaNs anyway.
1997-11-23 09:18:18 +00:00
peter
8f2d47fd2f #include <machine/tss.h> explicitly 1997-10-10 12:53:27 +00:00
jkh
068b44c29a Changes to support full make parallelism (-j<n>) in the world
target.
Reviewed by:	<many different folks>
Submitted by:	Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>
1997-10-05 09:40:24 +00:00
bde
a88da7e940 Support 4MB pages. 1997-07-27 18:29:04 +00:00
tegge
a2a9587088 Don't depend upon the user structure having been aligned on a 8 KB boundary.
Reviewed by:	Peter Wemm <peter@spinner.dialix.com.au>
1997-06-27 15:48:22 +00:00
peter
6c0e454999 Zap some unused debugging printfs that I accidently left in. 1997-06-27 13:39:31 +00:00
bde
d5a5fc2e8f Support reading and writing of %fs and %gs (except from core files). 1997-06-07 04:50:43 +00:00
gj
4b491e830e delete kcorelow.c, it didn't produce any code and broke init.c
because 2 references to _initialize_kcorelow (the other one
from kvm-fbsd.c) resulted. This prevented gdb from working correectly.

delete kcorelow.c from XSRCS in the Makefile.
1997-05-02 11:22:51 +00:00
pst
4951c6a0eb Clean up merge from 2.2 (without spamming peter's changes) 1997-05-01 16:24:37 +00:00
peter
eb6140a55b Patch up init.c generation so that it works in -current.. It was trying
to use files that do not exist here.  Also, fix(?) ${.OBJDIR}/init.c hack.
1997-05-01 13:40:57 +00:00
peter
a5d05735c9 Fix include of <sys/dir.h> to <dirent.h> - it hits a #warning 1997-05-01 13:36:35 +00:00
pst
0086a0b342 Fix up a spurious '@' I added at the last second 1997-05-01 00:26:43 +00:00
pst
87f13a3d94 Merge from 2.2: auto-gen init.c and add ser-tcp.c 1997-05-01 00:18:51 +00:00
bde
b6edebc4ce Fetch the registers from struct members in the pcb instead of
punning the pcb to an array of ints and using magic indices to
access values in it.  This should prevent silent breakage from
changes in the pcb.

Supply 0 for unavailable registers instead of punning the tss to
an array of ints and using magic indices to access garbage values
in it.  (The registers are in the pcb; there is nothing interesting
in the tss.  This should change someday.  At least for dumps, all
the registers should be saved, and common_tss is a good place to
put them.)

Removed ancient wrong (disabled) method for reading eip.
1997-04-30 15:33:56 +00:00
bde
615fb6d211 Backed out previous change. It just gave a more verbose Makefile by
repeating the default for MAN1.
1997-04-30 15:23:02 +00:00
gj
ac4f7897a7 change kvm-fbsd.c so that kernel debugging works again.
document the -k and -wcore options in the manpage.

change Makefile to use a local copy of the manpage.
1997-04-27 21:36:49 +00:00
pst
3eceb30fbf Activate gdbserver and gdbreplay 1997-04-26 17:34:05 +00:00
pst
2e250ec07d Initial import of gdbserver FreeBSD support 1997-04-25 22:25:50 +00:00
pst
507b33f76a Initial import of gdbreplay build structure 1997-04-25 22:25:22 +00:00
peter
58e18c9e7e Attempt to patch up gdb so that it has a chance of working with the new
UPAGES layout.. it was entirely too comfortable with reading and writing
the U area before.  I've changed it to use PT_GETREGS/PT_PUTREGS
ptrace ops instead of READ_U etc.  The code to read the registers from
core dumps is a bandaid at best.  It seems to have problems reading
core dumps from dynamic linked executables still, but at least static
dumps work.

I desperately need help from a gdb/bfd expert. :-)  HELP!!
1997-04-07 08:08:20 +00:00
peter
3fc68d1a5d generate c-exp.c, f-exp.c and m2-exp.c with yacc rather than using
the generated ones in the gdb dist.
1997-03-29 10:33:13 +00:00
gj
a8c5447c6f delete the LINKS line (link gdb to kgdb) by popular demand. 1997-03-15 20:59:59 +00:00
gj
aad6b7059d add LINKS line to Makefile to automatically produce a link to kgdb
define START_PROGRESS in nm.h to check whether gdb was invoked as kgdb
and set the kernel_debugging flag in that case.

2.2 candidate ?
1997-03-12 22:34:09 +00:00
peter
448e6574fe Revert $FreeBSD$ to $Id$ 1997-02-22 15:48:31 +00:00
jkh
7ff11a91e7 Remove -lmalloc; it's no longer relevant.
Pointed-Out-By: jdp, dima and others.
1997-01-17 06:32:35 +00:00
gj
5331581c37 changes required in the gdb directory for making gdb
using the sources in /usr/src/contrib/gdb.

This is based on /usr/ports/devel/gdb.

2.2 candidate ?
1997-01-15 22:37:09 +00:00
jkh
9c0cd3f9df Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
gj
34eeb70f5e changes to gdb to:
1) add Garrett Wollman's trap frame resolving mods
2) make the `proc' command (kernel debugging) really work
3) allow use of a pid with the `proc' command (previously you had to
provide the address of the proc structure)

Unfortunately, the `proc' command won't work while doing remote debugging.
1996-10-29 21:52:21 +00:00
jkh
e693c16dd8 Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src.  This is the final version of the
patches, incorporating the feedback I've received from -current.
1996-06-24 04:26:21 +00:00
bde
57a5013b6c Stop using the alias pcb_ptd' for pcb_tcc.tss_cr3'. Use the (existing)
alias `pcb_cr3' instead.  That is still one alias too many, but is convenient
for me since I've replaced the tss in the pcb by a few scalar variables in
the pcb.
1996-06-08 11:03:19 +00:00
wosch
5c15c67589 `mv'' -> `mv -f''
``rm'' -> ``rm -f''
so mv/rm may not ask for confirmation if you are not root
1996-05-07 23:19:49 +00:00
phk
0da10b10e3 PD_SHIFT -> PDRSHIFT
PGOFSET -> PAGE_MASK
1996-05-02 13:08:51 +00:00
phk
8faee1d3de NBPG -> PAGE_SIZE
Avoid using the struct pte stuff.
1996-05-02 09:42:45 +00:00
jkh
ab22b22bdc Document the -k and -w flags.
Submitted by:	Gary Jennejohn <gj>
1995-12-19 23:42:56 +00:00
rgrimes
8988b74eb8 Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
rgrimes
5a77fee751 Submitted by: gj
Delete suspicious looking chunk of code that was partially commented out.
1995-05-09 13:59:22 +00:00
rgrimes
3f6c9cc6d0 Fix nested comments for -Wcomment warnings. 1995-05-09 12:58:53 +00:00
jkh
abd6c5dfcb Gary J's patches to make gdb -w work properly.
Submitted by:	gj
1995-04-26 01:01:20 +00:00
nate
7e9002972a Because -lcompat defines the same symbols as -lgnuregex and the weakness
of the linker to enforce linking of modules in command line order it is
not possible to link gdb shared with -lcompat.

*HACK ALERT*
Removed -lcompat from LDADD and bring in the necessary functions out of
libcompat as a source module until the linker can be fixed.
1995-04-07 05:13:26 +00:00
jkh
22f90461c9 Here's a patch to gdb-4.13 to add dyadic frames, as per J"org Wunsch.
Could somebody apply it?
Submitted by:	gj
1995-01-17 13:52:39 +00:00
ache
d58c55a232 Remove regex code, use -lgnuregex instead 1995-01-06 21:26:39 +00:00
bde
dd05a63f4c Handle segment registers (except %fs and %gs). 1995-01-06 14:52:06 +00:00
bde
edd7ad9a83 Add more segment registers to list of registers (fake for %fs and %gs).
This might be useful for debugging applications that use a special LDT.
However, printing of all segment registers is currently broken.

Don't print "last exception: " before the FPU opcode and pc, etc.  The
opcode and pc, etc., are for the last FPU _instruction_.

Pass the saved exception status word to print_387_status() so that the
exception(s) that caused or will cause a trap can be seen.  The kernel
has supported this since 1.1 or before.  The kernel still clobbers the
tag word if a trap occurs.

Remove unused null function clear_regs().
1994-12-31 17:00:09 +00:00