summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2016-12-14 16:26:54 +0100
committerŁukasz Stelmach <l.stelmach@samsung.com>2016-12-14 17:18:00 +0100
commit34e2c15681edf0ebb9d81dba8a51a2922e21a38e (patch)
treea1b333bc6b0599126ae28901a249885748ec4b0e
parent78b75f2ef9fece4a3cc2bf8251c7a9ed20c61de5 (diff)
downloadcrash-worker-34e2c15681edf0ebb9d81dba8a51a2922e21a38e.tar.gz
crash-worker-34e2c15681edf0ebb9d81dba8a51a2922e21a38e.tar.bz2
crash-worker-34e2c15681edf0ebb9d81dba8a51a2922e21a38e.zip
crash-stack: print executable file path
Change-Id: Ib5946bcfb5bbad8af7b7bbfc7c8568a3cb3ab207
-rw-r--r--src/crash-stack/crash-stack.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/crash-stack/crash-stack.c b/src/crash-stack/crash-stack.c
index a377306..2507055 100644
--- a/src/crash-stack/crash-stack.c
+++ b/src/crash-stack/crash-stack.c
@@ -793,9 +793,24 @@ void callstack_destructor(Callstack *callstack)
}
/**
+ * @brief Print full path of executable file
+ */
+static void __crash_stack_print_exe(FILE* outputfile, pid_t pid)
+{
+ char file_path[PATH_MAX];
+ char link_path[PATH_MAX];
+
+ snprintf(link_path, PATH_MAX, "/proc/%d/exe", pid);
+ if (readlink(link_path, file_path, PATH_MAX) == -1) {
+ return;
+ }
+ fprintf(outputfile, "Executable File Path: %s\n", file_path);
+}
+
+/**
* @brief Print thread information
*
- * @param outputfile File handle for printing report.
+ * @param outputfile File handle for printing report
* @param pid PID of the inspected process
* @param tid TID of the inspected thread
*/
@@ -927,6 +942,9 @@ int main(int argc, char **argv)
dwfl_getmodules(dwfl, __module_callback, &mappings, 0);
Elf_Data *notes = 0;
+ /* Executable File Path */
+ __crash_stack_print_exe(outputfile, pid);
+
/* Now, get registers */
if (pid > 1) {
if (-1 == __get_signal_ptrace(pid))