diff options
author | Chris Johns <chrisj@rtems.org> | 2014-05-09 21:50:37 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-06-18 16:48:08 +1200 |
commit | 100f517ab37265acdf067e36b6860020ec8b2184 (patch) | |
tree | 2316c8b888e11dcbcfbfc66a0c1e31991ea20656 /tester/covoar/qemu-traces.h | |
parent | 4.11: Add ntp patch. (diff) | |
download | rtems-tools-100f517ab37265acdf067e36b6860020ec8b2184.tar.bz2 |
covoar: Merger the covoar source from rtems-testing.git.
Use waf to build covoar.
Diffstat (limited to 'tester/covoar/qemu-traces.h')
-rw-r--r-- | tester/covoar/qemu-traces.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/tester/covoar/qemu-traces.h b/tester/covoar/qemu-traces.h new file mode 100644 index 0000000..7e37840 --- /dev/null +++ b/tester/covoar/qemu-traces.h @@ -0,0 +1,119 @@ +/* + * QEMU System Emulator + * + * Copyright (C) 2009, AdaCore + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + * Qemu trace file format. + * It requires proper definition for uintXX_t where XX is 8, 16, 32 and 64 + * and target_ulong (32 or 64 bits). + */ + +#ifndef QEMU_TRACE_H +#define QEMU_TRACE_H + +/* XXX really not always right */ +/* XXX Added for covoar so this compiles */ +typedef uint32_t target_ulong; + +/* File header definition. */ +struct trace_header +{ + char magic[12]; +#define QEMU_TRACE_MAGIC "#QEMU-Traces" + + uint8_t version; +#define QEMU_TRACE_VERSION 1 + + /* File kind. */ + uint8_t kind; +#define QEMU_TRACE_KIND_RAW 0 +#define QEMU_TRACE_KIND_HISTORY 1 +#define QEMU_TRACE_KIND_INFO 2 +#define QEMU_TRACE_KIND_DECISION_MAP 3 +#define QEMU_TRACE_KIND_CONSOLIDATED 248 + + /* Sizeof (target_pc). Indicates struct trace_entry length. */ + uint8_t sizeof_target_pc; + + /* True if host was big endian. All the trace data used the host + endianness. */ + uint8_t big_endian; + + /* Target machine (use ELF number) - always in big endian. */ + uint8_t machine[2]; + + uint16_t _pad; +}; + +/* Header is followed by trace entries. */ +struct trace_entry +{ + target_ulong pc; + uint16_t size; + uint8_t op; +}; + +struct trace_entry32 +{ + uint32_t pc; + uint16_t size; + uint8_t op; + uint8_t _pad[1]; +}; + +struct trace_entry64 +{ + uint64_t pc; + uint16_t size; + uint8_t op; + uint8_t _pad[5]; +}; + +/* + * Trace operations for RAW and HISTORY + */ + +/* _BLOCK means pc .. pc+size-1 was executed. */ +#define TRACE_OP_BLOCK 0x10 /* Block fully executed. */ +#define TRACE_OP_FAULT 0x20 /* Fault at pc. */ +#define TRACE_OP_DYN 0x40 /* Dynamic branch. */ +#define TRACE_OP_BR0 0x01 /* Branch taken "in direction 0". */ +#define TRACE_OP_BR1 0x02 /* Branch taken "in direction 1". */ +#define TRACE_OP_BR2 0x04 +#define TRACE_OP_BR3 0x08 + +/* + * Decision map operations + */ +#define TRACE_OP_TRACE_CONDITIONAL 1 +/* Trace conditional jump instruction at address */ + +extern struct trace_entry *trace_current; +extern int tracefile_enabled; +extern int tracefile_nobuf; +extern int tracefile_history; + +void trace_init (const char *optarg); +void trace_push_entry (void); + +#endif /* QEMU_TRACE_H */ |