aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2015-05-20 22:59:40 +0200
committerMarc Schink <swo-dev@marcschink.de>2015-09-22 18:59:05 +0200
commita2e6ebcaabbca1b519f21c65e31e535fbaeb4106 (patch)
tree14dc329a105f9653accd34788f98e86581888cca
parent25d364520627b4217008ad75cbb1a1def3704233 (diff)
Always decode DWT packets.
This patch removes the command-line option --dwt because hardware source packets are now always decoded as DWT packets.
-rw-r--r--man/swodec.113
-rw-r--r--src/dwt.c35
-rw-r--r--src/main.c10
3 files changed, 15 insertions, 43 deletions
diff --git a/man/swodec.1 b/man/swodec.1
index 572d36f..11252c6 100644
--- a/man/swodec.1
+++ b/man/swodec.1
@@ -1,4 +1,4 @@
-.TH swodec 1 "May 05, 2015"
+.TH swodec 1 "May 20, 2015"
.SH NAME
swodec \- decode SWO trace data
@@ -77,10 +77,6 @@ in the range from \fB0\fP to \fB31\fP.
Dump the payload of instrumentation packets. All other packet types are filtered
out.
-.TP
-.B \-\-dwt
-Decode hardware source packets as Data Watchpoint and Trace (DWT) packets.
-
.SH EXAMPLES
In order to decode trace data from a file (e.g. trace.bin), run the following
@@ -92,12 +88,7 @@ If you want to filter for instrumentation and hardware source packets only, use:
.RB " $ " "swodec \-\-input-file trace.bin \-\-filter inst,hw"
-To decode hardware source packets as Data Watchpoint and Trace (DWT) packets,
-apply the \fB\-\-dwt\fP option:
-
-.RB " $ " "swodec \-\-input-file trace.bin \-\-filter inst,hw \-\-dwt"
-
If you are interested in all packets except for unknown data and
synchronization, the simplest way is to invert the sense of matching:
-.RB " $ " "swodec \-\-input-file trace.bin \-\-filter ~unknown,sync \-\-dwt"
+.RB " $ " "swodec \-\-input-file trace.bin \-\-filter ~unknown,sync"
diff --git a/src/dwt.c b/src/dwt.c
index 659f116..b05c70c 100644
--- a/src/dwt.c
+++ b/src/dwt.c
@@ -299,39 +299,26 @@ static void handle_data_value_packet(const struct libswo_packet_hw *packet)
packet->size - 1);
}
-static void handle_unknown_packet(const struct libswo_packet_hw *packet)
-{
- printf("Unknown DWT packet (ID = %u, value = %x, size = %zu bytes)\n",
- packet->address, packet->value, packet->size - 1);
-}
-
-void dwt_handle_packet(const struct libswo_packet_hw *packet)
+gboolean dwt_handle_packet(const struct libswo_packet_hw *packet)
{
uint8_t addr;
addr = packet->address;
- switch (addr) {
- case EVCNT_ID:
+ if (addr == EVCNT_ID)
handle_evcnt_packet(packet);
- return;
- case EXTRACE_ID:
+ else if (addr == EXTRACE_ID)
handle_extrace_packet(packet);
- return;
- case PC_SAMPLE_ID:
+ else if (addr == PC_SAMPLE_ID)
handle_pc_sample_packet(packet);
- return;
- default:
- break;
- }
-
- if ((addr & PC_VALUE_HEADER_MASK) == PC_VALUE_HEADER) {
+ else if ((addr & PC_VALUE_HEADER_MASK) == PC_VALUE_HEADER)
handle_pc_value_packet(packet);
- } else if ((addr & ADDR_OFFSET_HEADER_MASK) == ADDR_OFFSET_HEADER) {
+ else if ((addr & ADDR_OFFSET_HEADER_MASK) == ADDR_OFFSET_HEADER)
handle_address_offset_packet(packet);
- } else if ((addr & DATA_VALUE_HEADER_MASK) == DATA_VALUE_HEADER) {
+ else if ((addr & DATA_VALUE_HEADER_MASK) == DATA_VALUE_HEADER)
handle_data_value_packet(packet);
- } else {
- handle_unknown_packet(packet);
- }
+ else
+ return FALSE;
+
+ return TRUE;
}
diff --git a/src/main.c b/src/main.c
index f085fe6..c7ef3d2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,9 +34,8 @@ static gchar *input_file = NULL;
static uint16_t packet_type_filter;
static uint32_t inst_address_filter;
static gboolean opt_dump_inst;
-static gboolean opt_decode_dwt;
-void dwt_handle_packet(const struct libswo_packet_hw *packet);
+gboolean dwt_handle_packet(const struct libswo_packet_hw *packet);
static gboolean parse_filter_option(const gchar *option_name,
const gchar *value, gpointer data, GError **error)
@@ -198,8 +197,6 @@ static GOptionEntry entries[] = {
"Filter for instrumentation source addresses", NULL},
{"dump-inst", 0, 0, G_OPTION_ARG_NONE, &opt_dump_inst,
"Dump instrumentation payload", NULL},
- {"dwt", 0, 0, G_OPTION_ARG_NONE, &opt_decode_dwt,
- "Enable DWT decoder", NULL},
{NULL, 0, 0, 0, NULL, NULL, NULL}
};
@@ -208,10 +205,8 @@ static void handle_hw_packet(const union libswo_packet *packet)
if (!(packet_type_filter & (1 << LIBSWO_PACKET_TYPE_HW)))
return;
- if (opt_decode_dwt) {
- dwt_handle_packet(&packet->hw);
+ if (dwt_handle_packet(&packet->hw))
return;
- }
printf("Hardware source (address = %u, value = %x, size = %zu bytes)\n",
packet->hw.address, packet->hw.value, packet->hw.size - 1);
@@ -432,7 +427,6 @@ int main(int argc, char **argv)
opt_version = FALSE;
opt_dump_inst = FALSE;
- opt_decode_dwt = FALSE;
/* Disable packet filtering for all packet types by default. */
packet_type_filter = (1 << LIBSWO_PACKET_TYPE_SYNC) | \