diff --git a/.crash-trace-command.metadata b/.crash-trace-command.metadata new file mode 100644 index 0000000..60d2250 --- /dev/null +++ b/.crash-trace-command.metadata @@ -0,0 +1 @@ +b92c7a1f6b69e5a2e3142b68c76f46e0ebcf204e SOURCES/crash-trace-command-2.0.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/initialize_trace_dat.patch b/SOURCES/initialize_trace_dat.patch new file mode 100644 index 0000000..6b1a25b --- /dev/null +++ b/SOURCES/initialize_trace_dat.patch @@ -0,0 +1,11 @@ +--- crash-trace-command-2.0/trace.c.orig ++++ crash-trace-command-2.0/trace.c +@@ -1373,7 +1373,7 @@ static void ftrace_dump(int argc, char * + if (dump_symbols || dump_meta_data || argc - optind > 1) + cmd_usage(pc->curcmd, SYNOPSIS); + else { +- char *trace_dat; ++ char *trace_dat = "trace.dat"; + int fd; + + if (argc - optind == 0) diff --git a/SOURCES/replace_obsolete_init_and_fini.patch b/SOURCES/replace_obsolete_init_and_fini.patch new file mode 100644 index 0000000..1357429 --- /dev/null +++ b/SOURCES/replace_obsolete_init_and_fini.patch @@ -0,0 +1,31 @@ +--- crash-trace-command-2.0/trace.c.orig ++++ crash-trace-command-2.0/trace.c +@@ -1536,23 +1535,21 @@ static struct command_table_entry comman + + static int ftrace_initialized; + +-int _init(void) ++void __attribute__((constructor)) ++trace_init(void) + { + if (ftrace_init() < 0) +- return 0; ++ return; + + ftrace_initialized = 1; + register_extension(command_table); +- +- return 1; + } + +-int _fini(void) ++void __attribute__((destructor)) ++trace_fini(void) + { + if (ftrace_initialized) + ftrace_destroy(); +- +- return 1; + } + + #define TRACE_CMD_FILE_VERSION_STRING "6" diff --git a/SOURCES/sigsegv_on_calloc_failure.patch b/SOURCES/sigsegv_on_calloc_failure.patch new file mode 100644 index 0000000..580adac --- /dev/null +++ b/SOURCES/sigsegv_on_calloc_failure.patch @@ -0,0 +1,10 @@ +--- crash-trace-command-2.0/trace.c.orig ++++ crash-trace-command-2.0/trace.c +@@ -251,7 +251,6 @@ static int ftrace_init_pages(struct ring + + cpu_buffer->linear_pages = calloc(sizeof(ulong), nr_pages + 1); + if (cpu_buffer->linear_pages == NULL) { +- free(cpu_buffer->pages); + return -1; + } + diff --git a/SOURCES/trace_compiler_warnings.patch b/SOURCES/trace_compiler_warnings.patch new file mode 100644 index 0000000..904f4d0 --- /dev/null +++ b/SOURCES/trace_compiler_warnings.patch @@ -0,0 +1,46 @@ +--- crash-trace-command-2.0/trace.c.orig ++++ crash-trace-command-2.0/trace.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + static int verbose = 0; + +@@ -892,7 +893,7 @@ out_fail: + + static int ftrace_init_event_type(ulong call, struct event_type *aevent_type) + { +- ulong fields_head; ++ ulong fields_head = 0; + + if (ftrace_get_event_type_fields(call, &fields_head) < 0) + return -1; +@@ -1443,6 +1444,8 @@ static void ftrace_show(int argc, char * + int fd; + FILE *file; + size_t ret; ++ size_t nitems __attribute__ ((__unused__)); ++ char *unused __attribute__ ((__unused__)); + + /* check trace-cmd */ + if (env_trace_cmd) +@@ -1465,7 +1468,7 @@ static void ftrace_show(int argc, char * + } + + /* dump trace.dat to the temp file */ +- mktemp(tmp); ++ unused = mktemp(tmp); + fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (trace_cmd_data_output(fd) < 0) + goto out; +@@ -1478,7 +1481,7 @@ static void ftrace_show(int argc, char * + ret = fread(buf, 1, sizeof(buf), file); + if (ret == 0) + break; +- fwrite(buf, 1, ret, fp); ++ nitems = fwrite(buf, 1, ret, fp); + } + pclose(file); + out: diff --git a/SPECS/crash-trace-command.spec b/SPECS/crash-trace-command.spec new file mode 100644 index 0000000..5b2ee5f --- /dev/null +++ b/SPECS/crash-trace-command.spec @@ -0,0 +1,91 @@ +# +# crash core analysis suite +# +Summary: Trace extension module for the crash utility +Name: crash-trace-command +Version: 2.0 +Release: 4%{?dist} +License: GPLv2 +Group: Development/Debuggers +Source: %{name}-%{version}.tar.gz +URL: http://people.redhat.com/anderson/extensions/%{name}-%{version}.tar.gz +# Vendor: Fujitsu Limited +# Packager: Qiao Nuohan +ExclusiveOS: Linux +ExclusiveArch: x86_64 %{ix86} ppc64 ia64 s390 s390x +Buildroot: %{_tmppath}/%{name}-root +BuildRequires: crash-devel zlib-devel lzo-devel snappy-devel +Requires: trace-cmd +Patch0: trace_compiler_warnings.patch +Patch1: replace_obsolete_init_and_fini.patch +Patch2: sigsegv_on_calloc_failure.patch +Patch3: initialize_trace_dat.patch + +%description +Command for reading ftrace data from a dumpfile. + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 -b trace_compiler_warnings.patch +%patch1 -p1 -b replace_obsolete_init_and_fini.patch +%patch2 -p1 -b sigsegv_on_calloc_failure.patch +%patch3 -p1 -b initialize_trace_dat.patch + +%build +make + +%install +mkdir -p %{buildroot}%{_libdir}/crash/extensions/ +cp %{_builddir}/%{name}-%{version}/trace.so %{buildroot}%{_libdir}/crash/extensions/ + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_libdir}/crash/extensions/trace.so +%doc COPYING + +%changelog +* Tue Aug 20 2013 Dave Anderson - 2.0-4 +- crash utility has added LZO and snappy compression in addition to zlib + +* Wed May 29 2013 Dave Anderson - 2.0-3 +- Replace obsolete _init() and _fini() functions. +- Fix possible segmentation violation on calloc() failure. +- Initialize trace_dat to avoid compiler warning. + +* Mon Nov 26 2012 Dave Anderson - 2.0-2 +- trace-cmd package required +- rpmlint cleanups to this file +- fix compiler warnings for trace.c + +* Wed Nov 21 2012 Qiao Nuohan - 2.0-1 +- update code + Resolves: rhbz#863833 + +* Wed Feb 8 2012 Dave Anderson - 1.0-4 +- Build with RPM_OPT_FLAGS. + Resolves: rhbz#729018 + +* Wed Jun 9 2010 Dave Anderson - 1.0-3 +- Remove trace_dump.patch, which requires a kernel later than + the RHEL6 base of 2.6.32. + Resolves: rbhz#601536 + +* Mon May 24 2010 Dave Anderson - 1.0-2 +- Fix for segmentation violation with "trace show -c cpu" command, + and add "trace dump -t" command. + Resolves: rbhz#592887 + +* Wed Dec 09 2009 Dave Anderson - 1.0-1.2 +- fix Makefile to account for s390 build +- change exclusive arch entry from i386 to {ix86} +- Resolves: rbhz#545564 + +* Tue Dec 08 2009 Dennis Gregorovic - 1.0-1.1 +- Rebuilt for RHEL 6 + +* Fri Sep 25 2009 Dave Anderson +- Initial crash-trace-command package +