Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /daemon/opd_trans.c [9871f0] .. [0d0e60] Maximize Restore

  Switch to side-by-side view

--- a/daemon/opd_trans.c
+++ b/daemon/opd_trans.c
@@ -75,6 +75,9 @@
 
 	event = pop_buffer_value(trans);
 
+	if (trans->tracing != TRACING_ON)
+		trans->event = event;
+
 	trans->pc = pc;
 
 	/* sfile can change at each sample for kernel */
@@ -87,12 +90,22 @@
 
 	/* can happen if kernel sample falls through the cracks */
 	if (!trans->current)
-		return;
+		goto out;
 
 	if (trans->current->ignored)
-		return;
-
-	sfile_log_sample(trans->current, trans->pc, event);
+		goto out;
+
+	/* log the sample or arc */
+	sfile_log_sample(trans);
+
+out:
+	/* switch to trace mode */
+	if (trans->tracing == TRACING_START)
+		trans->tracing = TRACING_ON;
+
+	/* used for callgraph only */
+	trans->last = trans->current;
+	trans->last_pc = trans->pc;
 }
 
 
@@ -192,6 +205,20 @@
 }
 
 
+static void code_trace_begin(struct transient * trans)
+{
+	verbprintf("TRACE_BEGIN\n");
+	trans->tracing = TRACING_START;
+}
+
+
+static void code_trace_end(struct transient * trans)
+{
+	verbprintf("TRACE_END\n");
+	trans->tracing = TRACING_OFF;
+}
+
+
 typedef void (*handler_t)(struct transient *);
 
 static handler_t handlers[LAST_CODE + 1] = {
@@ -202,7 +229,9 @@
 	&code_kernel_enter,
 	&code_kernel_exit,
 	&code_module_loaded,
-	&code_unknown /* tgid handled differently */
+	&code_unknown, /* tgid handled differently */
+	&code_trace_begin,
+	&code_trace_end,
 };
 
 
@@ -211,10 +240,14 @@
 	struct transient trans = {
 		.buffer = buffer,
 		.remaining = count,
+		.tracing = TRACING_OFF,
 		.current = NULL,
+		.last = NULL,
 		.cookie = 0,
 		.app_cookie = 0,
 		.pc = 0,
+		.last_pc = 0,
+		.event = 0,
 		.in_kernel = -1,
 		.cpu = -1,
 		.tid = -1,