DynamoRIO / DynamoRIO/dynamorio

Extend output format for drcachesim opcode mix

Open
#5,699 8 comments 0 reactions 0 assignees View on GitHub
Component-DrMemtrace help wanted Type-Feature
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

Currently opcodes dumps just names ( bin64/drrun -t drcachesim -simulator_type opcode_mix -indir drmemtrace.*.dir)
And some of opcodes have the same names
for example,
```
Opcode mix tool results:
578415 : total executed instructions
81645 : mov
69303 : mov
55366 : cmp
....
```
Is it useful to add opcode number to define opcode?
I mean output like this
```
Opcode mix tool results:
578415 : total executed instructions
81645 : mov( 56)
69303 : mov( 55)
55366 : cmp( 14)
```
```

diff --git a/clients/drcachesim/tools/opcode_mix.cpp b/clients/drcachesim/tools/opcode_mix.cpp
index 7353774b8..5144e772e 100644
--- a/clients/drcachesim/tools/opcode_mix.cpp
+++ b/clients/drcachesim/tools/opcode_mix.cpp
@@ -255,8 +255,10 @@ opcode_mix_t::print_results()
total.opcode_counts.end());
std::sort(sorted.begin(), sorted.end(), cmp_val);
for (const auto &keyvals : sorted) {
- std::cerr << std::setw(15) << keyvals.second << " : " << std::setw(9)
- << decode_opcode_name(keyvals.first) << "\n";
+ std::cerr << std::setw(15) << keyvals.second << " : " << std::setw(12)
+ << decode_opcode_name(keyvals.first) << "("
+ << std::resetiosflags(std::ios::left) << std::setw(4)
+ << keyvals.first << ")" << "\n";
}
return true;
}
```
Thx, Kirill

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.