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
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
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
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
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
source upgrades by falling back to GNU ar(1) as necessary. Option
WITH_BSDAR is gone. Option _WITH_GNUAR to aid in upgrades is *not*
supposed to be set by the user.
Stop bootstrapping BSD ar(1) on the next __FreeBSD_version bump, as
there are no known bugs in it. Bump __FreeBSD_version to anticipate
this and to flag the switch to BSD ar(1), should it be needed for
something.
Input from: obrien, des, kaiw
variations (e500 currently), this provides a gcc-level FPU emulation and is an
alternative approach to the recently introduced kernel-level emulation
(FPU_EMU).
Approved by: cognet (mentor)
MFp4: e500
binutils ar and ranlib to gar and granlib, respectively.
* Introduce a temporary variable WITH_GNUAR as a safety net.
When buildworld with -DWITH_GNUAR, GNU binutils ar and ranlib
will install as default ones and 'BSD' ar will be disabled.
* Bump __FreeBSD_version to reflect the import of 'BSD' ar(1).
Approved by: jkoshy (mentor)
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.
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.
- 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
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.
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
(as a nice side affect, this will make gnu/usr.bin/cvs/contrib/Makefile
have a later date than contrib/cvs/contrib/Makefile.in - which will help
the build break after the 1.11.22 CVS import...)
libraries had not had their versions bumped relative to 6.3-REL but
had indeed been changed. We need to bump their version so they can be
properly added to the compat6x port:
libasn1.so.8 libgssapi.so.8 libhdb.so.8 libkadm5clnt.so.8
libkadm5srv.so.8 libkafs5.so.8 libkrb5.so.8 libobjc.so.2
MFC After: 1 day
- 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
support for these. This is in line with gnu/lib/libgomp/config.h and
gnu/lib/libstdc++/config.h.
Reviewed by: cognet, obrien
Approved by: re (kensmith)
bad code at -O2. Since this is likely caused by the low-level
optimizer, testing TARGET_ARCH rather than MACHINE_ARCH should
handle ia64 cross-compilation as well. With this work-around
in place, we can release using the current GCC and Binutils
code at the default optimization level on ia64.
Approved by: re (kensmith)
Pointy hat to: me and my absence of -Wall in my CFLAGS.
MFC will happen at the same time of the earlier commit.
Thanks to ru@ for spotting.
Approved by: re (Ken Smith), grog@ (mentor)
Some ports will install with compressed manpages. man handles
this by looking for the .gz version of a man source file.
It is also common to include other files with the .so
directive where commands or functions share a man page.
Traditionally ports have had to handle this by either not
compressing the manpages, or using the _MLINKS macro in the
port makefile to create symlinks to the actual source file,
rather than using .so versions. Notably, the current version
of Xorg port breaks. See ports/113096 and ports/115845.
PR: bin/115850
Submitted by: Callum Gibson <callumgibson@optusnet.com.au>
Approved by: re@ (ken smith), grog@ (mentor)
MFC after: 1 week
that need to be activated specifically for the case of a native linker
actually are enabled. Specifically, this makes ld(1) look for shared
libraries in LD_LIBRARY_PATH in the native case, as documented in the
man page.
PR: gnu/96481
Approved by: re (kensmith)
MFC after: 2 weeks
32 bits, so subsequent compile time assertion:
sizeof inf->stat.st_mtime <= sizeof sec
Would fail because of that. This change is suitable for
general consumption as well, but fix it in our local
patchset as we are near a code freeze.
Submitted by: cognet
that the build failure was caused by a computer/sources date/time
mismatch that caused GCC tools to be mistakenly rebuilt again at
an inappropriate time during buildworld, re-linking them against
new libraries instead of host's installed libraries and thus making
them not runnable by the host. Normally they are only built in
the early stage of buildworld (build-tools) that links them against
shared libraries of the host, but if either the system clock or
modification date/time on source files is set incorrectly, make(1)
can be foolished into thinking that tools are stale and will rebuild
them again, now in the "target" environment which is not suitable
for building helper apps that are to be run during buildworld.
OK'ed by: kan
Also:
Switch FreeBSD to use libgcc_s.so.1.
Use dl_iterate_phdr to locate shared objects' exception frame
info instead of depending on older register_frame_info machinery.
This allows us to avoid depending on libgcc_s.so.1 in binaries
that do not use exception handling directly. As an additional
benefit it breaks circular libc <=> libgcc_s.so.1 dependency too.
Build newly added libgomp.so.1 library, the runtime support
bits for OpenMP.
Build LGPLed libssp library. Our libc provides our own
BSD-licensed SSP callbacks implementation, so this library
is only built to benefit applications that have hadcoded
knowledge of libssp.so and libssp_nonshared.a. When linked
in from command line, these libraries override libc
implementation.
'target'. Latter is problematic in particular as apparently FreeBSD's
bsd.prog.mk re-defines it under some circumstances. This causes an
unexpected failures like -dumpmachine not working for cc while working
fine for c++.
Do not re-define IN_GCC in multipe places, it gets inherited from
Makefile.in anyway.
PR: gnu/110143
Submitted by: usleepless at gmail
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
Only PowerPC supports both 32-bit and 64-bit targets and the
BFD_DEFAULT_TARGET_SIZE is used by the binutils code to reflect
the preferred ABI. We define BFD_DEFAULT_TARGET_SIZE for all
platforms, but based on the build machine. As such 64-bit build
machines defined BFD_DEFAULT_TARGET_SIZE incorrectly for 32-bit
targets, but since this only affects PowerPC it went unnoticed
for a long time.
The fix is to define BFD_DEFAULT_TARGET_SIZE based on the target
architecture.
PR: amd64/102996
MFC after: 1 month
NetBSD version is a feature-to-feature re-implementation of GNU
gzip using the freely-redistributable zlib and this version is
expected to be mostly bug-to-bug compatible with the GNU
implementation.
- Because this is a piece of mature code and we want to make
changes so it is added directly rather than importing to
src/contrib.
- Connect newly added code to src/usr.bin/ and rescue/rescue
build.
- Disconnect the GNU gzip code from build for now, they will
be eventually removed completely.
- Provide two new src.conf(5) knobs, WITHOUT_BZIP2_SUPPORT and
WITHOUT_BZIP2.
Tested by: kris (full exp-7 pointyhat build)
Approved by: core (importing a 4-clause BSD licensed file)
Approved by: re (adding new utility during -HEAD code slush)