[PATCH 1/4] capture: Fix capture engine to handle new extensions.
Jennifer Averett
jennifer.averett at oarcorp.com
Fri Apr 18 15:02:38 UTC 2014
The terminate method was added to rtems_extensions_table. This
resulted in NULL or random addresses being called at task termination.
---
cpukit/libmisc/capture/capture.c | 37 ++++++++++++++++++++++++++++---------
cpukit/libmisc/capture/capture.h | 3 ++-
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/cpukit/libmisc/capture/capture.c b/cpukit/libmisc/capture/capture.c
index da9d785..cc47a51 100644
--- a/cpukit/libmisc/capture/capture.c
+++ b/cpukit/libmisc/capture/capture.c
@@ -883,6 +883,21 @@ rtems_capture_exitted_task (rtems_tcb* exitted_task)
rtems_capture_task_stack_usage (et);
}
+static void
+rtems_capture_terminated_task (rtems_tcb* terminated_task)
+{
+ rtems_capture_delete_task (terminated_task, terminated_task );
+}
+
+static void
+rtems_capture_fatal(
+ Internal_errors_Source source,
+ bool is_internal,
+ Internal_errors_t code
+)
+{
+}
+
/*
* rtems_capture_switch_task
*
@@ -1006,16 +1021,20 @@ rtems_capture_open (uint32_t size, rtems_capture_timestamp timestamp __attribu
/*
* Create the extension table. This is copied so we
- * can create it as a local.
+ * can create it as a local.
+ * Zero the area out first so that any new methods will be NULL.
*/
- capture_extensions.thread_create = rtems_capture_create_task;
- capture_extensions.thread_start = rtems_capture_start_task;
- capture_extensions.thread_restart = rtems_capture_restart_task;
- capture_extensions.thread_delete = rtems_capture_delete_task;
- capture_extensions.thread_switch = rtems_capture_switch_task;
- capture_extensions.thread_begin = rtems_capture_begin_task;
- capture_extensions.thread_exitted = rtems_capture_exitted_task;
- capture_extensions.fatal = NULL;
+
+ memset( &capture_extensions, 0, sizeof(rtems_extensions_table) );
+ capture_extensions.thread_create = rtems_capture_create_task;
+ capture_extensions.thread_start = rtems_capture_start_task;
+ capture_extensions.thread_restart = rtems_capture_restart_task;
+ capture_extensions.thread_delete = rtems_capture_delete_task;
+ capture_extensions.thread_switch = rtems_capture_switch_task;
+ capture_extensions.thread_begin = rtems_capture_begin_task;
+ capture_extensions.thread_exitted = rtems_capture_exitted_task;
+ capture_extensions.fatal = rtems_capture_fatal;
+ capture_extensions.thread_terminate = rtems_capture_terminated_task;
/*
* Register the user extension handlers for the CAPture Engine.
diff --git a/cpukit/libmisc/capture/capture.h b/cpukit/libmisc/capture/capture.h
index c9cebc9..7663d8b 100644
--- a/cpukit/libmisc/capture/capture.h
+++ b/cpukit/libmisc/capture/capture.h
@@ -246,7 +246,8 @@ typedef enum rtems_capture_trigger_e
rtems_capture_restart,
rtems_capture_delete,
rtems_capture_begin,
- rtems_capture_exitted
+ rtems_capture_exitted,
+ rtems_capture_terminated
} rtems_capture_trigger_t;
/**
--
1.8.1.4
More information about the devel
mailing list