本文整理汇总了Python中Analysis.create_symbol方法的典型用法代码示例。如果您正苦于以下问题:Python Analysis.create_symbol方法的具体用法?Python Analysis.create_symbol怎么用?Python Analysis.create_symbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analysis
的用法示例。
在下文中一共展示了Analysis.create_symbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DisassemblerView
# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import create_symbol [as 别名]
#.........这里部分代码省略.........
addr = int(addr_str, 16)
if (addr < self.data.start()) or (addr > self.data.end()):
if hasattr(self.data, "symbols_by_name") and (addr_str in self.data.symbols_by_name):
addr = self.data.symbols_by_name[addr_str]
else:
QMessageBox.critical(self, "Error", "Address out of range")
return
except:
if hasattr(self.data, "symbols_by_name") and (addr_str in self.data.symbols_by_name):
addr = self.data.symbols_by_name[addr_str]
elif (addr_str[0] == '@') and hasattr(self.data, "symbols_by_name") and (addr_str[1:] in self.data.symbols_by_name):
addr = self.data.symbols_by_name[addr_str[1:]]
else:
QMessageBox.critical(self, "Error", "Invalid address or symbol")
return
# Try navigating within disassembly, if it isn't within a function then
# navigate to the hex editor
if not self.view.navigate("disassembler", addr):
self.view_in_hex_editor(addr)
def enter_name(self):
# A symbol must be selected
if (self.highlight_token == None) or (self.highlight_token[0] != "ptr"):
QMessageBox.critical(self, "Error", "No symbol selected.")
return
addr = self.highlight_token[1]
name = self.highlight_token[2]
# Ask for new name
new_name, ok = QInputDialog.getText(self, "Rename Symbol", "Symbol name:", QLineEdit.Normal, name)
if ok:
self.analysis.create_symbol(addr, new_name)
def undefine_name(self):
# A symbol must be selected
if (self.highlight_token == None) or (self.highlight_token[0] != "ptr"):
QMessageBox.critical(self, "Error", "No symbol selected.")
return
addr = self.highlight_token[1]
name = self.highlight_token[2]
# Ask for new name
self.analysis.undefine_symbol(addr, name)
def navigate_for_find(self, addr):
func, instr = self.analysis.find_instr(addr, True)
if func != None:
self.navigate(addr)
else:
self.make_proc(addr)
self.cur_instr = addr
self.desired_pos = None
def perform_find(self, dlg):
self.search_regex = dlg.search_regex()
if self.cur_instr != None:
self.search_start = self.cur_instr
else:
if self.function is None:
return
self.search_start = self.function
found_loc = self.data.find(self.search_regex, self.search_start)