Go to the documentation of this file.
17 #include "absl/strings/ascii.h"
18 #include "absl/strings/escaping.h"
19 #include "absl/strings/str_cat.h"
20 #include "absl/strings/string_view.h"
21 #include "absl/strings/substitute.h"
52 THROW(
"Couldn't initialize Capstone");
57 THROW(
"Tried to disassemble empty function.");
70 printf(
"Error disassembling function at address: %" PRIx64
"\n",
76 size_t count =
in->detail->x86.op_count;
84 sink->AddVMRangeForVMAddr(
"x86_disassemble",
in->address, to_address,
120 auto op0 =
in->detail->x86.operands[0];
141 THROW(
"Couldn't initialize Capstone");
145 THROW(
"Tried to disassemble empty function.");
154 THROW(
"Error disassembling function.");
157 std::map<uint64_t, int> local_labels;
159 for (
size_t i = 0;
i <
count;
i++) {
160 cs_insn *
in = insn +
i;
170 for (
auto&
pair : local_labels) {
174 for (
size_t i = 0;
i <
count;
i++) {
175 cs_insn *
in = insn +
i;
200 auto iter = local_labels.find(
in->address);
201 if (
iter != local_labels.end()) {
209 if (
iter != local_labels.end()) {
221 RightPad(
std::string(mnemonic), 8),
" ", op_str,
"\n");
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
void StrAppend(std::string *dest, const AlphaNum &a)
unsigned char match[65280+2]
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
@ X86_OP_IMM
= CS_OP_IMM (Immediate operand).
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
std::string DisassembleFunction(const DisassemblyInfo &info)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
cs_arch
Architecture type.
@ CS_OPT_DETAIL
Break down instruction structure into details.
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
std::string BytesToHexString(absl::string_view from)
static constexpr uint64_t kUnknownSize
static ABSL_ATTRIBUTE_NORETURN bool Replace(std::string *, const ReImpl &, std::string)
constexpr size_type size() const noexcept
void AsciiStrToUpper(std::string *s)
@ CS_ARCH_X86
X86 architecture (including x86 & x86-64)
unsigned __int64 uint64_t
static ABSL_ATTRIBUTE_NORETURN bool PartialMatch(const std::string &, const ReImpl &, A &&...)
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
@ X86_OP_MEM
= CS_OP_MEM (Memory operand).
bool TryGetJumpTarget(cs_arch arch, cs_insn *in, uint64_t *target)
CAPSTONE_EXPORT bool CAPSTONE_API cs_disasm_iter(csh ud, const uint8_t **code, size_t *size, uint64_t *address, cs_insn *insn)
void DisassembleFindReferences(const DisassemblyInfo &info, RangeSink *sink)
UniquePtr< SSL_SESSION > ret
absl::string_view string_view
CAPSTONE_EXPORT cs_insn *CAPSTONE_API cs_malloc(csh ud)
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
bool TryGetLabel(uint64_t addr, std::string *label) const
static ABSL_ATTRIBUTE_NORETURN int GlobalReplace(std::string *, const ReImpl &, std::string)
constexpr const_pointer data() const noexcept
static bool to_string(zval *from)
std::pair< std::string, std::string > pair
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:16