forked from ptesarik/libkdumpfile
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the sources of kdumpid v1.6 (commit cb3d9452e2f6) and adapt them so they can be built from libkdumpfile using GNU autotools. The sources are identical, except these changes: - include "config.h" from kdumpid.h - remove some superfluous whitespace The versioning scheme of kdumpid is retained for now to ensure that the versions form a monotonically increasing sequence. The original kdumpid repository will be set to read-only to avoid potential divergence. Signed-off-by: Petr Tesarik <[email protected]>
- Loading branch information
Showing
18 changed files
with
2,159 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -24,6 +24,10 @@ m4_define([pkg_micro_version], [4]) | |
m4_define([pkg_version], | ||
[pkg_major_version.pkg_minor_version.pkg_micro_version]) | ||
|
||
dnl FIXME: kdumpid has a different versioning scheme | ||
m4_define([kdumpid_major_version], [1]) | ||
m4_define([kdumpid_minor_version], [7]) | ||
|
||
AC_INIT([libkdumpfile],[pkg_version],[[email protected]]) | ||
|
||
AC_CONFIG_SRCDIR([src/kdumpfile/diskdump.c]) | ||
|
@@ -104,6 +108,11 @@ AS_IF([test "x$enable_debug" = xyes], | |
dnl check for Python | ||
kdump_PYTHON([2.7.0]) | ||
|
||
dnl check whether to build optional tools | ||
AC_SUBST(KDUMPID_VER_MAJOR, kdumpid_major_version) | ||
AC_SUBST(KDUMPID_VER_MINOR, kdumpid_minor_version) | ||
KDUMP_TOOL_KDUMPID | ||
|
||
AC_CONFIG_FILES([ | ||
Makefile | ||
examples/Makefile | ||
|
@@ -114,6 +123,8 @@ AC_CONFIG_FILES([ | |
src/kdumpfile/Makefile | ||
python/Makefile | ||
tests/Makefile | ||
tools/Makefile | ||
tools/kdumpid/Makefile | ||
libaddrxlat.pc | ||
libkdumpfile.pc | ||
include/libkdumpfile/kdumpfile.h | ||
|
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,99 @@ | ||
# KDUMP_TRY_LINK(LIBRARIES) | ||
# --------------------------------------------------------- | ||
# Try to link the existing test source file with additional | ||
# libraries. | ||
# Set kdump_res to "yes" on success, else set it to "no". | ||
# Standard error output is saved to conftest.linkerr. | ||
AC_DEFUN([KDUMP_TRY_LINK],[dnl | ||
kdump_save_LIBS="$LIBS" | ||
kdump_save_ac_link="$ac_link" | ||
LIBS="$1 $LIBS" | ||
ac_link="$ac_link 2>conftest.linkerr" | ||
AC_LINK_IFELSE([], kdump_res=yes, [kdump_res=no | ||
$2]) | ||
LIBS="$kdump_save_LIBS" | ||
ac_link="$kdump_save_ac_link" | ||
])# KDUMP_TRY_LINK | ||
|
||
AC_DEFUN([KDUMP_REPORT_LINKERR],[dnl | ||
AS_ECHO("$as_me:$LINENO: all linker errors") >&AS_MESSAGE_LOG_FD | ||
cat conftest.linkerr >&AS_MESSAGE_LOG_FD | ||
])# KDUMP_REPORT_LINKERR | ||
|
||
AC_DEFUN([KDUMP_TRY_LINK_UNDEF],[dnl | ||
kdump_save_LDFLAGS="$LDFLAGS" | ||
LDFLAGS="-z undefs $2 $LDFLAGS" | ||
KDUMP_TRY_LINK($1, KDUMP_REPORT_LINKERR) | ||
LDFLAGS="$kdump_save_LDFLAGS" | ||
])# KDUMP_TRY_LINK_UNDEF | ||
|
||
AC_DEFUN([KDUMP_DIS_ASM_CHECK_UNDEF],[dnl | ||
AC_REQUIRE([AC_PROG_EGREP])dnl | ||
AC_MSG_CHECKING([whether disassembler requires $1]) | ||
KDUMP_TRY_LINK($DIS_ASM_LIBS) | ||
AS_ECHO("$as_me:$LINENO: matching linker errors") >&AS_MESSAGE_LOG_FD | ||
AS_IF([$EGREP "@<:@^A-Za-z0-9_@:>@($2)" conftest.linkerr >&AS_MESSAGE_LOG_FD], | ||
[AC_MSG_RESULT(yes) | ||
DIS_ASM_LIBS="$DIS_ASM_LIBS $1" | ||
KDUMP_TRY_LINK_UNDEF($DIS_ASM_LIBS) | ||
AS_IF([test yes != "$kdump_res"], | ||
[AC_MSG_FAILURE([Link fails with $1])])], | ||
[AC_MSG_RESULT(no)])dnl | ||
])# KDUMP_DIS_ASM_CHECK_UNDEF | ||
|
||
AC_DEFUN([KDUMP_DIS_ASM_LIBS],[[dnl determine disassembler libraries | ||
DIS_ASM_LIBS=-lopcodes | ||
AC_LANG_CONFTEST([AC_LANG_PROGRAM( | ||
[#include <dis-asm.h>], | ||
[disassembler(bfd_arch_i386, FALSE, bfd_mach_x86_64, NULL);])]) | ||
dnl ignore undefined symbols from missing linker dependencies | ||
AC_MSG_CHECKING([for disassembler in $DIS_ASM_LIBS]) | ||
KDUMP_TRY_LINK_UNDEF($DIS_ASM_LIBS, [[-Wl,--require-defined=disassembler]]) | ||
AC_MSG_RESULT($kdump_res) | ||
AS_IF([test yes = "$kdump_res"], [dnl | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-lbfd, bfd_) | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-lsframe, sframe_) | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-liberty, htab_create|splay_tree_new) | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-lz, inflate) | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-lzstd, ZSTD_) | ||
KDUMP_DIS_ASM_CHECK_UNDEF(-ldl, dlopen) | ||
AS_IF([test yes != "$kdump_res"], | ||
[KDUMP_REPORT_LINKERR] | ||
[AC_MSG_FAILURE([Tried everything, still cannot link disassembler.])]) | ||
AC_SUBST(DIS_ASM_LIBS) | ||
], false)dnl | ||
]])# KDUMP_DIS_ASM_LIBS | ||
|
||
AC_DEFUN([KDUMP_DIS_ASM],[dnl determine disassembler options | ||
AC_CHECK_HEADERS(dis-asm.h, [], | ||
[AC_MSG_ERROR([Disassembler headers not found])]) | ||
AC_MSG_CHECKING([whether disassembler supports syntax highlighting]) | ||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | ||
#include <dis-asm.h> | ||
void fn(struct disassemble_info *info, void *stream, | ||
fprintf_ftype fprintf_func, fprintf_styled_ftype fprintf_styled_func) | ||
{ | ||
init_disassemble_info(info, stream, fprintf_func, fprintf_styled_func); | ||
} | ||
])], | ||
[dnl | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(DIS_ASM_STYLED_PRINTF, [1], | ||
[Define if init_disassemble_info() has a printf_styled_func parameter])], | ||
[AC_MSG_RESULT(no)]) | ||
KDUMP_DIS_ASM_LIBS | ||
])# KDUMP_DIS_ASM | ||
|
||
AC_DEFUN([KDUMP_TOOL_KDUMPID],[dnl enable/disable kdumpid build | ||
AC_ARG_ENABLE(kdumpid, | ||
[AS_HELP_STRING(--disable-kdumpid, | ||
[do not build kdumpid])], | ||
[], | ||
[enable_kdumpid=yes]) | ||
AS_IF([test no != "$enable_kdumpid"], | ||
[AS_IF(KDUMP_DIS_ASM, [], | ||
[AC_MSG_FAILURE( | ||
[disassembler test failed (--disable-kdumpid to disable)])] | ||
)]) | ||
AM_CONDITIONAL(BUILD_KDUMPID, [test yes = "$enable_kdumpid"]) | ||
])# KDUMP_TOOL_KDUMPID |
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,26 @@ | ||
## Process this file with automake to create Makefile.in | ||
## Configure input file for libkdumpfile. | ||
## | ||
## Copyright (C) 2024 Petr Tesarik <[email protected]> | ||
## | ||
## This file is part of libkdumpfile. | ||
## | ||
## This file is free software; you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation; either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## libkdumpfile is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
SUBDIRS = | ||
|
||
if BUILD_KDUMPID | ||
SUBDIRS += kdumpid | ||
endif |
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 @@ | ||
# Resulting binaries | ||
kdumpid |
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,45 @@ | ||
## Process this file with automake to create Makefile.in | ||
## Configure input file for libkdumpfile. | ||
## | ||
## Copyright (C) 2024 Petr Tesarik <[email protected]> | ||
## | ||
## This file is part of libkdumpfile. | ||
## | ||
## This file is free software; you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation; either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## libkdumpfile is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
AM_CPPFLAGS = -I$(top_builddir)/include \ | ||
-DVER_MAJOR=$(KDUMPID_VER_MAJOR) \ | ||
-DVER_MINOR=$(KDUMPID_VER_MINOR) | ||
|
||
LIBS = \ | ||
$(top_builddir)/src/kdumpfile/libkdumpfile.la \ | ||
$(DIS_ASM_LIBS) | ||
|
||
kdumpid_SOURCES = \ | ||
main.c \ | ||
util.c \ | ||
search.c \ | ||
ppc.c \ | ||
ppc64.c \ | ||
s390.c \ | ||
x86.c | ||
|
||
noinst_HEADERS = \ | ||
kdumpid.h \ | ||
endian.h | ||
|
||
bin_PROGRAMS = kdumpid | ||
|
||
dist_man_MANS = kdumpid.1 |
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,44 @@ | ||
#ifndef __KDUMP_ENDIAN_H | ||
#define __KDUMP_ENDIAN_H | ||
|
||
#include <endian.h> | ||
|
||
/* Older glibc didn't have the byteorder macros */ | ||
#ifndef be16toh | ||
|
||
#include <byteswap.h> | ||
|
||
# if __BYTE_ORDER == __LITTLE_ENDIAN | ||
# define htobe16(x) bswap_16(x) | ||
# define htole16(x) (x) | ||
# define be16toh(x) bswap_16(x) | ||
# define le16toh(x) (x) | ||
|
||
# define htobe32(x) bswap_32(x) | ||
# define htole32(x) (x) | ||
# define be32toh(x) bswap_32(x) | ||
# define le32toh(x) (x) | ||
|
||
# define htobe64(x) bswap_64(x) | ||
# define htole64(x) (x) | ||
# define be64toh(x) bswap_64(x) | ||
# define le64toh(x) (x) | ||
# else | ||
# define htobe16(x) (x) | ||
# define htole16(x) bswap_16(x) | ||
# define be16toh(x) (x) | ||
# define le16toh(x) bswap_16(x) | ||
|
||
# define htobe32(x) (x) | ||
# define htole32(x) bswap_32(x) | ||
# define be32toh(x) (x) | ||
# define le32toh(x) bswap_32(x) | ||
|
||
# define htobe64(x) (x) | ||
# define htole64(x) bswap_64(x) | ||
# define be64toh(x) (x) | ||
# define le64toh(x) bswap_64(x) | ||
# endif | ||
#endif | ||
|
||
#endif /* __KDUMP_ENDIAN_H */ |
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,55 @@ | ||
.TH KDUMPID 1 "4 Nov 2011" | ||
.SH NAME | ||
KdumpID \- A tool to identify kernel memory dumps | ||
.SH SYNOPSIS | ||
.B kdumpid | ||
.I [-v] <dumpfile> | ||
.SH "DESCRIPTION" | ||
.B kdumpid | ||
provides a fast and reliable method to find out the most | ||
important information about an unknown kernel crash dump, | ||
such as the architecture and kernel release. Think of it | ||
as a kind of "file" utility for kernel dumps. | ||
.LP | ||
At present, | ||
.B kdumpid | ||
can read: | ||
.LP | ||
\- LKCD files | ||
.br | ||
\- DISKDUMP/KDUMP files | ||
.br | ||
\- ELF dumps (including support for both Xen Dom0 and DomU). | ||
.LP | ||
The following architectures are fully supported: | ||
.LP | ||
\- x86 | ||
.br | ||
\- x86-64 | ||
.br | ||
\- ppc | ||
.br | ||
\- ppc64 | ||
.br | ||
\- s390 | ||
.br | ||
\- s390x. | ||
.LP | ||
Other architectures may produce some output if the information | ||
can be found in the file header. | ||
.SH "OPERATION" | ||
By default, | ||
.B kdumpid | ||
will print the kernel dump's format, architecture and version. | ||
.SH "OPTIONS" | ||
.TP | ||
\fB\-v\fR | ||
Try to extract and print additional information from | ||
the memory dump, such as: the machine type, the full | ||
kernel banner string and the kernel configuration flavor. | ||
.SH "SEE ALSO" | ||
.BR crash (8), | ||
.BR makedumpfile (8), | ||
.BR kdump (7). | ||
.SH AUTHOR | ||
KdumpID was written by Petr Tesarik. |
Oops, something went wrong.