History log of /freebsd-10-stable/usr.bin/gcore/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
318192 11-May-2017 jhb

MFC 313407,313449: Copy ELF machine/flags from binaries to core dumps.

313407:
Copy the e_machine and e_flags fields from the binary into an ELF core dump.

In the kernel, cache the machine and flags fields from ELF header to use in
the ELF header of a core dump. For gcore, the copy these fields over from
the ELF header in the binary.

This matters for platforms which encode ABI information in the flags field
(such as o32 vs n32 on MIPS).

313449:
Trim trailing whitespace (mostly introduced in r313407).

Sponsored by: DARPA / AFRL

308009 28-Oct-2016 jhb

MFC 303002: Include process IDs in core dumps.

When threads were added to the kernel, the pr_pid member of the
NT_PRSTATUS note was repurposed to store LWP IDs instead of process
IDs. However, the process ID was no longer recorded in core dumps.
This change adds a pr_pid field to prpsinfo (NT_PRSINFO). Rather than
bumping the prpsinfo version number, note parsers can use the note's
payload size to determine if pr_pid is present.

306786 06-Oct-2016 jhb

MFC 302859: Include command line arguments in core dump process info.

Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command
line arguments.

306781 06-Oct-2016 jhb

MFC 299458: Fix buffer overrun in gcore(1) NT_PRPSINFO

Use size of destination buffer, rather than a constant that may or may not
correspond to the source buffer, to restrict the length of copied strings. In
particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1.

Use strlcpy instead of strncpy to ensure the result is nul-terminated. This
seems to be what is expected of these fields.

303058 20-Jul-2016 markj

MFC r302179:
gcore: Forward pending signals when detaching from the target.

283910 02-Jun-2015 jhb

MFC 281266:
Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h>
and export them to userland.
- Define __HAVE_REG32 on platforms that define a reg32 structure and check
for this in <sys/procfs.h> to control when to export prstatus32, etc.
- Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures.
libbfd looks for these types, and having them fixes 'gcore' in gdb of a
32-bit process on a 64-bit platform.
- Use the structure definitions from <sys/procfs.h> in gcore's elf32 core
dump code instead of duplicating the definitions.

283909 02-Jun-2015 jhb

MFC 269128:
Create 32-bit core files for 32-bit processes on 64-bit machines.
The 64-bit machine supported right now is amd64, but it's not too
hard to add powerpc64.

280966 01-Apr-2015 jhb

MFC 278761:
Include OBJT_PHYS VM objects in ELF core dumps. In particular this
includes the shared page allowing debuggers to use the signal trampoline
code to identify signal frames in core dumps.

279211 23-Feb-2015 jhb

MFC 274817,274878,276801,276840,278976:
Improve support for XSAVE with debuggers.
- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed
to match what Linux does in that 1) it dumps the entire XSAVE area
including the fxsave state, and 2) it stashes a copy of the current
xsave mask in the unused padding between the fxsave state and the
xstate header at the same location used by Linux.
- Teach readelf() to recognize NT_X86_XSTATE notes.
- Change PT_GET/SETXSTATE to take the entire XSAVE state instead of
only the extra portion. This avoids having to always make two
ptrace() calls to get or set the full XSAVE state.
- Add a PT_GET_XSTATE_INFO which returns the length of the current
XSTATE save area (so the size of the buffer needed for PT_GETXSTATE)
and the current XSAVE mask (%xcr0).

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


250511 11-May-2013 antoine

Add some missing DPADD.


249704 20-Apr-2013 trociny

Wrong cast.

MFC after: 1 month


249687 20-Apr-2013 trociny

Sync gcore(1) with the recent changes in kernel code aimed at adding
procstat notes to a process core file.

Suggested by: jhb
MFC after: 1 month


223924 11-Jul-2011 delphij

Match size_t and ssize_t by using %zu and %zd instead of %d.

MFC after: 1 month


216769 28-Dec-2010 jhb

Start sentences on a new line to ease life for translators. Tweak the
wording in a few places.

MFC after: 1 week


216370 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


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


210065 14-Jul-2010 attilio

Fix spelling.

Sponsored by: Sandvine Incorporated
Submitted by: b.f. <bf1783 at googlemail dot com>
MFC after: 2 weeks
X-MFC: 210063


210063 14-Jul-2010 attilio

Fix the way the segments are included in the gcore outputs (with the
default invokation):
- Right now if segments are not writable are not included. Remove this.
- Right now if a segment is mapped with NOCORE the check is not honoured.
Change this by checking the newly added flag, from libutil,
KVME_FLAG_NOCOREDUMP.

Besides that, add a new flag (-f) that forces a 'full' dump of all the
segments excluding just the malformed ones. This might be used very
carefully as, among the reported segments, there could be memory
mapped areas that could be vital to program execution.

Sponsored by: Sandvine Incorporated
Discussed with: kib
Reviewed by: emaste
Tested by: Sandvine Incorporated
MFC after: 2 weeks


204329 25-Feb-2010 ru

Fixed dependencies (make checkdpadd).


203532 05-Feb-2010 mjacob

Fix gcore so that it can have the '-s' flag without hanging.


201386 02-Jan-2010 ed

Build usr.bin/ with WARNS=6 by default.

Also add some missing $FreeBSD$ to keep svn happy.


200462 13-Dec-2009 delphij

Revert most part of 200420 as requested, as more review and polish is
needed.


200420 11-Dec-2009 delphij

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


199805 25-Nov-2009 attilio

Change gcore in order to get rid of the procfs accesses and use FreeBSD's
specific sysctls and ptrace interfaces.
This change switches a bit gcore POLA that is summarized here:
- now gcore can recognize threads within the process and handle dumps
on thread-scope
- the process to be analyzed will be stopped during its gcore run
- gcore may not work with processes which are actively being analyzed
by gdb or truss
- the ptrace interface may cause syscalls to return EINTR, thus
interferring with signals handling within the process

Side note: <janitor task> the interface can be further lifted in order to
get rid of the very last procfs interfaces remnants and made more
suitable for copying with sysctl/ptrace interface </janitor task>.

Obtained from: Sandvine Incorporated
Reviewed by: emaste, rwatson
Sponsored by: Sandvine Incorporated
MFC: 1 month


197437 23-Sep-2009 emaste

Use %zu for size_t, not %zd.

Submitted by: ru
MFC after: 1 week


180603 18-Jul-2008 delphij

Use %zd for size_t. With this gcore(1) is WARNS=6 clean.


168595 10-Apr-2007 emaste

Eliminate memory leak from an accidental malloc().


157109 25-Mar-2006 peter

Make gcore(1) 64 bit safe. It was trying to parse the /proc/*/map file
using sscanf and truncating the start/end entries by writing them with a
32 bit int descriptor (%x). The upper bytes of the 64 bit vm_offset_t
variables (for little endian machines) were uninitialized. For big endian
machines, things would have been worse because it was storing the 32 bit
value in the upper half of the 64 bit variable. I've changed it to use
%lx and long types. That should work on all our platforms.


138127 27-Nov-2004 das

Remove a.out support from gcore(1).


137916 20-Nov-2004 das

gcore(1) apparently still cares about a.out core dumps, so it still
needs to know that a 1-page U area is part of the dump format.

Reviewed by: arch@


132047 12-Jul-2004 rwatson

Teach gcore about the pathname field of '/proc/*/map' so that it doesn't
spin when its parser gets confused by a lack of end-of-line.

Submitted by: Dan Nelson <dan@dan.emsphone.com>
PR: 68839


131507 03-Jul-2004 ru

Deal with double whitespace.


131491 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


125859 15-Feb-2004 dwmalone

Fix some WARNS:
1) Remove some unused variables.
2) Mark some things aas static or __unused.
3) Cast to make sure we're comparing the same types.


103302 13-Sep-2002 peter

Add #include <sys/queue.h> for sparc64's benefit. The MD includes there
have less polution.


103299 13-Sep-2002 peter

Use a crowbar to move the a.out code out of gcore.c and into its own
file so that we have a chance of using gcore on non-i386 platforms. Use
linker sets to reduce the registration glue. Remove md-sparc.c, we do not
have an a.out sparc32 port. aoutcore.c was repocopied from gcore.c.


102951 05-Sep-2002 iedowse

Include stdint.h to make this compile.

Submitted by: Garance A Drosihn <drosih@rpi.edu>


102944 04-Sep-2002 dwmalone

ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by: md5


99130 30-Jun-2002 obrien

Consistently wrap CSRG SCM ID.

Requested by: bde


99112 30-Jun-2002 obrien

Consistently use FBSDID


95083 19-Apr-2002 charnier

Use `The .Nm utility'


94560 12-Apr-2002 charnier

Do not print error message twice.


93442 30-Mar-2002 dwmalone

Don't use gcc specific flags.


93215 26-Mar-2002 charnier

Add FBSDID. Do not \n terminate err() strings. Spelling.


92920 22-Mar-2002 imp

remove __P


84871 13-Oct-2001 bde

Removed unused include of kernel-only file <sys/lock.h>.


84768 10-Oct-2001 bde

Compensate for "Compensate for header dethreading" by backing it out.


83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


81735 15-Aug-2001 mikeh

Fix usage message, the executable is optional.

PR: bin/29735
MFC after: 2 weeks


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79535 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


77861 07-Jun-2001 jlemon

Null terminate buffer.

PR: 23150
Submitted by: Dan Nelson <dnelson@emsphone.com>
MFC in: 1 week


76228 03-May-2001 obrien

Fix minor style issue from previous commit.


76224 02-May-2001 obrien

* include/elf.h has been repo copied to include/elf-hints.h, and it no
longer includes machine/elf.h.
* consumers of elf.h now use the minimalist elf header possible.

This change is motivated by Binutils 2.11.0 and too much clashing over
our base elf headers and the Binutils elf headers.


76169 01-May-2001 markm

Compensate for header dethreading.


73261 01-Mar-2001 imp

MAXPATHLEN contains the trailing NUL.


70197 19-Dec-2000 ru

Prepare for mdoc(7)NG.


69896 12-Dec-2000 mckusick

Change the proc information returned from the kernel so that it
no longer contains kernel specific data structures, but rather
only scalar values and structures that are already part of the
kernel/user interface, specifically rusage and rtprio. It no
longer contains proc, session, pcred, ucred, procsig, vmspace,
pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If
any of these changed in size, ps, w, fstat, gcore, systat, and
top would all stop working. The new structure has over 200 bytes
of unassigned space for future values to be added, yet is nearly
100 bytes smaller per entry than the structure that it replaced.


68383 06-Nov-2000 ru

Fixed typo: .EL -> .El


59342 18-Apr-2000 obrien

Change our ELF binary branding to something more acceptable to the Binutils
maintainers.

After we established our branding method of writing upto 8 characters of
the OS name into the ELF header in the padding; the Binutils maintainers
and/or SCO (as USL) decided that instead the ELF header should grow two new
fields -- EI_OSABI and EI_ABIVERSION. Each of these are an 8-bit unsigned
integer. SCO has assigned official values for the EI_OSABI field. In
addition to this, the Binutils maintainers and NetBSD decided that a better
ELF branding method was to include ABI information in a ".note" ELF
section.

With this set of changes, we will now create ELF binaries branded using
both "official" methods. Due to the complexity of adding a section to a
binary, binaries branded with ``brandelf'' will only brand using the
EI_OSABI method. Also due to the complexity of pulling a section out of an
ELF file vs. poking around in the ELF header, our image activator only
looks at the EI_OSABI header field.

Note that a new kernel can still properly load old binaries except for
Linux static binaries branded in our old method.

*
* For a short period of time, ``ld'' will also brand ELF binaries
* using our old method. This is so people can still use kernel.old
* with a new world. This support will be removed before 5.0-RELEASE,
* and may not last anywhere upto the actual release. My expiration
* time for this is about 6mo.
*


57670 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


53152 14-Nov-1999 marcel

${MACHINE} -> ${MACHINE_ARCH}

All Makefiles now use MACHINE_ARCH for the target architecture.
Unification is required for cross-building.

Tags added to:
sys/boot/Makefile
sys/boot/arc/loader/Makefile
sys/kern/Makefile
usr.bin/cpp/Makefile
usr.bin/gcore/Makefile
usr.bin/truss/Makefile

usr.bin/gcore/Makefile:
fixed typo: MACHINDE -> MACHINE_ARCH


52635 29-Oct-1999 phk

useracc() the prequel:

Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.

This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


48861 17-Jul-1999 jdp

Add braces to appease the egcs -Wall mom.


48860 17-Jul-1999 jdp

Make gcore work again. It was broken by a format change in the
procfs map file when object IDs were eliminated in the mega-commit
that included procfs_map.c revision 1.19.

The map file is a terrible hodge-podge. The fields that are used
mainly for kernel debugging should be moved out of it into a
separate file, so that the interface presented by the map file to
applications can remain stable in the face of VM system changes.


48792 12-Jul-1999 nik

Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

.\" $Id$
.\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by: bde


40803 01-Nov-1998 jdp

Fix errors detected by -Wformat.


40562 22-Oct-1998 jdp

When the "-s" option is given, try to ensure that we restart the
target process even if we are killed or die due to an error.


40525 19-Oct-1998 jdp

Make gcore work for ELF.


40350 14-Oct-1998 jdp

Check the executable's header to make sure it is a valid executable.
If it is ELF, print a diagnostic saying that it is not supported yet
by this program. This is a stop-gap anti-bug-report measure because
it looks like there won't be time to implement gcore's ELF support
before 3.0 is released.


39164 14-Sep-1998 des

Don't require an executable file name. If no executable image is
specified, use /proc/<pid>/file. Document it.

PR: bin/7915
Suggested-By: Wolfram Schneider <wosch@panke.de.freebsd.org>


38522 24-Aug-1998 wosch

Check the text segment size of the executable and the process. If
not equal, the command line arguments are wrong. E.g.:

$./gcore /bin/sh 1761

$ ./gcore /usr/tmp/chroot/bin/sh 1761
gcore: The executable /usr/tmp/chroot/bin/sh does not belong to process 1761!
Text segment size (in bytes): executable 303104, process 294912


31218 18-Nov-1997 jdp

Add missing argument detected by "-Wformat". Make messages more
consistent.


27273 08-Jul-1997 charnier

Use err(3) instead of local redefinition.


26826 23-Jun-1997 steve

Show the real revision date and not the date that this
manpage is being viewed.


24360 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


17797 23-Aug-1996 mpp

Use the .Bx macro where appropriate.


17142 12-Jul-1996 jkh

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>


15531 02-May-1996 phk

NBPG -> PAGE_SIZE


8874 30-May-1995 rgrimes

Remove trailing whitespace.


2375 28-Aug-1994 bde

Add dependencies on libraries to DPADD. Someday this should be done
automagically. -lfoo has to be right to work, but ${LIBFO0} is too
easy to forget or misspell; nothing checks it and it should be
different for shared libraries.


1626 29-May-1994 rgrimes

Corrected to work without symbolic links for md-${MACHINE}.c.


1591 27-May-1994 rgrimes

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


1590 27-May-1994 rgrimes

BSD 4.4 Lite Usr.bin Sources