Expose actual instruction from DisassemblerX86
R=cdn at http://breakpad.appspot.com/260001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@766 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
d328f2011f
commit
ed1c70b5b8
2 changed files with 12 additions and 0 deletions
|
@ -36,6 +36,8 @@
|
|||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DISASSEMBLER_X86_H_
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_DISASSEMBLER_X86_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace libdis {
|
||||
|
@ -73,6 +75,12 @@ class DisassemblerX86 {
|
|||
// Indicates whether the current disassembled instruction was valid.
|
||||
bool currentInstructionValid() { return instr_valid_; }
|
||||
|
||||
// Returns the current instruction as defined in libdis.h,
|
||||
// or NULL if the current instruction is not valid.
|
||||
const libdis::x86_insn_t* currentInstruction() {
|
||||
return instr_valid_ ? ¤t_instr_ : NULL;
|
||||
}
|
||||
|
||||
// Returns the type of the current instruction as defined in libdis.h.
|
||||
libdis::x86_insn_group currentInstructionGroup() {
|
||||
return current_instr_.group;
|
||||
|
|
|
@ -96,8 +96,12 @@ TEST(DisassemblerX86Test, SimpleReturnInstruction) {
|
|||
EXPECT_EQ(0, dis.flags());
|
||||
EXPECT_EQ(true, dis.endOfBlock());
|
||||
EXPECT_EQ(libdis::insn_controlflow, dis.currentInstructionGroup());
|
||||
const libdis::x86_insn_t* instruction = dis.currentInstruction();
|
||||
EXPECT_EQ(libdis::insn_controlflow, instruction->group);
|
||||
EXPECT_EQ(libdis::insn_return, instruction->type);
|
||||
EXPECT_EQ(0, dis.NextInstruction());
|
||||
EXPECT_EQ(false, dis.currentInstructionValid());
|
||||
EXPECT_EQ(NULL, dis.currentInstruction());
|
||||
}
|
||||
|
||||
TEST(DisassemblerX86Test, SimpleInvalidInstruction) {
|
||||
|
|
Loading…
Reference in a new issue