-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1295 from criblio/feat-1279-add-coredump
[#1279 2/4] Extend contrib code with coredumper
- Loading branch information
Showing
48 changed files
with
12,384 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
INSTALL | ||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache/ | ||
autom4te/ | ||
compile | ||
config.guess | ||
config.h.in | ||
config.h.in~ | ||
config.sub | ||
configure | ||
depcomp | ||
install-sh | ||
libtool.m4 | ||
ltmain.sh | ||
m4/ | ||
missing | ||
test-driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
opensource@google.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2005-2007, Google Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* 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. | ||
* Neither the name of Google Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"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 COPYRIGHT | ||
OWNER OR CONTRIBUTORS 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Fri Feb 11 12:51:37 2005 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: initial release: | ||
The coredumper utility allows a running program to generate a | ||
core file without actually crashing. This serves to allow the | ||
programmer to generate a snapshot of a running program's state | ||
at any time. | ||
|
||
Mon May 2 07:04:46 2005 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: version 0.2 release | ||
* fixed compilation on icc (simonb) | ||
* added a new WriteCoreDumpLimited() function that allows the | ||
caller to specify the maximum core file size. This is needed to | ||
emulate "ulimit -c". (markus) | ||
|
||
Thu Aug 10 12:44:40 2006 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: version 0.3 release | ||
* reorganized the source to make porting and reuse easier. | ||
* ported to ARM. | ||
* core files can now be compressed on-the-fly. | ||
* added support for recent 2.6.x kernels, which subtly changed the | ||
ptrace() API. It used to be possible to PTRACE_ATTACH to threads | ||
in the same process, but newer kernels require making this call | ||
from a separate process. This change is backwards compatible. | ||
* improved compatibility with more (historic) versions of both | ||
libc and of the Linux kernel. | ||
* the convenience methods now enforce more restrictive file | ||
permissions when writing to disk. The caller no longer needs to | ||
adjust the umask() to make file writing secure. | ||
* the coredumper fails gracefully if called when the stack is almost | ||
about to overflow. | ||
* fixed bugs that prevented thread listing on 64bit machines. | ||
* switched to different syscall() functions in order to better | ||
preserve the call stack. Added work-around for broken libc | ||
system headers. | ||
* all assembly code is position-independent. | ||
* the unittest can now be run even if the systems locale is not | ||
English. | ||
|
||
Wed Feb 14 14:44:40 2007 Google Inc. <opensource@google.com> | ||
|
||
* fixed some packaging problems with newer versions of RPM | ||
* added assembly version of sys_clone() in order to work around | ||
buggy implementations in glibc. | ||
|
||
Thu Feb 15 16:24:32 2007 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: version 1.0 release | ||
* made devel RPMs depend on the runtime-only package. | ||
* fixed signal related system calls on x86_64. | ||
* wrote manual pages. | ||
|
||
Tue Feb 20 15:07:03 2007 Google Inc. <opensource@google.com> | ||
|
||
* changed from NT_PRFPXREG to NT_PRXFPREG, as this appears to be | ||
what the kernel and the binary tool chain finally agrees on. | ||
|
||
* dump anonymous executable mappins such as the [vdso] segment. | ||
This helps "gdb" in following call chains past the invocation of | ||
signal handlers. | ||
|
||
Fri Jan 25 18:36:01 2008 Google Inc. <opensource@google.com> | ||
|
||
* Added kernel data structures to linux_syscall_support.h | ||
* Added some more system calls | ||
* General clean ups and minor bug fixes to linux_syscall_support.h | ||
* Updated MIPS support | ||
* Added PPC support to linux_syscall_support.h (based on the patch at | ||
http://google-perftools.googlegroups.com/web/google-perftools-0.94.1.ppc.patch?gda=k9bft1IAAACubrlYz6X6f2r_QSIc5WKIP3FyvVAXIQ9N70rJj7w7MWG1qiJ7UbTIup-M2XPURDR0OdCHCKqS2f7o1Lzcc8Kg4jvJEVA5r4WYNVZfjSxuln7gCK2zepjMSjyreBgvHJk) | ||
This does not mean that the coredumper works on PPC, yet. That still | ||
requires additional work | ||
* Added linux_syscall_support_unittest.cc | ||
* Updated other files as needed so that they would work with the | ||
changes made to linux_syscall_support.h | ||
|
||
Thu Apr 3 14:16:01 2008 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: version 1.2 release | ||
* Added the option to prioritize smaller memory segments when limiting | ||
core dumps. | ||
* Added the option to add user defined notes into the core dump. | ||
* Added a generalized system to be able to combine parameters easily. | ||
* Increased the library version number to 1.0.0 since the interface has | ||
been extended. | ||
* Added vdso segments to the core dump. | ||
* Made the failing thread's registers the first in the core file as | ||
expected by gdb. | ||
|
||
Fri Apr 4 09:38:05 2008 Google Inc. <opensource@google.com> | ||
|
||
* coredumper: version 1.2.1 release | ||
* Fixed a problem which occurs if auxv vectors aren't supported. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
## Process this file with automake to produce Makefile.in | ||
|
||
# This is so we can #include <google/foo> | ||
AM_CPPFLAGS = -I$(top_srcdir)/src | ||
|
||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
googleincludedir = $(includedir)/google | ||
## The .h files you want to install (that is, .h files that people | ||
## who install this package can include in their own applications.) | ||
googleinclude_HEADERS = | ||
|
||
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) | ||
## This is for HTML and other documentation you want to install. | ||
## Add your documentation files (in doc/) in addition to these | ||
## top-level boilerplate files. Also add a TODO file if you have one. | ||
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README TODO | ||
|
||
## The libraries (.so's) you want to install | ||
lib_LTLIBRARIES = | ||
|
||
## unittests you want to run when people type 'make check'. | ||
## TESTS is for binary unittests, check_SCRIPTS for script-based unittests. | ||
## TESTS_ENVIRONMENT sets environment variables for when you run unittest, | ||
## but it only seems to take effect for *binary* unittests (argh!) | ||
TESTS = | ||
check_SCRIPTS = | ||
TESTS_ENVIRONMENT = | ||
# Every time you add a unittest to check_SCRIPTS, add it here too | ||
noinst_SCRIPTS = | ||
|
||
# The manual pages that should be installed | ||
man3_MANS = man/GetCoreDump.man man/WriteCoreDump.man \ | ||
man/CoreDumpParameters.man | ||
|
||
install-data-hook: | ||
ln -sf GetCoreDump.3 $(DESTDIR)$(man3dir)/GetCompressedCoreDump.3 | ||
ln -sf GetCoreDump.3 $(DESTDIR)$(man3dir)/GetCoreDumpWith.3 | ||
ln -sf WriteCoreDump.3 $(DESTDIR)$(man3dir)/WriteCompressedCoreDump.3 | ||
ln -sf WriteCoreDump.3 $(DESTDIR)$(man3dir)/WriteCoreDumpWith.3 | ||
ln -sf WriteCoreDump.3 $(DESTDIR)$(man3dir)/WriteCoreDumpLimited.3 | ||
ln -sf WriteCoreDump.3 $(DESTDIR)$(man3dir)/WriteCoreDumpLimitedByPriority.3 | ||
ln -sf CoreDumpParameters.3 $(DESTDIR)$(man3dir)/ClearCoreDumpParameters.3 | ||
ln -sf CoreDumpParameters.3 $(DESTDIR)$(man3dir)/SetCoreDumpLimited.3 | ||
ln -sf CoreDumpParameters.3 $(DESTDIR)$(man3dir)/SetCoreDumpCompressed.3 | ||
ln -sf CoreDumpParameters.3 $(DESTDIR)$(man3dir)/SetCoreDumpLimitedByPriority.3 | ||
ln -sf CoreDumpParameters.3 $(DESTDIR)$(man3dir)/SetCoreDumpNotes.3 | ||
|
||
|
||
uninstall-hook: | ||
rm -f $(DESTDIR)$(man3dir)/GetCompressedCoreDump.3 | ||
rm -f $(DESTDIR)$(man3dir)/GetCoreDumpWith.3 | ||
rm -f $(DESTDIR)$(man3dir)/WriteCoreDumpWith.3 | ||
rm -f $(DESTDIR)$(man3dir)/WriteCompressedCoreDump.3 | ||
rm -f $(DESTDIR)$(man3dir)/WriteCoreDumpLimited.3 | ||
rm -f $(DESTDIR)$(man3dir)/WriteCoreDumpLimitedByPriority.3 | ||
rm -f $(DESTDIR)$(man3dir)/ClearCoreDumpParameters.3 | ||
rm -f $(DESTDIR)$(man3dir)/SetCoreDumpLimited.3 | ||
rm -f $(DESTDIR)$(man3dir)/SetCoreDumpCompressed.3 | ||
rm -f $(DESTDIR)$(man3dir)/SetCoreDumpLimitedByPriority.3 | ||
rm -f $(DESTDIR)$(man3dir)/SetCoreDumpNotes.3 | ||
|
||
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS | ||
|
||
lib_LTLIBRARIES += libcoredumper.la | ||
LIBCOREDUMPER_INCLUDES = src/google/coredumper.h src/elfcore.h \ | ||
src/linux_syscall_support.h src/linuxthreads.h \ | ||
src/thread_lister.h | ||
googleinclude_HEADERS += src/google/coredumper.h | ||
libcoredumper_la_SOURCES = src/coredumper.c \ | ||
src/thread_lister.c \ | ||
src/elfcore.c \ | ||
src/linuxthreads.c \ | ||
$(LIBCOREDUMPER_INCLUDES) | ||
libcoredumper_la_LDFLAGS = -export-symbols $(top_srcdir)/src/libcoredumper.sym \ | ||
-version-info 1:0:0 | ||
|
||
TESTS += coredumper_unittest linux_syscall_support_unittest | ||
COREDUMP_UNITTEST_INCLUDES = src/google/coredumper.h | ||
coredumper_unittest_SOURCES = src/coredumper_unittest.c | ||
coredumper_unittest_LDADD = libcoredumper.la -lpthread | ||
LINUX_SYSCALL_SUPPORT_INCLUDES = src/linux_syscall_support.h | ||
linux_syscall_support_unittest_SOURCES = src/linux_syscall_support_unittest.cc | ||
|
||
## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS | ||
|
||
|
||
## This should always include $(TESTS), but may also include other | ||
## binaries that you compile but don't want automatically installed. | ||
noinst_PROGRAMS = $(TESTS) | ||
|
||
rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec | ||
@cd packages && ./rpm.sh ${PACKAGE} ${VERSION} | ||
|
||
deb: dist-gzip packages/deb.sh packages/deb/* | ||
@cd packages && ./deb.sh ${PACKAGE} ${VERSION} | ||
|
||
libtool: $(LIBTOOL_DEPS) | ||
$(SHELL) ./config.status --recheck | ||
|
||
EXTRA_DIST = ${man3_MANS} man/GetCoreDump.man man/WriteCoreDump.man \ | ||
packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh \ | ||
packages/deb libtool src/libcoredumper.sym examples/Makefile \ | ||
examples/tftpd.c | ||
|
||
DISTCLEANFILES = core-test |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
The coredumper library can be compiled into applications to create | ||
core dumps of the running program, without having to terminate | ||
them. It supports both single- and multi-threaded core dumps, even if | ||
the kernel does not have native support for multi-threaded core files. | ||
|
||
This library is primarily intended to simplify debugging of | ||
long-running services. It is often inacceptable to suspend production | ||
services by attaching a debugger, nor is it possible to crash the | ||
service in order to generate a core file. | ||
|
||
By modifying an existing service to take advantage of the coredumper | ||
library, it is possible to expose an interface for obtaining snapshots | ||
of the running application. The library supports writing of core files | ||
to disk (e.g. triggered upon reception of a signal) but it can also | ||
generate in-memory core files. This makes it possible for web | ||
services to expose remote access to core files. | ||
|
||
The "examples" directory shows how to add a core file feature to an | ||
existing TFTP server. For an example of how to use on-disk core files, | ||
take a look at "src/coredump_unittest.c". | ||
|
||
The code has been tested on Linux x86/32, x86/64, and ARM. It is | ||
distributed from http://code.google.com/p/google-coredumper. It is | ||
available as a tar source archive, and in prebuilt form as Debian and | ||
RedHat packages. | ||
|
||
For detailed information on how to build and install this library, | ||
read the "INSTALL" file. | ||
|
||
If you don't have autotools installed, run preconfig to ensure | ||
timestamps are set properly in your Git repository, to avoid attempts | ||
to recreate autotools output: | ||
|
||
./preconfig | ||
|
||
Next you will need to configure and build by running: | ||
|
||
./configure && make | ||
|
||
You can then test whether the code works correctly on your system, by | ||
running: | ||
|
||
make check | ||
|
||
The check requires that you have access to development tools such as | ||
"readelf", and "gdb". | ||
|
||
If you decide to install from the tar file, you now need to run the | ||
following command as "root": | ||
|
||
make install | ||
|
||
Alternatively, you can build packages for your targeted distribution | ||
by running either: | ||
|
||
make deb | ||
or | ||
make rpm | ||
|
||
These commands generate installable package files. The packages will | ||
be located in the "packages/<DISTRIBUTION>" directory (e. g. packages/rh9 | ||
or packages/woody). The exact path name is printed at the end of the | ||
compilation. | ||
|
||
Follow your distribution's instructions on how to install new | ||
packages. | ||
|
||
For more information on how to use the library, read the manual pages | ||
for "GetCoreDump" and "WriteCoreDump". | ||
|
||
15 February 2007 |
Empty file.
Oops, something went wrong.