History log of /freebsd-10.1-release/usr.bin/gcore/gcore.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-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

# 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


# 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


# 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


# 203532 05-Feb-2010 mjacob

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


# 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


# 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.


# 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.


# 102955 05-Sep-2002 dwmalone

The changes mentioned below were accidently committed as part of
my previous commit, so the commit message is incorrect for them.
The actual changes were:

elfcore.c 1.11:
Use a uintmax_t 'cos we con't know if php->p_filesz will be a
Elf32_Size or an Elf64_Size and we don't know how these relate to
size_t. Change some ints to size_t and ssize_ts.

gcore.c 1.28:
Include <arpa/inet.h> for ntohl, which is used in N_BADMAG.
Use a uid_t for a uid.

md-nop.c 1.6:
Mark some parameters as unused.


# 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


# 94560 12-Apr-2002 charnier

Do not print error message twice.


# 92920 21-Mar-2002 imp

remove __P


# 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


# 76228 02-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.


# 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.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48861 17-Jul-1999 jdp

Add braces to appease the egcs -Wall mom.


# 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.


# 24360 29-Mar-1997 imp

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


# 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.


# 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