diff options
| -rw-r--r-- | architecture.cpp | 9 | ||||
| -rw-r--r-- | binaryninjaapi.h | 5 | ||||
| -rw-r--r-- | binaryninjacore.h | 4 | ||||
| -rw-r--r-- | python/function.py | 8 |
4 files changed, 14 insertions, 12 deletions
diff --git a/architecture.cpp b/architecture.cpp index 6ca7733e..09ef2013 100644 --- a/architecture.cpp +++ b/architecture.cpp @@ -2302,7 +2302,7 @@ bool DisassemblyTextRenderer::GetInstructionText(uint64_t addr, size_t& len, vector<DisassemblyTextLine> DisassemblyTextRenderer::PostProcessInstructionTextLines(uint64_t addr, - size_t len, const vector<DisassemblyTextLine>& lines) + size_t len, const vector<DisassemblyTextLine>& lines, const string& indentSpaces) { BNDisassemblyTextLine* inLines = new BNDisassemblyTextLine[lines.size()]; for (size_t i = 0; i < lines.size(); i++) @@ -2317,7 +2317,8 @@ vector<DisassemblyTextLine> DisassemblyTextRenderer::PostProcessInstructionTextL BNDisassemblyTextLine* result = nullptr; size_t count = 0; - result = BNPostProcessDisassemblyTextRendererLines(m_object, addr, len, inLines, lines.size(), &count); + result = BNPostProcessDisassemblyTextRendererLines(m_object, addr, len, inLines, lines.size(), &count, + indentSpaces.c_str()); BNFreeDisassemblyTextLines(inLines, lines.size()); vector<DisassemblyTextLine> outLines; @@ -2427,7 +2428,7 @@ void DisassemblyTextRenderer::AddIntegerToken(vector<InstructionTextToken>& toke void DisassemblyTextRenderer::WrapComment(DisassemblyTextLine& line, vector<DisassemblyTextLine>& lines, - const string& comment, bool hasAutoAnnotations, const string& leadingSpaces) + const string& comment, bool hasAutoAnnotations, const string& leadingSpaces, const string& indentSpaces) { BNDisassemblyTextLine inLine; inLine.addr = line.addr; @@ -2439,7 +2440,7 @@ void DisassemblyTextRenderer::WrapComment(DisassemblyTextLine& line, vector<Disa size_t count = 0; BNDisassemblyTextLine* result = BNDisassemblyTextRendererWrapComment(m_object, &inLine, &count, - comment.c_str(), hasAutoAnnotations, leadingSpaces.c_str()); + comment.c_str(), hasAutoAnnotations, leadingSpaces.c_str(), indentSpaces.c_str()); for (size_t i = 0; i < count; i++) { diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 91fe0d63..bcc4b0cc 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -5206,7 +5206,7 @@ __attribute__ ((format (printf, 1, 2))) virtual void GetInstructionAnnotations(std::vector<InstructionTextToken>& tokens, uint64_t addr); virtual bool GetInstructionText(uint64_t addr, size_t& len, std::vector<DisassemblyTextLine>& lines); std::vector<DisassemblyTextLine> PostProcessInstructionTextLines(uint64_t addr, - size_t len, const std::vector<DisassemblyTextLine>& lines); + size_t len, const std::vector<DisassemblyTextLine>& lines, const std::string& indentSpaces = ""); virtual bool GetDisassemblyText(uint64_t addr, size_t& len, std::vector<DisassemblyTextLine>& lines); void ResetDeduplicatedComments(); @@ -5223,7 +5223,8 @@ __attribute__ ((format (printf, 1, 2))) std::vector<DisassemblyTextLine>& lines, const std::string& comment, bool hasAutoAnnotations, - const std::string& leadingSpaces=" "); + const std::string& leadingSpaces=" ", + const std::string& indentSpaces=""); }; struct LinearViewObjectIdentifier diff --git a/binaryninjacore.h b/binaryninjacore.h index ea718dbe..f6ac4510 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -2980,7 +2980,7 @@ __attribute__ ((format (printf, 1, 2))) BINARYNINJACOREAPI bool BNGetDisassemblyTextRendererLines(BNDisassemblyTextRenderer* renderer, uint64_t addr, size_t* len, BNDisassemblyTextLine** result, size_t* count); BINARYNINJACOREAPI BNDisassemblyTextLine* BNPostProcessDisassemblyTextRendererLines(BNDisassemblyTextRenderer* renderer, - uint64_t addr, size_t len, BNDisassemblyTextLine* inLines, size_t inCount, size_t* outCount); + uint64_t addr, size_t len, BNDisassemblyTextLine* inLines, size_t inCount, size_t* outCount, const char* indentSpaces); BINARYNINJACOREAPI void BNResetDisassemblyTextRendererDeduplicatedComments(BNDisassemblyTextRenderer* renderer); BINARYNINJACOREAPI bool BNGetDisassemblyTextRendererSymbolTokens(BNDisassemblyTextRenderer* renderer, uint64_t addr, size_t size, size_t operand, BNInstructionTextToken** result, size_t* count); @@ -2991,7 +2991,7 @@ __attribute__ ((format (printf, 1, 2))) BNInstructionTextToken* token, BNArchitecture* arch, uint64_t addr, size_t* count); BINARYNINJACOREAPI BNDisassemblyTextLine* BNDisassemblyTextRendererWrapComment(BNDisassemblyTextRenderer* renderer, const BNDisassemblyTextLine* inLine, size_t* outLineCount, const char* comment, bool hasAutoAnnotations, - const char* leadingSpaces); + const char* leadingSpaces, const char* indentSpaces); BINARYNINJACOREAPI void BNMarkFunctionAsRecentlyUsed(BNFunction* func); BINARYNINJACOREAPI void BNMarkBasicBlockAsRecentlyUsed(BNBasicBlock* block); diff --git a/python/function.py b/python/function.py index 97f832d1..81cfc6b6 100644 --- a/python/function.py +++ b/python/function.py @@ -3153,7 +3153,7 @@ class DisassemblyTextRenderer(object): core.BNFreeDisassemblyTextLines(lines, count.value) return (result, length.value) - def post_process_lines(self, addr, length, in_lines): + def post_process_lines(self, addr, length, in_lines, indent_spaces=""): if isinstance(in_lines, str): in_lines = in_lines.split('\n') line_buf = (core.BNDisassemblyTextLine * len(in_lines))() @@ -3184,7 +3184,7 @@ class DisassemblyTextRenderer(object): line_buf[i].tokens = InstructionTextToken.get_instruction_lines(line.tokens) count = ctypes.c_ulonglong() lines = ctypes.POINTER(core.BNDisassemblyTextLine)() - lines = core.BNPostProcessDisassemblyTextRendererLines(self.handle, addr, length, line_buf, len(in_lines), count) + lines = core.BNPostProcessDisassemblyTextRendererLines(self.handle, addr, length, line_buf, len(in_lines), count, indent_spaces) il_function = self.il_function result = [] for i in range(0, count.value): @@ -3250,7 +3250,7 @@ class DisassemblyTextRenderer(object): tokens += result core.BNFreeInstructionText(new_tokens, count.value) - def wrap_comment(self, lines, cur_line, comment, has_auto_annotations, leading_spaces = " "): + def wrap_comment(self, lines, cur_line, comment, has_auto_annotations, leading_spaces = " ", indent_spaces = ""): cur_line_obj = core.BNDisassemblyTextLine() cur_line_obj.addr = cur_line.address if cur_line.il_instruction is None: @@ -3262,7 +3262,7 @@ class DisassemblyTextRenderer(object): cur_line_obj.count = len(cur_line.tokens) count = ctypes.c_ulonglong() new_lines = core.BNDisassemblyTextRendererWrapComment(self.handle, cur_line_obj, count, comment, - has_auto_annotations, leading_spaces) + has_auto_annotations, leading_spaces, indent_spaces) il_function = self.il_function for i in range(0, count.value): addr = new_lines[i].addr |
