Browse Source

Add proper assertion messages

nosoop 10 months ago
parent
commit
6db8cb7aae
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/smgdc/validate.py

+ 4 - 2
src/smgdc/validate.py

@@ -147,7 +147,7 @@ class LocationEntry(BaseEntry):
         if not sym:
             raise AssertionError("Could not find symbol {self.symbol}")
         offset = bin.angr.loader.main_object.addr_to_offset(sym.rebased_addr + self.offset)
-        assert offset
+        assert offset, "Received invalid {offset = }"
         return offset
 
 
@@ -179,7 +179,9 @@ class VirtualFunctionEntry(BaseEntry, tag="vfn"):
     def process(self, bin: PlatformBinary) -> ResultValues:
         # returns windows and linux vtable offsets
         # TODO: implement
-        assert isinstance(bin, LinuxBinary)
+        assert isinstance(
+            bin, LinuxBinary
+        ), "Expected Linux binary for virtual function handling"
         self.typename = self.typename or self.typename_from_symbol
         vtda = bin.vtable_disambiguator
         vtsym = bin.angr.loader.find_symbol(f"_ZTV{self.typename}")