aboutsummaryrefslogtreecommitdiff
path: root/riscv/disasm.h
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2019-03-25 20:53:55 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2019-04-17 01:48:16 -0700
commit5d02bead010e65ca391fc534039da0d39652a9e5 (patch)
treea17e6d20cc16b6482fa4362309143943877229b5 /riscv/disasm.h
parent8962ec40c7c13eca0dfc1f23beec263743bfbcbb (diff)
downloadspike-5d02bead010e65ca391fc534039da0d39652a9e5.zip
spike-5d02bead010e65ca391fc534039da0d39652a9e5.tar.gz
spike-5d02bead010e65ca391fc534039da0d39652a9e5.tar.bz2
disasm: make instruction name dynamic
to support not const instruction name generated by generated string Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/disasm.h')
-rw-r--r--riscv/disasm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/riscv/disasm.h b/riscv/disasm.h
index 3c50794..d322731 100644
--- a/riscv/disasm.h
+++ b/riscv/disasm.h
@@ -32,7 +32,8 @@ class disasm_insn_t
public:
disasm_insn_t(const char* name, uint32_t match, uint32_t mask,
const std::vector<const arg_t*>& args)
- : match(match), mask(mask), args(args), name(name) {}
+ : match(match), mask(mask), args(args), name(strdup(name)) {}
+ ~disasm_insn_t() { free(const_cast<char *>(name)); }
bool operator == (insn_t insn) const
{