mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
Fix several issues with kgdb:
- The kld parsing code in kgdb was using basename() and dirname() which ended up being broken by the recent changes to make dirname() modify its input buffer. Modify fbsd-kld.c to use the lbasename() and ldirname() wrappers in gdb. - Add the kgdb.1 manpage from base and install it as 'kgdbNNN.1' which is helpful since stock HEAD no longer ships a kgdb manpage. - Link libkvm into mips binaries so that the vmcore target links. - Bump PORTREVISION. PR: 219028 Reviewed by: luca.pizzamiglio@gmail.com (maintainer) Approved by: rene
This commit is contained in:
parent
cdad0b250b
commit
01ab520c16
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=440447
5 changed files with 162 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
PORTNAME= gdb
|
PORTNAME= gdb
|
||||||
PORTVERSION= 7.12.1
|
PORTVERSION= 7.12.1
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= devel
|
CATEGORIES= devel
|
||||||
MASTER_SITES= GNU
|
MASTER_SITES= GNU
|
||||||
|
|
||||||
|
@ -98,6 +99,8 @@ do-install:
|
||||||
do-install-KGDB-on:
|
do-install-KGDB-on:
|
||||||
${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \
|
${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \
|
||||||
${STAGEDIR}${PREFIX}/bin/kgdb${VER}
|
${STAGEDIR}${PREFIX}/bin/kgdb${VER}
|
||||||
|
${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \
|
||||||
|
${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1
|
||||||
|
|
||||||
do-install-TUI-on:
|
do-install-TUI-on:
|
||||||
${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER}
|
${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER}
|
||||||
|
|
|
@ -95,6 +95,16 @@ index c82a5b4bac..34140b2d59 100644
|
||||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||||
#undef HAVE_LANGINFO_CODESET
|
#undef HAVE_LANGINFO_CODESET
|
||||||
|
|
||||||
|
diff --git gdb/config/mips/fbsd.mh gdb/config/mips/fbsd.mh
|
||||||
|
index f433347a20..5470795612 100644
|
||||||
|
--- gdb/config/mips/fbsd.mh
|
||||||
|
+++ gdb/config/mips/fbsd.mh
|
||||||
|
@@ -1,3 +1,5 @@
|
||||||
|
# Host: FreeBSD/mips
|
||||||
|
NATDEPFILES= fork-child.o inf-ptrace.o fbsd-nat.o mips-fbsd-nat.o
|
||||||
|
HAVE_NATIVE_GCORE_HOST = 1
|
||||||
|
+
|
||||||
|
+LOADLIBES= -lkvm
|
||||||
diff --git gdb/configure gdb/configure
|
diff --git gdb/configure gdb/configure
|
||||||
index b5c045cf10..68299ff16c 100755
|
index b5c045cf10..68299ff16c 100755
|
||||||
--- gdb/configure
|
--- gdb/configure
|
||||||
|
|
|
@ -150,12 +150,16 @@ find_kld_path (char *filename, char *path, size_t path_size)
|
||||||
|
|
||||||
info = get_kld_info();
|
info = get_kld_info();
|
||||||
if (exec_bfd) {
|
if (exec_bfd) {
|
||||||
kernel_dir = dirname(bfd_get_filename(exec_bfd));
|
kernel_dir = ldirname(bfd_get_filename(exec_bfd));
|
||||||
if (kernel_dir != NULL) {
|
if (kernel_dir != NULL) {
|
||||||
|
cleanup = make_cleanup(xfree, kernel_dir);
|
||||||
snprintf(path, path_size, "%s/%s", kernel_dir,
|
snprintf(path, path_size, "%s/%s", kernel_dir,
|
||||||
filename);
|
filename);
|
||||||
if (check_kld_path(path, path_size))
|
if (check_kld_path(path, path_size)) {
|
||||||
|
do_cleanups(cleanup);
|
||||||
return (1);
|
return (1);
|
||||||
|
}
|
||||||
|
do_cleanups(cleanup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (info->module_path_addr != 0) {
|
if (info->module_path_addr != 0) {
|
||||||
|
@ -206,7 +210,7 @@ find_kld_address (char *arg, CORE_ADDR *address)
|
||||||
struct kld_info *info;
|
struct kld_info *info;
|
||||||
CORE_ADDR kld;
|
CORE_ADDR kld;
|
||||||
char *kld_filename;
|
char *kld_filename;
|
||||||
char *filename;
|
const char *filename;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
info = get_kld_info();
|
info = get_kld_info();
|
||||||
|
@ -214,7 +218,7 @@ find_kld_address (char *arg, CORE_ADDR *address)
|
||||||
info->off_filename == 0 || info->off_next == 0)
|
info->off_filename == 0 || info->off_next == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
filename = basename(arg);
|
filename = lbasename(arg);
|
||||||
for (kld = read_pointer(info->linker_files_addr); kld != 0;
|
for (kld = read_pointer(info->linker_files_addr); kld != 0;
|
||||||
kld = read_pointer(kld + info->off_next)) {
|
kld = read_pointer(kld + info->off_next)) {
|
||||||
/* Try to read this linker file's filename. */
|
/* Try to read this linker file's filename. */
|
||||||
|
|
140
devel/gdb/files/kgdb/kgdb.1
Normal file
140
devel/gdb/files/kgdb/kgdb.1
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
.\" Copyright (c) 2004 Marcel Moolenaar
|
||||||
|
.\" All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
|
.\"
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
.\" SUCH DAMAGE.
|
||||||
|
.\"
|
||||||
|
.\" $FreeBSD$
|
||||||
|
.\"
|
||||||
|
.Dd October 11, 2006
|
||||||
|
.Dt KGDB 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm kgdb
|
||||||
|
.Nd "kernel debugger"
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op Fl a | Fl f | Fl fullname
|
||||||
|
.Op Fl b Ar rate
|
||||||
|
.Op Fl q | Fl quiet
|
||||||
|
.Op Fl v
|
||||||
|
.Op Fl w
|
||||||
|
.Op Fl d Ar crashdir
|
||||||
|
.Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device
|
||||||
|
.Op Ar kernel Op Ar core
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility is a debugger based on
|
||||||
|
.Xr gdb 1
|
||||||
|
that allows debugging of kernel core files.
|
||||||
|
.Pp
|
||||||
|
The options are as follows:
|
||||||
|
.Bl -tag -width ".Fl d Ar crashdir"
|
||||||
|
.It Fl a
|
||||||
|
Increase the annotation level.
|
||||||
|
An annotation level of 1 features the historical
|
||||||
|
.Fl fullname
|
||||||
|
option of
|
||||||
|
.Xr gdb 1 .
|
||||||
|
This is useful when running
|
||||||
|
.Nm
|
||||||
|
in Emacs.
|
||||||
|
The
|
||||||
|
.Fl f
|
||||||
|
or
|
||||||
|
.Fl fullname
|
||||||
|
options are supported for backward compatibility as well.
|
||||||
|
.It Fl b Ar rate
|
||||||
|
Set the baudrate to
|
||||||
|
.Ar rate .
|
||||||
|
.It Fl q
|
||||||
|
Suppress printing of the banner when the debugger starts.
|
||||||
|
The
|
||||||
|
.Fl quiet
|
||||||
|
form is supported for compatibility as well.
|
||||||
|
.It Fl v
|
||||||
|
Increase verbosity.
|
||||||
|
.It Fl w
|
||||||
|
Opens kmem-based targets in read-write mode.
|
||||||
|
(This is identical to what
|
||||||
|
.Fl -wcore
|
||||||
|
used to do in previous
|
||||||
|
gdb versions for
|
||||||
|
.Fx . )
|
||||||
|
.It Fl d Ar crashdir
|
||||||
|
Use
|
||||||
|
.Ar crashdir
|
||||||
|
instead of the default,
|
||||||
|
.Pa /var/crash
|
||||||
|
to locate kernel core dump files in.
|
||||||
|
The name
|
||||||
|
.Pa vmcore.
|
||||||
|
plus the dump number will be appended to determine
|
||||||
|
the actual dump file name.
|
||||||
|
.It Fl c Ar core
|
||||||
|
Explicitly use
|
||||||
|
.Ar core
|
||||||
|
as the core dump file.
|
||||||
|
.It Fl n Ar dumpnr
|
||||||
|
Use the kernel core dump file numbered
|
||||||
|
.Ar dumpnr
|
||||||
|
for debugging.
|
||||||
|
.It Fl r Ar device
|
||||||
|
Use
|
||||||
|
.Ar device
|
||||||
|
to connect
|
||||||
|
.Nm
|
||||||
|
to for a remote debugging session.
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Fl c , n ,
|
||||||
|
and
|
||||||
|
.Fl r
|
||||||
|
options are mutually exclusive.
|
||||||
|
.Pp
|
||||||
|
Optionally, the name of the kernel symbol file and
|
||||||
|
the name of the core dump file can be supplied on the
|
||||||
|
command-line as positional arguments.
|
||||||
|
If no kernel symbol file name has been given, the
|
||||||
|
symbol file of the currently running kernel will be
|
||||||
|
used.
|
||||||
|
If no core dump file has been specified through either
|
||||||
|
of the options or the last command-line argument,
|
||||||
|
.Pa /dev/mem
|
||||||
|
will be opened to allow debugging the currently running
|
||||||
|
kernel.
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width ".Pa /var/crash"
|
||||||
|
.It Pa /dev/mem
|
||||||
|
Default memory image to open if no core dump file
|
||||||
|
has been specified.
|
||||||
|
.It Pa /var/crash
|
||||||
|
Default directory to locate kernel core dump files.
|
||||||
|
.El
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr gdb 1
|
||||||
|
.Sh HISTORY
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility first appeared in its current form in
|
||||||
|
.Fx 5.3 .
|
|
@ -4,6 +4,7 @@ bin/gdb%%VER%%
|
||||||
%%TUI%%bin/gdbtui%%VER%%
|
%%TUI%%bin/gdbtui%%VER%%
|
||||||
%%KGDB%%bin/kgdb%%VER%%
|
%%KGDB%%bin/kgdb%%VER%%
|
||||||
man/man1/gdb%%VER%%.1.gz
|
man/man1/gdb%%VER%%.1.gz
|
||||||
|
%%KGDB%%man/man1/kgdb%%VER%%.1.gz
|
||||||
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/__init__.py
|
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/__init__.py
|
||||||
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/FrameDecorator.py
|
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/FrameDecorator.py
|
||||||
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/FrameIterator.py
|
%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/FrameIterator.py
|
||||||
|
|
Loading…
Add table
Reference in a new issue