History log of /freebsd-10.1-release/gnu/usr.bin/gdb/
Revision Date Author Comments
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


259073 07-Dec-2013 peter

Hoist all the mergeinfo up to the root in preparation for enforcing merges
to the root only. All MFC's were rerecorded to the root.

Going forward, if an MFC includes mergeinfo, it will need to be made to
the root and committed from the root. Merges with --ignore-ancestry
or diff | patch can go anywhere.

The mergeinfo in HEAD is in a bad state from years of neglect and manual
tampering and this was branched into 10.x. This confuses the coalescing
code and prevents it from doing its job.

Approved by: re (gjb, implicit)


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


251858 17-Jun-2013 emaste

Fold in frame-unwind patch

After moving to svn there's no need to avoid pulling files off a vendor
branch.


251512 07-Jun-2013 emaste

Add a new knob WITH_DEBUG_FILES to control the building of standalone
debug files for userland programs and libraries. The "-g" debug flag
is automatically applied when WITH_DEBUG_FILES is set.

The debug files are now named ${prog}.debug and ${shlib}.debug for
consistency with other systems and documentation. In addition they are
installed under /usr/lib/debug, to simplify the process of installing
them if needed after a crash. Users of bsd.{prog,lib}.mk outside of the
base system place the standalone debug files in a .debug subdirectory.
GDB automatically searches both of these directories for standalone
debug files.

Thanks to everyone who contributed changes, review, and testing during
development.


249878 25-Apr-2013 imp

Fix mips64 and mipsn32 bilds by using proper register names.


248838 28-Mar-2013 will

KGDB: Accept KLD symbol files with the ".symbols" extension.

Submitted by: gibbs
Approved by: ken (mentor)
Sponsored by: Spectra Logic
MFC after: 1 month


248836 28-Mar-2013 will

KGDB: Allow modules to be loaded from the specified kernel's directory.

When looking up the absolute path for a kld, call find_kld_path() first.
This enables locating the module in a different directory than the one
stored in kernel memory.

With this change, kgdb can now be run on a kernel & vmcore whose associated
modules are located in the same directory as the kernel. This makes
independent triaging of problems much easier.

This change also does not break the normal kgdb use case where no arguments
are specified; in that case kgdb loads the running kernel and its modules.

Reviewed by: adrian
Approved by: ken (mentor)
Sponsored by: Spectra Logic
MFC after: 1 month


246958 19-Feb-2013 adrian

kgdb enhancements!

* document the kgdb -b flag
* better verify what's valid with -b
* add more comprehensive command line help

PR: kern/175743
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>


246893 17-Feb-2013 marcel

In kthr.c, obtain the address of the PCB for threads that were running
on a core, when the core was stopped, by calling kgdb_trgt_core_pcb().
This has 2 advantages:
1. We don't need to include a machine-specific header anymore and as
such kthr.c is truly machine independent. This allows the code to
be used in a cross-debugger.
2. We don't need to lookup stoppcbs in generic code when it's an
inherently target-spicific symbol. It does not exist for ia64.

Implement kgdb_trgt_core_pcb() for all architectures, except ia64, by
calling a common function called kgdb_trgt_stop_pcb(). This function
differs from kgdb_trgt_core_pcb() in that it gets the size of the PCB
structure as an argument and as such remains machine independent.

On ia64 the PCB for stopped cores is in the PCPU structure itself.
This for better scaling. The implementation of kgdb_trgt_core_pcb()
for ia64 uses the cpuid_to_pcpu[] array to to obtain the address of
the PCB structure.


245705 21-Jan-2013 adrian

Add command-line support to kgdb to allow the baudrate to be set.

This allows a remote session to be specified with '-r' as well as a
non-default baudrate setting using '-b'.

TODO: add to the kgdb manpage.

MFC after: 2 weeks


239396 19-Aug-2012 andreast

Fix typo. Not a win in terms of functionality but in terms of completeness.


239272 15-Aug-2012 gonzo

Merging of projects/armv6, part 3

r238211:
Support TARGET_ARCH=armv6 and TARGET_ARCH=armv6eb

This adds a new TARGET_ARCH for building on ARM
processors that support the ARMv6K multiprocessor
extensions. In particular, these processors have
better support for TLS and mutex operations.

This mostly touches a lot of Makefiles to extend
existing patterns for inferring CPUARCH from ARCH.
It also configures:
* GCC to default to arm1176jz-s
* GCC to predefine __FreeBSD_ARCH_armv6__
* gas to default to ARM_ARCH_V6K
* uname -p to return 'armv6'
* make so that MACHINE_ARCH defaults to 'armv6'
It also changes a number of headers to use
the compiler __ARM_ARCH_XXX__ macros to configure
processor-specific support routines.

Submitted by: Tim Kientzle <kientzle@freebsd.org>


235714 21-May-2012 davidxu

Print key value, an index, otherwise we don't know which key is allocated.


235211 10-May-2012 gjb

General mdoc(7) and typo fixes.

PR: 167696
Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after: 3 days


234739 27-Apr-2012 marcel

Allow building a powerpc cross-kgdb.


233644 29-Mar-2012 jmallett

Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH.
This makes our naming scheme more closely match other systems and the
expectations of much third-party software. MIPS builds which are little-endian
should require and exhibit no changes. Big-endian TARGET_ARCHes must be
changed:
From: To:
mipseb mips
mipsn32eb mipsn32
mips64eb mips64

An entry has been added to UPDATING and some foot-shooting protection (complete
with warnings which should become errors in the near future) to the top-level
base system Makefile.


232910 13-Mar-2012 jmallett

Note two shortcomings of GDB on MIPS that should be addressed.


230427 21-Jan-2012 kib

Adopt to new layout of struct pcb.

MFC after: 1 month


229521 04-Jan-2012 rwatson

Add missing -w to kgdb(1)'s usage().

Sponsored by: Adara Networks, Inc.
MFC after: 3 days


225190 26-Aug-2011 cognet

Do not include <sys/ptrace.h> if we're building a cross-debugger, ptrace isn't
used anyway, and it breaks the build, since sys/ptrace.h now includes
<machine/reg.h>

Approved by: re


225017 19-Aug-2011 jhb

Walk the zombproc list as well as the allproc list when enumerating threads
and processes in a kernel image. This allows examination of threads that
have exited or are in the late stages of exiting.

Tested by: avg
Approved by: re (kib)
MFC after: 1 week


224687 06-Aug-2011 marius

Compile fbsd-threads.c. Amongst others this is necessary for a working
kgdb(1).

Reviewed by: marcel
Approved by: re (kib)
MFC after: 1 week


223758 04-Jul-2011 attilio

With retirement of cpumask_t and usage of cpuset_t for representing a
mask of CPUs, pc_other_cpus and pc_cpumask become highly inefficient.

Remove them and replace their usage with custom pc_cpuid magic (as,
atm, pc_cpumask can be easilly represented by (1 << pc_cpuid) and
pc_other_cpus by (all_cpus & ~(1 << pc_cpuid))).

This change is not targeted for MFC because of struct pcpu members
removal and dependency by cpumask_t retirement.

MD review by: marcel, marius, alc
Tested by: pluknet
MD testing by: marcel, marius, gonzo, andreast


222813 07-Jun-2011 attilio

etire the cpumask_t type and replace it with cpuset_t usage.

This is intended to fix the bug where cpu mask objects are
capped to 32. MAXCPU, then, can now arbitrarely bumped to whatever
value. Anyway, as long as several structures in the kernel are
statically allocated and sized as MAXCPU, it is suggested to keep it
as low as possible for the time being.

Technical notes on this commit itself:
- More functions to handle with cpuset_t objects are introduced.
The most notable are cpusetobj_ffs() (which calculates a ffs(3)
for a cpuset_t object), cpusetobj_strprint() (which prepares a string
representing a cpuset_t object) and cpusetobj_strscan() (which
creates a valid cpuset_t starting from a string representation).
- pc_cpumask and pc_other_cpus are target to be removed soon.
With the moving from cpumask_t to cpuset_t they are now inefficient
and not really useful. Anyway, for the time being, please note that
access to pcpu datas is protected by sched_pin() in order to avoid
migrating the CPU while reading more than one (possible) word
- Please note that size of cpuset_t objects may differ between kernel
and userland. While this is not directly related to the patch itself,
it is good to understand that concept and possibly use the patch
as a reference on how to deal with cpuset_t objects in userland, when
accessing kernland members.
- KTR_CPUMASK is changed and now is represented through a string, to be
set as the example reported in NOTES.

Please additively note that no MAXCPU is bumped in this patch, but
private testing has been done until to MAXCPU=128 on a real 8x8x2(htt)
machine (amd64).

Please note that the FreeBSD version is not yet bumped because of
the upcoming pcpu changes. However, note that this patch is not
targeted for MFC.

People to thank for the time spent on this patch:
- sbruno, pluknet and Nicholas Esborn (nick AT desert DOT net) tested
several revision of the patches and really helped in improving
stability of this work.
- marius fixed several bugs in the sparc64 implementation and reviewed
patches related to ktr.
- jeff and jhb discussed the basic approach followed.
- kib and marcel made targeted review on some specific part of the
patch.
- marius, art, nwhitehorn and andreast reviewed MD specific part of
the patch.
- marius, andreast, gonzo, nwhitehorn and jceel tested MD specific
implementations of the patch.
- Other people have made contributions on other patches that have been
already committed and have been listed separately.

Companies that should be mentioned for having participated at several
degrees:
- Yahoo! for having offered the machines used for testing on big
count of CPUs.
- The FreeBSD Foundation for having sponsored my devsummit attendance,
which has been instrumental.
- Sandvine for having offered offices and infrastructure during
development.

(I really hope I didn't forget anyone, if it happened I apologize in
advance).


220043 26-Mar-2011 kib

Print the raw value of si_code, that is esp. useful for undecoded values.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


218822 18-Feb-2011 dim

Merge binutils 2.17.50 to head. This brings a number of improvements to
x86 CPU support, better support for powerpc64, some new directives, and
many other things. Bump __FreeBSD_version, and add a note to UPDATING.

Thanks to the many people that have helped to test this.

Obtained from: projects/binutils-2.17


217749 23-Jan-2011 emaste

Use string literal format strings to quiet clang warnings.


217123 07-Jan-2011 imp

Retire TARGET_ABI.

Implement MACHINE_ARCH=mips64e[lb] to build N64 images. This replaces
MACHINE_ARCH=mipse[lb] TARGET_ABI=n64.

MACHINE_ARCH=mipsn32e[lb] has been added, but currently requires
WITHOUT_CDDL due to atomic issues in libzfs. I've not investigated
this much, but implemented this to preserve as much of the TARGET_ABI
functionality that I could. Since its presence doesn't affect the
working cases, I've kept it in for now.

Added mips64e[lb] to make universe, so more kernels build.

And I think this (finally) closes the curtain on the tbemd tree.


215679 22-Nov-2010 attilio

Add the ability for GDB to printout the thread name along with other
thread specific informations.

In order to do that, and in order to avoid KBI breakage with existing
infrastructure the following semantic is implemented:
- For live programs, a new member to the PT_LWPINFO is added (pl_tdname)
- For cores, a new ELF note is added (NT_THRMISC) that can be used for
storing thread specific, miscellaneous, informations. Right now it is
just popluated with a thread name.

GDB, then, retrieves the correct informations from the corefile via the
BFD interface, as it groks the ELF notes and create appropriate
pseudo-sections.

Sponsored by: Sandvine Incorporated
Tested by: gianni
Discussed with: dim, kan, kib
MFC after: 2 weeks


215292 14-Nov-2010 nyan

Add missing '/'.


215276 14-Nov-2010 imp

We need to add powerpc64->powerpc translations (I knew I hated copying
this code in the first place).

Also MACHINE_ARCH powerpc is 32-bit, not MACHINE_CPUARCH == powerpc.

Submitted by: nathanw


215082 10-Nov-2010 imp

Complete the integration of tbemd branch into head.

TARGET_BIG_ENDIAN is now completely dead, except where it was
originally supposed to be used (internally in the toolchain building).

TARGET_ARCH has changed in three cases:
(1) Little endian mips has changed to mipsel.
(2) Big endian mips has changed to mipseb.
(3) Big endian arm has changed to armeb.

Some additional changes are needed to make 'make universe' work on arm
and mips after this change, so those are commented out for now.

UPDATING information will be forthcoming. Any remaining rough edges
will be hammered out in -current.


214962 07-Nov-2010 gonzo

Fix cross-debugger build


214960 07-Nov-2010 gonzo

Fix initialization order:_initialize_svr4_solib should
be called before _initialize_thread_db


214952 07-Nov-2010 gonzo

- Use proper constant for accessing PCB intead of hardcoded numbers
- Minor clean-up


214951 07-Nov-2010 gonzo

Link threads support to the build


213013 22-Sep-2010 emaste

Move test for zero bufp or size before rseq and wseq calculation. This
avoids spinning in an infinite loop for some (possibly corrupt?) core
files at work.


211725 23-Aug-2010 imp

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


211243 12-Aug-2010 will

Fix buildworld -DNO_CLEAN when using with Perforce, which marks files as
read-only by default, meaning files copied can't be overwritten next time.

Reviewed by: imp
Approved by: ken (mentor)


210852 04-Aug-2010 jhb

Change kgdb_lookup() to resolve symbols via GDB instead of via libkvm(3).


210778 02-Aug-2010 jkim

Give kgdb(1) a chance to take a look at FPU state.


210424 23-Jul-2010 avg

kgdb: correctly map sections to addresses in elf object modules (amd64)

Unlike for modules with dso type, in elf object modules all the sections
have virtual address of zero. So, it is insufficient to add module base
address to section virtual address (as recorded in section header) to
get section address in kernel memory.
Instead, we should apply the same calculations that are performed by
kernel loaders (in boot code and in kernel) when they lay out sections
in memory.

Discussed with: jhb, np
MFC after: 3 weeks


209867 10-Jul-2010 nwhitehorn

Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes
a variety of bugs in binutils related to handling of 64-bit PPC ELF,
provides a GCC configuration for 64-bit PowerPC on FreeBSD, and
associated build systems tweaks.

Obtained from: projects/ppc64


209690 04-Jul-2010 kib

For "thread signal" command, print some information from siginfo when
available.

Suggested by: davidxu
MFC after: 2 weeks


206624 14-Apr-2010 imp

Make this directory more regular. Since it is one we control, use the
freebsd-based names for filenames. This allows us to eliminate
almost all of the uses of ${MACHINE_ARCH} here to do special things, and
instead we use it to include filenames. This makes new architectures easier
to support.


206622 14-Apr-2010 uqs

mdoc: order prologue macros consistently by Dd/Dt/Os

Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by: ru
Approved by: philip, ed (mentors)


206530 12-Apr-2010 imp

Simplify how we select which architectures to add gdbserver for. If
the MD files exist, compile it, otherwise omit it.


205711 26-Mar-2010 marcel

Allow building a cross-kgdb for ia64.


205710 26-Mar-2010 marcel

Handle cross-builds for gdbserver.


205310 19-Mar-2010 imp

Fix typo in comment


204335 25-Feb-2010 jkim

Initial gdbserver support for amd64.


204138 20-Feb-2010 rrs

These contain JC's patch to get gdb sort of working
on mips. Its not fully done yet but its a start.

Obtained from: JC - c.jayachandran@gmail.com

M gnu/usr.bin/gdb/kgdb/trgt_mips.c
M gnu/usr.bin/gdb/arch/mips/init.c
M gnu/usr.bin/gdb/arch/mips/Makefile
M gnu/usr.bin/Makefile
M contrib/gdb/gdb/mips-tdep.h


203960 16-Feb-2010 marcel

Compile fbsd-threads.c. Threading & TLS support is working just fine.


203823 13-Feb-2010 avg

kgdb: initialize n_type field of nlist entry for kvm_nlist call

kvm_nlist skips lookup for entries that have n_type != N_UNDF.
N_UNDF happens to be zero, so n_type typically has a correct
value by accident, but not always.
Note: jhb has a patch that replaces kvm_nlist use with direct
gdb parsing.

MFC after: 5 days
X-MFC-Note: unless jhb commits kvm_nlist => kgdb_parse change


188941 23-Feb-2009 raj

Initial gdbserver support for PowerPC.

Obtained from: Juniper Networks, Semihalf


185023 17-Nov-2008 raj

Initial gdbserver support for ARM.

Obtained from: Juniper Networks, Semihalf


183957 16-Oct-2008 obrien

Document what the sed trick is for.
Remove an embedded <TAB>, and use same style for both files.


183556 02-Oct-2008 jhb

Oops, initialize sections and sections_end to NULL.

Submitted by: Navdeep Parhar
MFC after: 1 week


183414 27-Sep-2008 kib

Differentiate between interrupt frames, trap interrupt frames and timer
frame in the kgdb, to allow it to properly backtrace over the interrupt
stacks.

Noted and reviewed by: tegge
Tested by: pho
MFC after: 1 week


183359 25-Sep-2008 jhb

Use existing GDB routines for parsing the section table of klds in
the 'add-kld' command instead of doing it more by hand.

MFC after: 1 week


183023 14-Sep-2008 marcel

Widen psaddr_t from uintptr_t to uint64_t. This results in an
ABI change on ILP32 platforms and relating to events. However
it's harmless on little-endian ILP32 platforms in the sense
that it doesn't cause breakages. Old ILP32 thread libraries
write a 32-bit th_p and new thread libraries write a 64-bit
th_p. But due to the fact that we have an unused 32-bit data
field right after th_p and that field is always initialized to
zero, little-endian ILP32 machines effectively have a valid
64-bit th_p by accident. Likewise for new thread libraries and
old libthread_db: little endian ILP32 is unaffected.

At this time we don't support big-endian threaded applications
in GDB, so the breakage for the ILP32 case goes unnoticed.


181167 02-Aug-2008 cognet

Unbreak the arm build, by spelling LIBSRCS correctly.


181148 02-Aug-2008 cognet

Do not build fbsd-threads.c if we're building a cross-debugger.

MFC after: 3 days


179859 18-Jun-2008 jhb

Catch up to recentish kgdb changes:
- Use ptid_get_pid() rather than ptid_get_tid() (part of the changes to
let 'tid' work for remote kgdb).
- Add a stub kgdb_trgt_new_objfile() hook.

Silence from: obrien, mips@


179162 20-May-2008 obrien

Add Juniper's copyright.


179161 20-May-2008 obrien

MIPS arch target kgdb(1) support.

Obtained from: Juniper Networks.


178880 09-May-2008 jhb

Trim unneeded header.


178713 01-May-2008 jhb

- Change how the vmcore target maps FreeBSD thread IDs to GDB ptids. We
now only use the TID and ignore the PID and use pid_to_ptid() to build a
ptid treating the TID as a PID. The benefit of this is that the vmcore
target now uses the same scheme as GDB's remote targets. As a result,
the 'tid' command now works for remote targets (however, it only accepts
TIDs and not addresses of 'struct thread' objects).
- Use gdb_thread_select() to do the actual thread switch for the 'tid' and
'proc' commands. This now gives the same UI feedback when switching
threads as the GDB 'thread' command rather than providing no visual
output at all.

MFC after: 1 week


178670 29-Apr-2008 jhb

Rework how kgdb manages kernel and vmcore files to be a bit more gdb-ish
so that kgdb can be used more like a normal gdb:
- Load the kernel via the standard 'exec' target and allow it to be changed
via the 'file' command.
- Instead of explicitly loading the kernel file as the mail symbol file
during startup, just pass it to gdb_main() as the executable file.
- Change the kld support (via shared libraries) to cache the address of
the linker_files and linker_kernel_file variables in addition to the
offsets of various members in 'struct linker_file'.
- When a new symbol file is loaded, recompute the addresses and offsets
used by the kld support code.
- When a new symbol file is loaded, recalculate the ofs_fix variable to
account for the different ways a trapframe can be passed to trap
frame handlers in i386. This is done by adding a MD
kgdb_trgt_new_objfile() hook that is empty on all but i386.
- Don't use the directory name of the kernel specified on the command
line to find kernel modules in the kld support code. Instead,
extract the filename of the current executable via exec_bfd. Now
the 'kernel' variable is private to main.c again.
- Make the 'add-kld' command explicitly fail if no executable is loaded.
- Make the support for vmcores a real core-dump target that opens the
kernel and vmcore on open and closes the kvm connection when closed, etc.
- The 'core' command can now be used to select a vmcore to use, either
a crash dump file or /dev/mem for live debugging.
- The 'detach' command can be used to detach from a vmcore w/o attaching
to a new one.
- kgdb no longer explicitly opens a core dump during startup and no longer
has to use an atexit() hook to close the kvm connection on shutdown.
- Symbols for kld's are automatically loaded anytime a core is opened.
Also, the unread portion of dmesg is dumped just as it was done on kgdb
startup previously.
- Don't require either a remote target or core dump if a kernel is specified.
You can now just run 'kgdb kernel' similar to running gdb on an executable
and later connect to a remote target or core dump.
- Use a more relaxed way to verify remote targets specified via -r.
Instead of explicitly allowing a few non-file target specifications,
just assume that if stat() on the arg and on "/dev/" + arg both fail
that is some non-file target and pass it to gdb.
- Don't use a custom interpreter. The existing kgdb_init() hook and the
target_new_objfile() hook give us sufficient hooks during startup to
setup kgdb-specific behavior now.
- Always add the 'proc', 'tid', and 'add-kld' commands on startup and not
just if we have a core dump. Currently the 'proc' and 'tid' commands do
not work for remote targets (I will fix at least 'tid' in the next round
of changes though). However, the 'add-kld' command works fine for
loading symbols for a kernel module on a remote target.
- Always setup the 'kld' shared library target operations instead of just
if we have a core dump. Although symbols for kernel modules are not
automatically loaded when connecting to a remote target, you can do
'info sharedlibrary' after connecting to the remote target and kgdb will
find all the modules. You can then use the 'sharedlibrary' command to
load symbols from the module files.
- Change kthr_init() to free the existing list of kthr objects before
generating a new one. This allows it to be invoked multiple times
w/o leaking memory.

MFC after: 1 week


178666 29-Apr-2008 jhb

- Add a global variable 'fbsdcoreops_suppress_target' that can be set to
force the FreeBSD multithreaded core target to not register any target
for handling core dumps. This is analogous to the
'coreops_suppress_target' variable that GDB provides for suppressing the
default core dump target. KGDB will use this new variable so it can
provide its own core dump target that uses libkvm to work with vmcore
files.
- Adjust the long name and documentation of the FreeBSD multithreaded core
dump target so it better matches what GDB's core dump target uses.

MFC after: 1 week
Reviewed by: davidxu, marcel


178638 28-Apr-2008 jhb

Use kgdb_parse() instead of libkvm(3) to read the first instruction from
"calltrap" to see which method is used to pass trap frames. This seg
faulted on remote gdb connections (where libkvm isn't used).

MFC after: 3 days


178634 28-Apr-2008 jhb

Remove the 'add_kld_command' arg from load_kld(). It is always true since
the auto-loading of kld's switched to hooking into gdb's shared library
support.

MFC after: 1 week


178583 26-Apr-2008 imp

FreeBSD/mips gdb build suspport. From the mips2-jnpr branch.


177715 29-Mar-2008 jhb

Change kgdb_parse() to use wrapped versions of parse_expression() and
evaluate_expression() so that any errors are caught and cause the function
to return to 0. Otherwise the errors posted an exception (via longjmp())
that aborted the current operation. This fixes the kld handling for
older kernels (6.x and 7.x) that don't have the full pathname stored in
the kernel linker.

MFC after: 3 days


177701 29-Mar-2008 jhb

Initialize the head pointer in kld_current_sos() to NULL to avoid returning
a junk pointer and possibly causing a seg fault if we don't have any
non-kernel klds (or are unable to walk the list due to core / kernel
mismatch).

MFC after: 1 week


176568 25-Feb-2008 jhb

Remove a stale prototype I missed when converting the kld support over to
hooking into gdb's shared library infrastructure.


175809 29-Jan-2008 jhb

- Rework the kld support to hook into GDB's shared library support.
kgdb(8) now treats kld's as shared libraries relative to the kernel
"binary". Thus, you can use 'info sharedlibrary' to list the kld's
along with 'sharedlibrary' and 'nosharedlibrary' to manage symbol
loading and unloading. Note that there isn't an easy way to force GDB
to use a specific path for a shared library. However, you can use
'nosharedlibrary' to unload all the klds and then use 'sharedlibrary'
to load specific klds where it gets the kld correct and use
'add-kld' for the kld's where the default open behavior doesn't work.
klds opened via 'sharedlibrary' (and during startup) do have their
sections listed in 'info files'.
- Change the 'add-kld' command to use filename completion to complete its
argument.


175808 29-Jan-2008 jhb

Don't close the kernel bfd object during startup. Instead, leave it open
and build a section table from the kernel file so that 'info files' output
for kgdb now matches the usage of gdb on a regular file with the exception
that we don't list sections for memory in the crash dump.


175807 29-Jan-2008 jhb

Use target_read_memory() and extract_unsigned_integer() instead of direct
KVM access to read kernel pointers.


175806 29-Jan-2008 jhb

Don't look for "foo.ko.symbols" files. GDB is smart enough to open the
".symbols" file automatically when you tell it to load "foo.ko" because of
the debug link.


175775 28-Jan-2008 jhb

Use a for loop in find_kld_address() as in kgdb_auto_load_klds() and
replace the remaining goto's with continues as a result.


175774 28-Jan-2008 jhb

Add support for automatically loading symbols for kld's on startup:
- Add a new 'kgdb_auto_load_klds()' routine which is invoked during
startup that walks the list of linker files and tries to find a matching
kld on disk for each non-kernel kld. If a kld file is found, then it
is added as if the 'add-kld' command is invoked. One change from
'add-kld' is that this method attempts to use the 'pathname' from the
linker_file structure first to try to load the file. If that fails
it then looks in the kernel directory followed by the directories in
the module path.
- Move the kld file suffix handling into a separate routine so that it
can be called standalone and to reduce duplicate code in find_kld_path().
- Cache the offsets of members of 'struct linker_file' during startup
instead of computing them for each 'add-kld'.
- Use GDB's target_read_string() instead of direct KVM access.
- Add all resident sections from a kld by using bfd_map_over_sections() to
build the section list rather than just adding symbols for ".text",
".data", ".bss", and ".rodata".
- Change the 'add-kld' command to do a y/n prompt before adding the
symbols when run interactively to match 'add-symbol-file'.

MFC after: 1 week


175771 28-Jan-2008 jhb

Remove the warnx() from kgdb_lookup() so that we don't emit a warning about
optional symbols that are missing (e.g. kgdb complains about _stoppcbs and
_stopped_cpus on UP kernels). Instead, callers that really want their
symbols to be present now do explicitly warnx() about the missing symbol.


175770 28-Jan-2008 jhb

If the quiet flag is specified (-q), don't dump the unread portion of
the message buffer on startup.


175645 24-Jan-2008 jhb

Move the code for working with kld's out into its own file.


175452 18-Jan-2008 emaste

Include the thread name (in addition to the proc name) in "info threads."


175416 17-Jan-2008 jhb

Add a new 'add-kld <kld>' command to kgdb to make it easier to analyze
crash dumps with kernel modules. The command is basically a wrapper
around add-symbol-file except that it uses the kernel linker data
structures and the ELF section headers of the kld to calculate the
section addresses add-symbol-file needs.

The 'kld' parameter may either be an absolute path or a relative path.
kgdb looks for the kld in several locations checking for variants with
".symbols" or ".debug" suffixes in each location. The first location it
tries is just opening the specified path (this handles absolute paths and
looks for the kld relative to the current directory otherwise). Next
it tries to find the module in the same directory of the kernel image
being used. If that fails it extracts the kern.module_path from the
kernel being debugged and looks in each of those paths.

The upshot is that for the common cases of debugging /boot/kernel/kernel
where the module is in either /boot/kernel or /boot/modules one can merely
do 'add-kld foo.ko'.

MFC after: 1 week


173705 17-Nov-2007 cognet

Add thread support for arm.

MFC After: 1 week


173700 17-Nov-2007 cognet

There's no reason why we couldn't attach to a live process on arm.

MFC After: 1 week


173681 16-Nov-2007 jhb

Teach kgdb how to handle double fault frames on i386:
- Save td_oncpu in 'struct kthr' so the i386 target code can see which CPU
a thread is running on.
- Add a new frame unwinder for double fault frames. This unwinder is used
when "dblfault_handler" is encountered in the stack. It uses the CPU of
the current thread to lookup the base address of the TSS used for the
double fault from the GDT. It then fetches the various registers out
of the TSS similar to how the current trapframe unwinder fetches
registers out of the trapframe.

MFC after: 3 days


171924 22-Aug-2007 jhb

NMIs now come from 'nmi_calltrap' rather than 'calltrap', so teach 'kgdb'
to treat the frame under 'nmi_calltrap' as a trapframe.

MFC after: 3 days
Approved by: re (bmah)


169714 19-May-2007 kan

Remove extern int verbose declaration. It is declared static in the
only file it is used in.


169713 19-May-2007 kan

Fix static/extern mismatch by patching corresponding tdep files
in-place.


169188 01-May-2007 marcel

Add threading support.


167143 01-Mar-2007 kib

Unbreak the kgdb stepping over the special frames on i386 after rev. 1.117 of
i386/i386/exception.s.

No objections from: marcel


167142 01-Mar-2007 kib

Rename lookup() to kgdb_lookup() and make it global (for use in trgt_i386.c).

No objections from: marcel


166851 20-Feb-2007 emaste

Avoid writing uninitialized stack data into a thread's MMX/SSE state by
first getting the current state with td_thr_getxmmregs_p. Without this,
debugging a threaded app that uses libthr resulted in kernel panics or
spurious SIGFPEs for me.

(As of revision 1.6, sys/i386/i386/ptrace_machdep.c masks off the
reserved bits in the mxcsr register, which prevents the kernel panics.)

Architectures without PT_GETXMMREGS are not affected.

MFC after: 1 week


166214 25-Jan-2007 rodrigc

Try to avoid a possible infinite loop when parsing an invalid kernel dump file.

PR: 108229
Submitted by: Jessica Han <jessicah juniper net>
Reviewed by: marcel
MFC after: 1 week


163583 21-Oct-2006 ru

Bump document date for the previous change.


163582 21-Oct-2006 jmg

Turn on gdbserver for the arch that supports it..


163440 16-Oct-2006 jhb

Trim trailing whitespace.


163439 16-Oct-2006 jhb

Restore the 'proc' and 'tid' commands which allow one to switch to the
first thread in a process or to a specific thread via PIDs and TIDs,
respectively.

Submitted by: kan
Approved by: marcel


163245 11-Oct-2006 obrien

Document '-w' from main.c rev. 1.11.


162303 14-Sep-2006 imp

Add cross debug support to arm.

Submitted by: cognet@


162298 14-Sep-2006 imp

Architecture specific portions of gdb for arm.

Submitted by: cognet@


161621 25-Aug-2006 jhb

Use the pcb in stoppcbs[] if it is present for threads that were running
on other CPUs in system when a dump is written.

Submitted by: ups
Reviewed by: marcel
MFC after: 3 days


161589 24-Aug-2006 marcel

Add initial support for kgdb(1) on PowerPC.


161564 24-Aug-2006 marcel

Add basic support for PowerPC. This excludes kgdb(1).


161555 23-Aug-2006 jhb

Remove special handling for PC == 0. With this, kgdb can now properly
unwind across a page fault due to a null function pointer. It does a
better job than ddb now in fact.

Reviewed by: marcel
MFC after: 3 days


161548 23-Aug-2006 ru

Remove alpha-specific stuff.

Approved by: marcel


160581 22-Jul-2006 obrien

Add initial platform support.

Submitted by: cognet


157626 10-Apr-2006 ru

Clean the product of patch(1).


157574 06-Apr-2006 jmg

bring in the necessary changes to make gdbserver compile and work (at
least on i386)... fbsd-* changes started out as s/linux/fbsd/g and then
additional changes to handle different ptrace defines among other things..
(use vfork to eliminate a race for progress group creation)

reg-i386.c is generated by regdat.sh..


157572 06-Apr-2006 jmg

This commit was generated by cvs2svn to compensate for changes in r157571,
which included commits to RCS files with non-trunk default branches.


155412 07-Feb-2006 davidxu

Introduce a new proc service routine ps_linfo() to get LWP info.


155379 06-Feb-2006 davidxu

1. Eliminate compile warnings.
2. Add command 'thread signal' to print out current thread's signal mask
and pending signals.


154043 04-Jan-2006 kan

Add -w parameter which tells kgdb to open kmem-based targets in read-write
mode. This allows one to use kgdb on /dev/mem and be able to patch memory
on a live system. This is identical to what -wcore used to do in previous
gdb versions for FreeBSD.

Requested by: wpaul


151683 26-Oct-2005 marcel

Fix dump of the unread portion of the kernel message buffer.

PR: bin/87964
Submitted by: Frank Mayhar frank at exit dot com


150668 28-Sep-2005 peter

Unbreak - remove leftover reference to pcb_rflags.


149977 11-Sep-2005 marcel

Claim frames corresponding to tl(0|1)_intr and tl0_trap as well. I
think that's the lot, but it's hard to understand the exception code
by mere glancing at it.

MFC after: 1 week


149976 11-Sep-2005 marcel

Unwind across intrframes as well. While here, better handle bottom of
stack by claiming the frame when the IP is 0. It's a bit of a kluge,
but avoids screens full of bogus frames.

MFC after: 1 week


149975 11-Sep-2005 marcel

Unwind across intrframes as well.

MFC after: 1 week


149967 11-Sep-2005 marcel

Unwind across trap frames. Handles all entry points, except the EPC
syscall. This is an entry from userland anyway.

MFC after: 1 week


149965 10-Sep-2005 marcel

Unwind across trapframes. All kernel entries are handled.

MFC after: 1 week


149961 10-Sep-2005 marcel

Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week


149957 10-Sep-2005 marcel

Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week


149955 10-Sep-2005 marcel

Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week


149954 10-Sep-2005 marcel

Add a kluge to allow kgdb(1) to inject its own frame sniffer in the
list of frame sniffers so that trapframes can be detected. The kluge
is needed because this version of gdb only supports appending a
sniffer to the list of sniffers and the moment kgdb gets a chance to
add its own frame sniffer, the target's default frame sniffer is
already in the list. Since the default frame sniffer claims any
frame thrown at it, kgdb's frame sniffer never gets to smell (a
process much akin to tasting, but with lesser chance of hurling :-)

This commit adds dummy frame sniffers that never claim a frame and
as such don't fix anything yet. However, we now have frame sniffers
and they are being called, so it's just a matter of adding meat to
the bones and we'll be able to properly unwind across trapframes.

MFC after: 1 week


149119 16-Aug-2005 marcel

Fix backtraces. Supply registers from the register window.

MFC after: 3 days


148802 06-Aug-2005 marcel

o Remove the obscure tid command, because it does what the thread
command does, but worse.
o Remove the obscure proc command, because it does what the thread
command does, but not unambigously.
o Move the PID to the extra thread info, where it makes sense and
where it doesn't confuse users. The extra thread info holds some
process information, to which the PID belongs.
o Implement the to_find_new_threads target method by having it call
the target beneath us if we're not using KVM. This makes sure that
new threads are found when using the remote target.

o Fix various core dump scenarios:
- Implement the to_files_info target method. Previously the
'info target' command would cause a NULL pointer dereference.
- Don't assume there's a current thread. We're not initialized
in all cases. This prevents a NULL pointer dereference.
- When we're not ussing KVM, have the to_xfer_memory target
method call the target beneath us. This avoids calling into
KVM with a NULL pointer.

MFC after: 1 week


148801 06-Aug-2005 marcel

o As mentioned in the previous commit: make the KVM error buffer
static.
o Register a function with atexit(3) to close the KVM object if
we have one open.
o Show the unread portion of the kernel's message buffer before
presenting the prompt. It's bound to provide some useful info.
o Don't call kgdb_target() twice. It results in having all threads
listed twice.

MFC after: 1 week


148485 28-Jul-2005 keramida

Spell "currently" correctly.


147570 24-Jun-2005 peter

kvm_openfiles() uses the supplied buffer for storing error messages
in future calls, so we can't free it here. The right place to free the
buffer would be to be after kvm_close(), but we don't do that yet. A
static buffer would work too.

Reviewed by: marcel (who has other plans for this anyway)
Approved by: re


146818 31-May-2005 dfr

Add support for XMM registers in GDB for x86 processors that support
SSE (or its successors).

Reviewed by: marcel, davidxu
MFC After: 2 weeks


145960 06-May-2005 davidxu

Don't try to enable event reporting for core file, it is not writable.


144923 12-Apr-2005 davidxu

Report events from thread library.


144664 05-Apr-2005 davidxu

Print thread address.

PR: threads/76821


143046 02-Mar-2005 marcel

Implement and document the -q and -f options with their corresponding
long form (-quiet and -fullname resp.) Bump documentation date.

PR: bin/78031
MFC after: 5 days


142954 01-Mar-2005 obrien

.It the -v option.


142154 20-Feb-2005 kan

Restore r1.2 change to use TARGET_ARCH.

Submitted by: kris


142151 20-Feb-2005 kan

Attempt to make kgdb little more useful and easy to use. Properly initialize
it to recognise what ABI to use on amd64 (and possibly others) platform.
Display PID and process name as a part of the 'info threads' output, TIDs
alone are too confusing. Introduce new commmands 'tid <tid>' and 'proc <pid>'
to accompany gdb's default 'thread <thread num>' to make the task of switching
between different contexts easier.


141941 15-Feb-2005 marcel

Remove mention of the -k and -wcore options because they don't
exist anymore.

PR: doc/70943
Submitted by: Jun <junsu at delphij dot net>
Reviewed by: delphij


141911 14-Feb-2005 obrien

Use the system gnuregex library vs. building GNU regex bits into libiberty
and using them.

Reviewed by: marcel,imp
Desired by: ache


140175 13-Jan-2005 ru

Markup nits.


140071 11-Jan-2005 peadar

When grabbing registers for an lwp, fake the inferior's pid using the
lwp ID before invoking the underlying target operation.

For corefiles, we rely on gdb internals to do this, and it uses the
pid as an index, rather than the lwpid, so previously, backtraces
for multithreaded core files wasn't working correctly. For processes,
we currently use ptrace directly, so fixup that code to also use
the pid directly.

Discussed With: marcel, davidxu
MFC After: 4 days


139103 21-Dec-2004 ru

Start the dreaded NOFOO -> NO_FOO conversion.

OK'ed by: core


138383 05-Dec-2004 marcel

Source changes to allow building a cross-debugger. Move solib.c and
solib-svr4.c to the MD makefiles because they are native files for
alpha and sparc64, but target files for amd64, i386 and ia64.

Note that kgdb(1) does not yet build as a cross-debugger due to
libkvm.


138380 05-Dec-2004 marcel

Fix previous commit. GDB_CROSS_DEBUGGER needs to be defined for all
subdirectories.


138215 30-Nov-2004 marcel

Makefile (only) changes to allow building a cross debugger.


138213 30-Nov-2004 marcel

s/MACHINE_ARCH/TARGET_ARCH/. We use TARGET_ARCH to pick the MD files
for libgdb and should do so here as well.


137993 22-Nov-2004 joerg

[Sorry, forgot to commit my source changes in my previous commit.]
Document all options and general usage.

Implement the -a option to bump the annotation_level. This improves
the Emacs gud behaviour. You can now supply the following function

(defun gud-gdb-massage-args (file args) (cons "-a" args))

(e.g. by evaluating it from the *scratch* buffer) and get the normal
jump to the source window when browsing the stack.

We should probably eventually supply our own kgdb submode to gud.el.


137992 22-Nov-2004 joerg

Document all options and general usage.

Implement the -a option to bump the annotation_level. This improves
the Emacs gud behaviour. You can now supply the following function

(defun gud-gdb-massage-args (file args) (cons "-a" args))

(e.g. by evaluating it from the *scratch* buffer) and get the normal
jump to the source window when browsing the stack.

We should probably eventually supply our own kgdb submode to gud.el.


137990 22-Nov-2004 joerg

Fix the abuse of Ar macros for designating flag options, use Fl instead.


137731 15-Nov-2004 davidxu

Always set current thread when activating thread debugger,
the current thread may already be added by fbsd_find_new_threads,
this can result that current thread is not set correctly.


137441 09-Nov-2004 marcel

Whitespace fix.


137440 09-Nov-2004 marcel

Prepare for a subsequent import: If the first letter of the filename
changes, start on a new line. Insertion of a filename will keep the
diff limited to the block of filenames that have the same first letter
instead of creating a huge diff. While here, move remote.c after the
remote-*.c files and move tui.c after the tui-*.c files. This matches
the order of ls(1) and makes it easier to compare object files created
by a stock gdb(1) build with the list of files we have here.

This is a non-functional change only.


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


136661 18-Oct-2004 ache

Update to readline 5.0


134686 03-Sep-2004 brooks

If the argument to the -r flag starts with a ':' or a '|', don't try to
make sure it is a device. GDB special cases these prefixes and treats
:#### as a tcp port on localhost and executes what ever follows '|'.

This allows kgdb to debug via dconschat.

Discussed with: marcel


134154 22-Aug-2004 davidxu

Only compile fbsd-thread.c on amd64 and i386, other architectures
have not been tested yet.


134152 22-Aug-2004 davidxu

Fix comments, most are style fix.


134149 22-Aug-2004 davidxu

Fix some text messages.


134147 22-Aug-2004 davidxu

Add code to support statically linked binary and .core file of threaded
program.


133739 15-Aug-2004 marcel

Improve the usage. Without any arguments, kgdb(1) works on /dev/mem
with the currently running kernel image. Otherwise, one of -c, -n or
-r is expected for working on a particular core file (-c), working
on a saved dump (-n) or working remotely (-r). When working on a
saved dump, a kernel may be omitted.
For a remote debugging session (-r), kgdb(1) will use the specified
device.


133432 10-Aug-2004 davidxu

Initialize thread_db module.


133346 08-Aug-2004 davidxu

Initialize thread_db module.


133345 08-Aug-2004 davidxu

1. Add some code check if thread suspending or resuming is failed.
2. Add code to retrieve thread tls address.


132625 25-Jul-2004 marcel

Hook kgdb into the build.


132624 25-Jul-2004 marcel

Add the beginnings of kernel debugging support. the kgdb(1) tool
is basicly a shell on top of libgdb that knows about kernel threads,
kernel modules and kvm(3). As the word "beginnings" implies, not
all of the features have been implemented yet. The tool is useful
and I'd like feedback on the taken route.

The simplest way to debug a kernel core file is:
kgdb -n 0

This opens /var/crash/vmcore.0 with the corresponding kernel in
the object directory (kernel.debug is used if it exists).

Typical things that need to be added are:
o Auto loading of kernel modules,
o Handling of trapframes so that backtraces can be taken across
them,
o Some fancy commands to extract useful information out of a core
file,
o Various (probably many) other things.


132300 17-Jul-2004 marcel

o ps_pd{read|write} and ps_pt{read|write} are obsolete interface
functions. Only ps_p{read|write} remains.
o Remove ps_getpid. We don't need it now.


132244 16-Jul-2004 davidxu

ptrace's first parameter is command not pid. pointy hat to me.


132238 16-Jul-2004 marcel

Update config.h to account for the prgregset_t and psaddr_t types
that have been added to <sys/procfs.h>. This change has no effect
because the source file that would be affected is not compiled on
FreeBSD. Hence, this is for completeness only.


132179 15-Jul-2004 davidxu

Add libthread_db assisted debugging support module.


131727 06-Jul-2004 obrien

Prepare for upcoming Binutils house cleaning.


131172 27-Jun-2004 marcel

We don't have to reach into binutils/doc anymore for inc-hist.diff
The file was repo copied into our doc directory.


131131 26-Jun-2004 bde

Fixed world breakage in the NOSHARED=yes case (missing library).

Fixed some style bugs.


131087 25-Jun-2004 marcel

Add bmake glue for gdb 6.1.1. Supports alpha, amd64, i386, ia64
and sparc64.

Note that the debugger doesn't support threading, nor kernel
debugging yet.


99204 01-Jul-2002 sheldonh

Reconnect gdb info file to the build.

Submitted by: Szilveszter Adam <sziszi@bsd.hu>


75412 11-Apr-2001 ache

Upgrade for readline 4.2


58347 20-Mar-2000 peter

A bandaid to try and make this buildable. This should probably be
rechecked by somebody who knows what is meant to happen here. The new
libreadline rluser.texinfo file duplicates the '@defcodeindex bt' entry.


46330 02-May-1999 dfr

Remove old bmake framework for gdb. It has moved to live next to binutils.


46133 28-Apr-1999 luoqi

Make gdb work with kernel after the SMP vmspace sharing changes.


45258 03-Apr-1999 bde

echo -> ${ECHO}.


40391 15-Oct-1998 bde

Fixed breakage of gdbreplay's and gdbserver's BINDIR in previous commit.
They may belong in /usr/libexec/{aout,elf}, but objformat doesn't
support that.

Fixed bogus `?=' assignments for BINDIR.


40365 15-Oct-1998 peter

Install gdb in /usr/lib/aout or /usr/lib/elf depending on format.


39199 14-Sep-1998 jdp

Fix GDB so that it can handle ELF core dumps.


38634 30-Aug-1998 jb

Missed some BINFORMATs. Fingers! Can't live with 'em. Can't live without 'em.


38633 30-Aug-1998 jb

BINFORMAT -> OBJFORMAT ready for E-day. I tossed a coin to decide this
one. We'll probably need to revisit gdb after E-day.


37314 30-Jun-1998 bde

Fixed printf format errors.


35972 12-May-1998 bde

Don't attempt to read process context from the kernel when (the
kernel's) curproc is null. This fixes endless recursion in
xfer_umem() for attempts to read from user addresses, in particular
for attempts to read %fs and %gs from the pcb for `info reg'.


35697 04-May-1998 bde

Simplified using new yacc rules. This is cosmetic - the old rules
worked because .ORDER prevented problems from concurrent generation
of multiple parsers (and their headers), and there were no missing
dependencies because the generated headers were not actually used.


35588 01-May-1998 bde

Inherit BINDIR properly.


35587 01-May-1998 bde

Fixed apparent bitrot (`=' changed to `?=') in the definition of BINDIR
in the previous commit. Just don't define it here at all. This works
now that the default is inherited properly.


35586 01-May-1998 bde

Removed self-inclusion-prevention ifdef. It is unnecessary now that
bsd.man.mk doesn't include ${.CURDIR}/../Makefile.inc.

Removed GDBDIR-redefinition-prevention ifdef. It hasn't done anothing
for a long time, if ever. The directory is defined to the same value in
each subdir and had the same value because all subdirs are at the same
level. Keep defining it in the subdirs since that is more flexible and
no more verbose.

Prepare to inherit BINDIR by including ../Makefile.inc.


35585 01-May-1998 bde

Oops, This should have been committed with the Makefile change that
requires the new file.

Fixed stale near-copy of contrib/libreadline/doc/hsuser.texinfo. Patch
it at build ntime, and only keep the patch for it here.

Don't keep a copy of contrib/gdb/gdb/doc/all-cfg.texi here. Link to it
at build time.


35584 01-May-1998 bde

Fixed dependencies.

Fixed stale near-copy of contrib/libreadline/doc/hsuser.texinfo. Patch
it at build ntime, and only keep the patch for it here.

Don't keep a copy of contrib/gdb/gdb/doc/all-cfg.texi here. Link to it
at build time.


35535 30-Apr-1998 dfr

Add support for ELF shared libraries. Also use bfd from the binutils in that
case rather than gdb's own copy.


34684 19-Mar-1998 bde

Removed vestiges of use of beforedepend target.


34149 07-Mar-1998 bde

Use `foo/bar.a' instead of `-Lfoo -lbar' for linking to static internal
libraries, so that `ld -f' in can create correct dependencies for
yet-to-be-built libraries.


33297 13-Feb-1998 bde

Fixed printing of %fs and %gs for live kernels.

Only print the current pcb on startup. Printing it every time a utility
routine was called messed up the register dump for live kernels.


32620 19-Jan-1998 bde

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.


32619 19-Jan-1998 bde

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.


32603 18-Jan-1998 bde

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.


32602 18-Jan-1998 bde

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.


32600 18-Jan-1998 bde

Fixed sloppy definitions of SIGTRAMP_START and SIGTRAMP_END. The old
range was a little too large.


32597 17-Jan-1998 bde

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.


31867 19-Dec-1997 bde

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.


31363 23-Nov-1997 bde

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.


30276 10-Oct-1997 peter

#include <machine/tss.h> explicitly


30113 05-Oct-1997 jkh

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>


27718 27-Jul-1997 bde

Support 4MB pages.


27370 13-Jul-1997 bde

Don't define HOST_DATA_START_ADDR, since gdb works without it the
previous definition doesn't work on BSD4.4Lite[2] derived systems
without the changes in rev.1.27 of kern_proc.c.


27118 30-Jun-1997 bde

Removed -I path to gdb's readline. This didn't do much in -current
because the -I path to config/libreadline had precedence, but in
2.2 it help hide the bug that the -I path to the non-contrib
libreadline was garbage.


27112 30-Jun-1997 bde

gdb.info still needs a near-copy of hsuser.texinfo to avoid the
reference to the programming manual. Use this near-copy of the version
of hsuser.texinfo in contrib/libreadline instead of the stale near-copy
in contrib/gdb.


26992 27-Jun-1997 tegge

Don't depend upon the user structure having been aligned on a 8 KB boundary.
Reviewed by: Peter Wemm <peter@spinner.dialix.com.au>


26984 27-Jun-1997 peter

Zap some unused debugging printfs that I accidently left in.


26495 07-Jun-1997 bde

Support reading and writing of %fs and %gs (except from core files).


25386 02-May-1997 gj

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.


25355 01-May-1997 pst

Clean up merge from 2.2 (without spamming peter's changes)


25350 01-May-1997 peter

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.


25349 01-May-1997 peter

Fix include of <sys/dir.h> to <dirent.h> - it hits a #warning


25331 01-May-1997 pst

Fix up a spurious '@' I added at the last second


25330 01-May-1997 pst

Merge from 2.2: auto-gen init.c and add ser-tcp.c


25312 30-Apr-1997 bde

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.


25309 30-Apr-1997 bde

Backed out previous change. It just gave a more verbose Makefile by
repeating the default for MAN1.


25209 27-Apr-1997 gj

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.


25170 26-Apr-1997 pst

Activate gdbserver and gdbreplay


25150 25-Apr-1997 pst

This commit was generated by cvs2svn to compensate for changes in r25149,
which included commits to RCS files with non-trunk default branches.


25148 25-Apr-1997 pst

This commit was generated by cvs2svn to compensate for changes in r25147,
which included commits to RCS files with non-trunk default branches.


24692 07-Apr-1997 peter

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!!


24366 29-Mar-1997 peter

generate c-exp.c, f-exp.c and m2-exp.c with yacc rather than using
the generated ones in the gdb dist.


24365 29-Mar-1997 peter

Protect against multiple inclusion (All the CFLAGS+= items make the cc
command lines get rather long). (bsd.lib.mk is particularly bad at this)


23914 15-Mar-1997 gj

delete the LINKS line (link gdb to kgdb) by popular demand.


23820 12-Mar-1997 gj

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 ?


22996 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


22761 15-Feb-1997 bde

Oops, the last commit shouldn't have removed floatformat.c.


22760 15-Feb-1997 bde

Don't use the private version of vasprintf(). It doesn't understand
"%%" in format strings and tends to dump core for "%%st". I needed
"%%st" to fix the new gdb ...

Don't use the private version of strerror() either.

Use INTERNALLIB and INTERNALSTATICLIB instead of a private install
rules NOPROFILE and NOPIC. This is only slightly cleaner.
INTERNALLIB was previously only used in compatibility libraries
(libgnumalloc etc.) and INTERNALSTATICLIB was previously unused.
INTERNAL*LIB probably should be replaced by something like NOSTATICO
together with NO{STATICO,PROFILE,PIC}INSTALL.


21788 17-Jan-1997 jkh

Remove -lmalloc; it's no longer relevant.
Pointed-Out-By: jdp, dima and others.


21778 16-Jan-1997 ache

Simplify it using SRCDIR


21747 15-Jan-1997 gj

Remove mmalloc since we're now using phkmalloc. This is made possible
by the -DNO_MMALLOC flag in gdb/Makefile.

The one thing we lose by doing this, AFAIK, is the possibility of using
mmap. Does anyone use that feature at all ?

2.2 candidate ?


21746 15-Jan-1997 gj

Changes required in directory libiberty to make gdb from the sources in
/usr/src/contrib/gdb.

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

2.2 candidate ?


21745 15-Jan-1997 gj

The files in gdb/elf are now grabbed from /usr/src/contrib/gdb/include/elf.

This also applies to the last 2 commits for aout and coff. Oops !

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

2.2 candidate ?


21744 15-Jan-1997 gj

The files in gdb/coff are now grabbed from /usr/src/contrib/gdb/coff.

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

2.2 candidate ?


21743 15-Jan-1997 gj

The files in gdb/aout are now grabbed from /usr/src/contrib/gdb/aout.

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

2.2 candidate ?


21742 15-Jan-1997 gj

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 ?


21741 15-Jan-1997 gj

changes required in the doc directory for making the gdb info
files using the texi sources in /usr/src/contrib/gdb/gdb/doc.

I put a pointer to /usr/src/contrib/libreadline/doc into
Makefile.inc in the hope that the appropriate files would be
picked up.

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

2.2 candidate ?


21740 15-Jan-1997 gj

changes required in the bfd directory for making gdb
using the sources in /usr/src/contrib/gdb.

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

2.2 candidate ?


21739 15-Jan-1997 gj

changes required in the top-level directory for making gdb
using the sources in /usr/src/contrib/gdb.

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

2.2 candidate ?


21673 14-Jan-1997 jkh

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.


21587 12-Jan-1997 peter

Fix path to readline docs, since it's now in contrib


21516 11-Jan-1997 jmacd

Same deal.


21388 07-Jan-1997 jkh

Fix bogosity with gdb documentation path.
Submitted-By: Chuck Robey <chuckr@glue.umd.edu> (with fix from me)


19258 29-Oct-1996 gj

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.


18486 24-Sep-1996 bde

Really eliminated includes of the "temporary" backwards compatibility
header <sys/dir.h> in applications. My previous sweep didn't find the
places that included it without needing it.


16663 24-Jun-1996 jkh

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.


16215 08-Jun-1996 bde

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.


15933 27-May-1996 peter

Remove this version, it now comes from libc.


15679 07-May-1996 wosch

``mv'' -> ``mv -f''
``rm'' -> ``rm -f''
so mv/rm may not ask for confirmation if you are not root


15542 02-May-1996 phk

PD_SHIFT -> PDRSHIFT
PGOFSET -> PAGE_MASK


15535 02-May-1996 phk

NBPG -> PAGE_SIZE
Avoid using the struct pte stuff.


13122 30-Dec-1995 peter

recording cvs-1.6 file death


12935 19-Dec-1995 jkh

Document the -k and -w flags.
Submitted by: Gary Jennejohn <gj>


8858 30-May-1995 rgrimes

Remove trailing whitespace.


8385 09-May-1995 rgrimes

Submitted by: gj

Delete suspicious looking chunk of code that was partially commented out.


8380 09-May-1995 rgrimes

Fix nested comments for -Wcomment warnings.


8072 26-Apr-1995 jkh

Gary J's patches to make gdb -w work properly.
Submitted by: gj


7942 19-Apr-1995 joerg

Fix for the ``gdb -k /nonexistent /dev/mem'' core dump.

Submitted by: gj@freebsd.org (Gary Jennejohn)


7725 10-Apr-1995 nate

as Thomas Graichen recently wrote in private mail:

> * the gdb-4.13 of current (compiled and used under 2.0R) can not attach to my
> own processes (it works only then i'm root - else i get open failed - for my
> own processes)

how embarassing ! This turns out to be a bug in infptrace.c. Below
is a patch. Could some kind soul apply it ?

Submitted by: "Gary J." <garyj@rks32.pcs.dec.com>


7653 07-Apr-1995 nate

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.


6080 31-Jan-1995 bde

Fix reading of stack addresses from core files. USRSTACK now really is
the (top of the) user stack.


5678 17-Jan-1995 jkh

Here's a patch to gdb-4.13 to add dyadic frames, as per J"org Wunsch.
Could somebody apply it?
Submitted by: gj


5535 12-Jan-1995 jkh

Good grammar and good taste, from Gary Jennejohn.
Submitted by: gj


5515 11-Jan-1995 ache

doc added


5514 11-Jan-1995 ache

Add annotate target


5513 11-Jan-1995 ache

Install infopages


5419 06-Jan-1995 ache

Remove regex code, use -lgnuregex instead


5414 06-Jan-1995 bde

Handle segment registers (except %fs and %gs).


5319 31-Dec-1994 bde

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().


5318 31-Dec-1994 bde

Fix declaration of i386_float_info().


5317 31-Dec-1994 bde

Restore our local changes which were clobbered by the previous commit.

cvs is not being used effectively for gdb. Our old changes get clobbered
and our new changes are mixed with "vendor" changes in the same updates
so they will be difficult to untangle for the next release of gdb. The
revision logs get spammed for each release of gdb.


5316 31-Dec-1994 bde

Hide yet another redefinition of PAGE_SIZE. Cosmetic.


5315 31-Dec-1994 bde

Restore our (cosmetic) local changes which were clobbered by the previous
commit (do them slightly differently).


5301 30-Dec-1994 jkh

Bring in the files added by Gary Jennejohn's gdb update.
Submitted by: gj


5300 30-Dec-1994 jkh

Hurrah! Let the champagne flow, the olive oil barrel be opened and
the wild, slippery orgy commence!

Gary Jennejohn, too studly for his own good, has finally come through with
the new, improved gdb 4.13. This gdb features:

o kgdb support - if this works (and I urge folks to test it), we can
finally purge the old and hateful version of kgdb from our source
tree.

o attach/detach support. See comments in README.FreeBSD for more
details.

o Well, it's newer. Our previous version was 4.11.

Comments and flames to gj, of course! :-)

Thanks, Gary. Much appreciated. The previous state of gdb/kgdb has been a
thorn in all of our sides for some time..
Submitted by: gj


4850 28-Nov-1994 ats

Add the automatically generated files: y.tab.h c-exp.tab.c ch-exp.tab.c and
m2-exp.tab.c to the CLEANFILES target.


4451 14-Nov-1994 bde

Include <sys/types.h> early. This will be required when <stdio.h> and/or
<signal.h> are fixed to not include it.

Bruce


3299 02-Oct-1994 ache

#define HAVE_TERMIOS added for proper terminal handling
Submitted by: smcarey@mailbox.syr.edu


2919 20-Sep-1994 bde

Add dependency for -lcompat.


2781 15-Sep-1994 swallace

Added ${DESTDIR} in the line
CFLAGS+= -I$(.CURDIR)/. -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd


2677 11-Sep-1994 rgrimes

Change all references to LIBTERM and -ltermlib to LIBTERMCAP and -ltermcap


1878 05-Aug-1994 wollman

Need -lcompat to link under 2.0.


1721 15-Jun-1994 adam

correct location of corefile data segment


1718 14-Jun-1994 ache

Add LIBREADLINE and LIBTERM to DPADD


1713 13-Jun-1994 ache

Remove PAGE_SIZE redifinition (from param.h)


1709 11-Jun-1994 paul

Moved -DTRAD_CORE from gdb/Makefile to bfd/Makefile


1708 11-Jun-1994 paul

Modev -DTRAD_CORE for gdb/Makefile to bfd/Makefile


1701 10-Jun-1994 paul

Two files I "lost" the first time.
GDB4:


1700 10-Jun-1994 paul

GDB-4.12 from ports with support for shlibs but not the kernel.

This is a greatly pared down version of the full gdb-4.12, all the
config stuff has been removed and the supporting libraries have
been stripped to a minimum. This is a 1.1.5 only port, I'll do a
more complete port for 2.0 which will have all the config stuff
and will install the gnu support libraries as system libraries like
we do for readline.

There wasn't much point for 1.1.5 since only gdb would use them so I
went for saving space instead. For 2.0 I'll config all the
other gnu tools to use them as well.


1470 09-May-1994 ache

Remove readline copy, now gdb use gnu lib tree libreadline


1452 04-May-1994 adam

Use correct stack segment with corefiles.


925 03-Jan-1994 dg

Only use syscallmap if FM_TRAP or EX_TRAPSTK are defined.


820 01-Dec-1993 ats

deleted all references to rindex and included string.h instead.


819 01-Dec-1993 ats

changed the order of the includes and deleted a reference to index
nd added an include to string.h instead


195 26-Jul-1993 paul

Added Charles changes for GCC@ symbols.


81 01-Jul-1993 nate

Bruce Evans:

The enclosed diffs implement printing of the floating point state for
the version of gdb-3.5 in 386BSD-0.0. I don't have gdb for 386BSD-0.1
but I've been told that it is also missing this feature.

The changes are small. Code to read the FP state from the kernel was
#ifdef'ed out, but it essentially works. Code to change the FP regs
is still #ifdef'ed out. It is close to working too. Printing of the
FP regs was broken because hard reg numbers were confused with stack
offsets.

4. The emulator does not handle FP errors right, and it does not
communicate the emulated FP state to the rest of the kernel, so
"info float" shows garbage.


74 29-Jun-1993 nate

Added GNU gdb to src/gnu