Commit Graph

310 Commits

Author SHA1 Message Date
Warner Losh
b29d0c6134 Simplify how we select which architectures to add gdbserver for. If
the MD files exist, compile it, otherwise omit it.
2010-04-12 23:35:58 +00:00
Marcel Moolenaar
2a4510e122 Allow building a cross-kgdb for ia64. 2010-03-26 19:41:40 +00:00
Marcel Moolenaar
10da4aa601 Handle cross-builds for gdbserver. 2010-03-26 19:40:53 +00:00
Warner Losh
ae84e39b61 Fix typo in comment 2010-03-19 05:40:47 +00:00
Jung-uk Kim
bdcf2df5c2 Initial gdbserver support for amd64. 2010-02-25 21:29:00 +00:00
Randall Stewart
7e1f32462d 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
2010-02-20 17:29:27 +00:00
Marcel Moolenaar
f6c3201d66 Compile fbsd-threads.c. Threading & TLS support is working just fine. 2010-02-16 16:38:57 +00:00
Andriy Gapon
c12959b335 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
2010-02-13 11:47:04 +00:00
Rafal Jaworowski
ab8b490a63 Initial gdbserver support for PowerPC.
Obtained from:	Juniper Networks, Semihalf
2009-02-23 18:22:49 +00:00
Rafal Jaworowski
c7b4433263 Initial gdbserver support for ARM.
Obtained from:	Juniper Networks, Semihalf
2008-11-17 16:32:57 +00:00
David E. O'Brien
ee81baecd8 Document what the sed trick is for.
Remove an embedded <TAB>, and use same style for both files.
2008-10-16 18:09:27 +00:00
John Baldwin
27f38446be Oops, initialize sections and sections_end to NULL.
Submitted by:	Navdeep Parhar
MFC after:	1 week
2008-10-02 20:42:10 +00:00
Konstantin Belousov
42003afced 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
2008-09-27 15:58:37 +00:00
John Baldwin
59c47d99be 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
2008-09-25 19:32:03 +00:00
Marcel Moolenaar
93898f2b2d 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.
2008-09-14 16:52:42 +00:00
Olivier Houchard
7aab344dc1 Unbreak the arm build, by spelling LIBSRCS correctly. 2008-08-02 12:33:39 +00:00
Olivier Houchard
21fb986f16 Do not build fbsd-threads.c if we're building a cross-debugger.
MFC after:	3 days
2008-08-02 01:21:04 +00:00
John Baldwin
ad335b4edf 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@
2008-06-18 14:23:28 +00:00
David E. O'Brien
486b0cc401 Add Juniper's copyright. 2008-05-20 22:58:47 +00:00
David E. O'Brien
aa4a28bd31 MIPS arch target kgdb(1) support.
Obtained from: Juniper Networks.
2008-05-20 22:54:42 +00:00
John Baldwin
084bc6a480 Trim unneeded header. 2008-05-09 19:00:40 +00:00
John Baldwin
53df73db45 - 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
2008-05-01 20:36:48 +00:00
John Baldwin
3461a0f244 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
2008-04-29 20:32:45 +00:00
John Baldwin
624e4d168d - 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
2008-04-29 17:47:25 +00:00
John Baldwin
34f36b232b 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
2008-04-28 18:27:19 +00:00
John Baldwin
064e8b005f 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
2008-04-28 15:26:11 +00:00
Warner Losh
2fd1934152 FreeBSD/mips gdb build suspport. From the mips2-jnpr branch. 2008-04-26 12:22:46 +00:00
John Baldwin
36cc36a0ec 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
2008-03-29 17:46:03 +00:00
John Baldwin
ec922be302 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
2008-03-29 03:48:06 +00:00
John Baldwin
af6e49e963 Remove a stale prototype I missed when converting the kld support over to
hooking into gdb's shared library infrastructure.
2008-02-25 22:04:07 +00:00
John Baldwin
2369087a60 - 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.
2008-01-29 23:44:34 +00:00
John Baldwin
d6022a04c5 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.
2008-01-29 23:37:59 +00:00
John Baldwin
c989eb07bb Use target_read_memory() and extract_unsigned_integer() instead of direct
KVM access to read kernel pointers.
2008-01-29 23:36:42 +00:00
John Baldwin
a4d5f8a2b7 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.
2008-01-29 23:36:10 +00:00
John Baldwin
9f24dd4d32 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.
2008-01-28 21:45:09 +00:00
John Baldwin
5ca09def5b 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
2008-01-28 21:40:10 +00:00
John Baldwin
fea3c2c5c7 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.
2008-01-28 20:33:19 +00:00
John Baldwin
4d6cae0d4d If the quiet flag is specified (-q), don't dump the unread portion of
the message buffer on startup.
2008-01-28 20:31:30 +00:00
John Baldwin
4496b3577d Move the code for working with kld's out into its own file. 2008-01-24 19:11:13 +00:00
Ed Maste
b2f965152c Include the thread name (in addition to the proc name) in "info threads." 2008-01-18 18:57:27 +00:00
John Baldwin
933785a027 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
2008-01-17 21:43:12 +00:00
Olivier Houchard
796677a89e Add thread support for arm.
MFC After:	1 week
2007-11-17 21:30:03 +00:00
Olivier Houchard
fdad867fc6 There's no reason why we couldn't attach to a live process on arm.
MFC After:	1 week
2007-11-17 18:41:04 +00:00
John Baldwin
f157925999 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
2007-11-16 22:17:37 +00:00
John Baldwin
4ba3dab395 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)
2007-08-22 20:28:13 +00:00
Alexander Kabaev
44f3233714 Remove extern int verbose declaration. It is declared static in the
only file it is used in.
2007-05-19 03:23:43 +00:00
Alexander Kabaev
520d6ec0d8 Fix static/extern mismatch by patching corresponding tdep files
in-place.
2007-05-19 03:22:19 +00:00
Marcel Moolenaar
28db227dc2 Add threading support. 2007-05-01 18:29:34 +00:00
Konstantin Belousov
0a592d0535 Unbreak the kgdb stepping over the special frames on i386 after rev. 1.117 of
i386/i386/exception.s.

No objections from:	marcel
2007-03-01 13:56:08 +00:00
Konstantin Belousov
d7eb5fb599 Rename lookup() to kgdb_lookup() and make it global (for use in trgt_i386.c).
No objections from:	marcel
2007-03-01 13:55:15 +00:00
Ed Maste
5a16cfaeb6 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
2007-02-20 18:10:13 +00:00
Craig Rodrigues
c4b1628e07 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
2007-01-25 06:39:25 +00:00
Ruslan Ermilov
afa56e7db8 Bump document date for the previous change. 2006-10-21 17:39:35 +00:00
John-Mark Gurney
870fe2a280 Turn on gdbserver for the arch that supports it.. 2006-10-21 17:27:36 +00:00
John Baldwin
a5146161ae Trim trailing whitespace. 2006-10-16 20:07:23 +00:00
John Baldwin
62f6176c27 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
2006-10-16 20:06:32 +00:00
David E. O'Brien
1d60a995b9 Document '-w' from main.c rev. 1.11. 2006-10-11 14:42:43 +00:00
Warner Losh
280075717e Add cross debug support to arm.
Submitted by: cognet@
2006-09-14 07:51:52 +00:00
Warner Losh
46e96d9a58 Architecture specific portions of gdb for arm.
Submitted by: cognet@
2006-09-14 06:49:34 +00:00
John Baldwin
63ed2c123d 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
2006-08-25 16:20:17 +00:00
Marcel Moolenaar
8788b6eb7a Add initial support for kgdb(1) on PowerPC. 2006-08-24 21:53:49 +00:00
Marcel Moolenaar
d3715149da Add basic support for PowerPC. This excludes kgdb(1). 2006-08-24 02:44:59 +00:00
John Baldwin
c198287ff3 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
2006-08-23 19:16:17 +00:00
Ruslan Ermilov
9d26d008ac Remove alpha-specific stuff.
Approved by:	marcel
2006-08-23 12:14:26 +00:00
David E. O'Brien
ff0c6b70eb Add initial platform support.
Submitted by:	cognet
2006-07-22 15:27:18 +00:00
Ruslan Ermilov
ea59cd4167 Clean the product of patch(1). 2006-04-10 09:00:19 +00:00
John-Mark Gurney
c7f87cc77f 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..
2006-04-06 22:24:01 +00:00
John-Mark Gurney
2f05465cd1 import gdbserver Linux files renamed to fbsd... I have made gdbserver
work w/ minor modifications to these files, so keep the history...

These are stock files from GDB 6.1.1 w/ only the filename s/linux/fbsd/g
2006-04-06 21:32:05 +00:00
David Xu
d56a014b6e Introduce a new proc service routine ps_linfo() to get LWP info. 2006-02-07 02:29:55 +00:00
David Xu
9224f6b811 1. Eliminate compile warnings.
2. Add command 'thread signal' to print out current thread's signal mask
   and pending signals.
2006-02-06 06:07:56 +00:00
Alexander Kabaev
daefc6601d 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
2006-01-04 23:17:52 +00:00
Marcel Moolenaar
6631d1e9cd Fix dump of the unread portion of the kernel message buffer.
PR: bin/87964
Submitted by: Frank Mayhar	frank at exit dot com
2005-10-26 02:22:28 +00:00
Peter Wemm
de143d260c Unbreak - remove leftover reference to pcb_rflags. 2005-09-28 07:40:27 +00:00
Marcel Moolenaar
dc78598a0f 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
2005-09-11 06:52:14 +00:00
Marcel Moolenaar
78af1d5d26 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
2005-09-11 05:55:24 +00:00
Marcel Moolenaar
af08e55700 Unwind across intrframes as well.
MFC after: 1 week
2005-09-11 05:36:30 +00:00
Marcel Moolenaar
4784fd9ce2 Unwind across trap frames. Handles all entry points, except the EPC
syscall. This is an entry from userland anyway.

MFC after: 1 week
2005-09-11 00:47:03 +00:00
Marcel Moolenaar
2a5bd389cf Unwind across trapframes. All kernel entries are handled.
MFC after: 1 week
2005-09-10 23:11:54 +00:00
Marcel Moolenaar
35f38699dc 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
2005-09-10 22:03:09 +00:00
Marcel Moolenaar
a8f01390e1 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
2005-09-10 21:01:36 +00:00
Marcel Moolenaar
6ab0894870 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
2005-09-10 20:12:52 +00:00
Marcel Moolenaar
c67d07416a 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
2005-09-10 18:25:53 +00:00
Marcel Moolenaar
3b347f6ccc Fix backtraces. Supply registers from the register window.
MFC after: 3 days
2005-08-16 05:13:57 +00:00
Marcel Moolenaar
688deacdfa 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
2005-08-06 19:22:27 +00:00
Marcel Moolenaar
9ca14a4113 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
2005-08-06 19:07:07 +00:00
Giorgos Keramidas
75eb780790 Spell "currently" correctly. 2005-07-28 15:59:52 +00:00
Peter Wemm
8015e78d5d 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
2005-06-24 00:50:12 +00:00
Doug Rabson
8d7681bb7f Add support for XMM registers in GDB for x86 processors that support
SSE (or its successors).

Reviewed by: marcel, davidxu
MFC After: 2 weeks
2005-05-31 09:43:04 +00:00
David Xu
e8595f94cd Don't try to enable event reporting for core file, it is not writable. 2005-05-06 11:01:15 +00:00
David Xu
e6e653cd66 Report events from thread library. 2005-04-12 03:04:04 +00:00
David Xu
0d6c666e74 Print thread address.
PR: threads/76821
2005-04-05 11:40:58 +00:00
Marcel Moolenaar
7c6ae50b9d 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
2005-03-02 18:40:04 +00:00
David E. O'Brien
39e38e7623 .It the -v option. 2005-03-01 20:41:38 +00:00
Alexander Kabaev
d723452067 Restore r1.2 change to use TARGET_ARCH.
Submitted by:	kris
2005-02-20 23:06:03 +00:00
Alexander Kabaev
325ce5d8fb 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.
2005-02-20 22:55:07 +00:00
Marcel Moolenaar
56c1065a47 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
2005-02-15 07:13:51 +00:00
David E. O'Brien
01950bb64f Use the system gnuregex library vs. building GNU regex bits into libiberty
and using them.

Reviewed by:	marcel,imp
Desired by:	ache
2005-02-14 12:10:14 +00:00
Ruslan Ermilov
42b28e8149 Markup nits. 2005-01-13 10:07:51 +00:00
Peter Edwards
ad93bc4a36 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
2005-01-11 14:53:16 +00:00
Ruslan Ermilov
e653b48c80 Start the dreaded NOFOO -> NO_FOO conversion.
OK'ed by:	core
2004-12-21 08:47:35 +00:00