libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH 2/4] Add _UCD_get_pid and _UCD_get_cursig


From: Alexander Larsson
Subject: [Libunwind-devel] [PATCH 2/4] Add _UCD_get_pid and _UCD_get_cursig
Date: Fri, 23 Mar 2012 21:00:28 +0100

These let you get the pid and the current signal from the coredump.

This isn't strictly unwind related, but these are trivial to implement
as we have the info, and you almost always want these when you're
printing a backtrace from a core file.
---
 include/libunwind-coredump.h |    2 ++
 src/coredump/_UCD_create.c   |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/libunwind-coredump.h b/include/libunwind-coredump.h
index 3838549..a44536f 100644
--- a/include/libunwind-coredump.h
+++ b/include/libunwind-coredump.h
@@ -40,6 +40,8 @@ struct UCD_info;
 extern struct UCD_info *_UCD_create(const char *filename);
 extern void _UCD_destroy(struct UCD_info *);
 
+extern pid_t _UCD_get_pid(struct UCD_info *);
+extern int _UCD_get_cursig(struct UCD_info *);
 extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, 
const char *filename);
 extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *,
                                          unsigned long vaddr,
diff --git a/src/coredump/_UCD_create.c b/src/coredump/_UCD_create.c
index 00117f3..ec0dfb5 100644
--- a/src/coredump/_UCD_create.c
+++ b/src/coredump/_UCD_create.c
@@ -276,6 +276,16 @@ _UCD_create(const char *filename)
   return NULL;
 }
 
+pid_t _UCD_get_pid(struct UCD_info *ui)
+{
+  return ui->prstatus->pr_pid;
+}
+
+int _UCD_get_cursig(struct UCD_info *ui)
+{
+  return ui->prstatus->pr_cursig;
+}
+
 int _UCD_add_backing_file_at_segment(struct UCD_info *ui, int phdr_no, const 
char *filename)
 {
   if ((unsigned)phdr_no >= ui->phdrs_count)
-- 
1.7.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]