MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / resolve_label

Method resolve_label

pydevd_attach_to_process/winappdbg/module.py:725–778  ·  view source on GitHub ↗

Resolves a label for this module only. If the label refers to another module, an exception is raised. @type label: str @param label: Label to resolve. @rtype: int @return: Memory address pointed to by the label. @raise ValueError: The lab

(self, label)

Source from the content-addressed store, hash-verified

723 return address - hlib + self.lpBaseOfDll
724
725 def resolve_label(self, label):
726 """
727 Resolves a label for this module only. If the label refers to another
728 module, an exception is raised.
729
730 @type label: str
731 @param label: Label to resolve.
732
733 @rtype: int
734 @return: Memory address pointed to by the label.
735
736 @raise ValueError: The label is malformed or impossible to resolve.
737 @raise RuntimeError: Cannot resolve the module or function.
738 """
739
740 # Split the label into it's components.
741 # Use the fuzzy mode whenever possible.
742 aProcess = self.get_process()
743 if aProcess is not None:
744 (module, procedure, offset) = aProcess.split_label(label)
745 else:
746 (module, procedure, offset) = _ModuleContainer.split_label(label)
747
748 # If a module name is given that doesn't match ours,
749 # raise an exception.
750 if module and not self.match_name(module):
751 raise RuntimeError("Label does not belong to this module")
752
753 # Resolve the procedure if given.
754 if procedure:
755 address = self.resolve(procedure)
756 if address is None:
757 # If it's a debug symbol, use the symbol.
758 address = self.resolve_symbol(procedure)
759
760 # If it's the keyword "start" use the entry point.
761 if address is None and procedure == "start":
762 address = self.get_entry_point()
763
764 # The procedure was not found.
765 if address is None:
766 if not module:
767 module = self.get_name()
768 msg = "Can't find procedure %s in module %s"
769 raise RuntimeError(msg % (procedure, module))
770
771 # If no procedure is given use the base address of the module.
772 else:
773 address = self.get_base()
774
775 # Add the offset if given and return the resolved address.
776 if offset:
777 address = address + offset
778 return address
779
780
781# ==============================================================================

Callers 3

input_addressMethod · 0.45
_notify_load_dllMethod · 0.45
clean_exitMethod · 0.45

Calls 8

get_processMethod · 0.95
match_nameMethod · 0.95
resolveMethod · 0.95
resolve_symbolMethod · 0.95
get_entry_pointMethod · 0.95
get_nameMethod · 0.95
get_baseMethod · 0.95
split_labelMethod · 0.80

Tested by

no test coverage detected