angr 9.2.139__py3-none-manylinux2014_x86_64.whl → 9.2.141__py3-none-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of angr might be problematic. Click here for more details.

Files changed (87) hide show
  1. angr/__init__.py +1 -1
  2. angr/analyses/calling_convention/calling_convention.py +136 -53
  3. angr/analyses/calling_convention/fact_collector.py +44 -18
  4. angr/analyses/calling_convention/utils.py +3 -1
  5. angr/analyses/cfg/cfg_base.py +13 -0
  6. angr/analyses/cfg/cfg_fast.py +11 -0
  7. angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +9 -8
  8. angr/analyses/decompiler/ail_simplifier.py +115 -72
  9. angr/analyses/decompiler/callsite_maker.py +24 -11
  10. angr/analyses/decompiler/clinic.py +78 -43
  11. angr/analyses/decompiler/decompiler.py +18 -7
  12. angr/analyses/decompiler/expression_narrower.py +1 -1
  13. angr/analyses/decompiler/optimization_passes/const_prop_reverter.py +8 -7
  14. angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +3 -1
  15. angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +21 -2
  16. angr/analyses/decompiler/optimization_passes/ite_region_converter.py +21 -13
  17. angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +84 -15
  18. angr/analyses/decompiler/optimization_passes/optimization_pass.py +92 -11
  19. angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +53 -9
  20. angr/analyses/decompiler/peephole_optimizations/eager_eval.py +44 -7
  21. angr/analyses/decompiler/region_identifier.py +6 -4
  22. angr/analyses/decompiler/region_simplifiers/expr_folding.py +287 -122
  23. angr/analyses/decompiler/region_simplifiers/region_simplifier.py +31 -13
  24. angr/analyses/decompiler/ssailification/rewriting.py +23 -15
  25. angr/analyses/decompiler/ssailification/rewriting_engine.py +105 -24
  26. angr/analyses/decompiler/ssailification/ssailification.py +22 -14
  27. angr/analyses/decompiler/structured_codegen/c.py +73 -137
  28. angr/analyses/decompiler/structuring/dream.py +22 -18
  29. angr/analyses/decompiler/structuring/phoenix.py +158 -41
  30. angr/analyses/decompiler/structuring/recursive_structurer.py +1 -0
  31. angr/analyses/decompiler/structuring/structurer_base.py +37 -10
  32. angr/analyses/decompiler/structuring/structurer_nodes.py +4 -1
  33. angr/analyses/decompiler/utils.py +106 -21
  34. angr/analyses/deobfuscator/api_obf_finder.py +8 -5
  35. angr/analyses/deobfuscator/api_obf_type2_finder.py +18 -10
  36. angr/analyses/deobfuscator/string_obf_finder.py +105 -18
  37. angr/analyses/forward_analysis/forward_analysis.py +1 -1
  38. angr/analyses/propagator/top_checker_mixin.py +6 -6
  39. angr/analyses/reaching_definitions/__init__.py +2 -1
  40. angr/analyses/reaching_definitions/dep_graph.py +1 -12
  41. angr/analyses/reaching_definitions/engine_vex.py +36 -31
  42. angr/analyses/reaching_definitions/function_handler.py +15 -2
  43. angr/analyses/reaching_definitions/rd_state.py +1 -37
  44. angr/analyses/reaching_definitions/reaching_definitions.py +13 -24
  45. angr/analyses/s_propagator.py +6 -41
  46. angr/analyses/s_reaching_definitions/s_rda_model.py +7 -1
  47. angr/analyses/s_reaching_definitions/s_rda_view.py +43 -25
  48. angr/analyses/stack_pointer_tracker.py +36 -22
  49. angr/analyses/typehoon/simple_solver.py +45 -7
  50. angr/analyses/typehoon/typeconsts.py +18 -5
  51. angr/analyses/variable_recovery/engine_ail.py +1 -1
  52. angr/analyses/variable_recovery/engine_base.py +7 -5
  53. angr/analyses/variable_recovery/engine_vex.py +20 -4
  54. angr/block.py +69 -107
  55. angr/callable.py +14 -7
  56. angr/calling_conventions.py +30 -11
  57. angr/distributed/__init__.py +1 -1
  58. angr/engines/__init__.py +7 -8
  59. angr/engines/engine.py +1 -120
  60. angr/engines/failure.py +2 -2
  61. angr/engines/hook.py +2 -2
  62. angr/engines/light/engine.py +2 -2
  63. angr/engines/pcode/engine.py +2 -14
  64. angr/engines/procedure.py +2 -2
  65. angr/engines/soot/engine.py +2 -2
  66. angr/engines/soot/statements/switch.py +1 -1
  67. angr/engines/successors.py +124 -11
  68. angr/engines/syscall.py +2 -2
  69. angr/engines/unicorn.py +3 -3
  70. angr/engines/vex/heavy/heavy.py +3 -15
  71. angr/factory.py +12 -22
  72. angr/knowledge_plugins/key_definitions/atoms.py +8 -4
  73. angr/knowledge_plugins/key_definitions/live_definitions.py +41 -103
  74. angr/knowledge_plugins/variables/variable_manager.py +7 -5
  75. angr/sim_type.py +19 -17
  76. angr/simos/simos.py +3 -1
  77. angr/state_plugins/plugin.py +19 -4
  78. angr/storage/memory_mixins/memory_mixin.py +1 -1
  79. angr/storage/memory_mixins/paged_memory/pages/multi_values.py +10 -5
  80. angr/utils/ssa/__init__.py +119 -4
  81. angr/utils/types.py +48 -0
  82. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/METADATA +6 -6
  83. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/RECORD +87 -86
  84. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/LICENSE +0 -0
  85. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/WHEEL +0 -0
  86. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/entry_points.txt +0 -0
  87. {angr-9.2.139.dist-info → angr-9.2.141.dist-info}/top_level.txt +0 -0
@@ -40,6 +40,7 @@ from angr.sim_variable import SimVariable, SimTemporaryVariable, SimStackVariabl
40
40
  from angr.utils.constants import is_alignment_mask
41
41
  from angr.utils.library import get_cpp_function_name
42
42
  from angr.utils.loader import is_in_readonly_segment, is_in_readonly_section
43
+ from angr.utils.types import unpack_typeref, unpack_pointer
43
44
  from angr.analyses.decompiler.utils import structured_node_is_simple_return
44
45
  from angr.errors import UnsupportedNodeTypeError, AngrRuntimeError
45
46
  from angr.knowledge_plugins.cfg.memory_data import MemoryData, MemoryDataSort
@@ -72,35 +73,6 @@ l.addFilter(UniqueLogFilter())
72
73
  INDENT_DELTA = 4
73
74
 
74
75
 
75
- def unpack_typeref(ty):
76
- if isinstance(ty, TypeRef):
77
- return ty.type
78
- return ty
79
-
80
-
81
- def unpack_pointer(ty) -> SimType | None:
82
- if isinstance(ty, SimTypePointer):
83
- return ty.pts_to
84
- return None
85
-
86
-
87
- def unpack_array(ty) -> SimType | None:
88
- if isinstance(ty, SimTypeArray):
89
- return ty.elem_type
90
- if isinstance(ty, SimTypeFixedSizeArray):
91
- return ty.elem_type
92
- return None
93
-
94
-
95
- def squash_array_reference(ty):
96
- pointed_to = unpack_pointer(ty)
97
- if pointed_to:
98
- array_of = unpack_array(pointed_to)
99
- if array_of:
100
- return SimTypePointer(array_of)
101
- return ty
102
-
103
-
104
76
  def qualifies_for_simple_cast(ty1, ty2):
105
77
  # converting ty1 to ty2 - can this happen precisely?
106
78
  # used to decide whether to add explicit typecasts instead of doing *(int*)&v1
@@ -122,7 +94,7 @@ def qualifies_for_implicit_cast(ty1, ty2):
122
94
  ):
123
95
  return False
124
96
 
125
- return ty1.size <= ty2.size
97
+ return ty1.size <= ty2.size if ty1.size is not None and ty2.size is not None else False
126
98
 
127
99
 
128
100
  def extract_terms(expr: CExpression) -> tuple[int, list[tuple[int, CExpression]]]:
@@ -260,9 +232,10 @@ class CConstruct:
260
232
  Acts as the base class for all other representation constructions.
261
233
  """
262
234
 
263
- __slots__ = ("codegen",)
235
+ __slots__ = ("codegen", "tags")
264
236
 
265
- def __init__(self, codegen):
237
+ def __init__(self, codegen, tags=None):
238
+ self.tags = tags or {}
266
239
  self.codegen: StructuredCodeGenerator = codegen
267
240
 
268
241
  def c_repr(self, indent=0, pos_to_node=None, pos_to_addr=None, addr_to_pos=None):
@@ -319,6 +292,7 @@ class CConstruct:
319
292
  CUnaryOp,
320
293
  CAssignment,
321
294
  CFunctionCall,
295
+ CLabel,
322
296
  ),
323
297
  )
324
298
  and pos_to_node is not None
@@ -341,7 +315,7 @@ class CConstruct:
341
315
  pos_to_node.add_mapping(pos, len(s), obj)
342
316
 
343
317
  if s.endswith("\n"):
344
- text = pending_stmt_comments.pop(last_insn_addr, None)
318
+ text = pending_stmt_comments.pop(last_insn_addr, None) if isinstance(last_insn_addr, int) else None
345
319
  if text is not None:
346
320
  todo = " // " + text
347
321
  pos += len(s) - 1
@@ -354,7 +328,7 @@ class CConstruct:
354
328
  yield s
355
329
 
356
330
  if isinstance(obj, CExpression):
357
- text = pending_expr_comments.pop(last_insn_addr, None)
331
+ text = pending_expr_comments.pop(last_insn_addr, None) if isinstance(last_insn_addr, int) else None
358
332
  if text is not None:
359
333
  todo = " /*" + text + "*/ "
360
334
  pos += len(todo)
@@ -504,7 +478,8 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
504
478
  vartypes = [x[1] for x in cvar_and_vartypes]
505
479
  count = Counter(vartypes)
506
480
  vartypes = sorted(
507
- count.copy(), key=lambda x: (isinstance(x, (SimTypeChar, SimTypeInt, SimTypeFloat)), count[x], repr(x))
481
+ count.copy(),
482
+ key=lambda x, ct=count: (isinstance(x, (SimTypeChar, SimTypeInt, SimTypeFloat)), ct[x], repr(x)),
508
483
  )
509
484
 
510
485
  for i, var_type in enumerate(vartypes):
@@ -563,7 +538,7 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
563
538
  yield from type_to_c_repr_chunks(ty, full=True, indent_str=indent_str)
564
539
 
565
540
  if self.codegen.show_externs and self.codegen.cexterns:
566
- for v in sorted(self.codegen.cexterns, key=lambda v: v.variable.name):
541
+ for v in sorted(self.codegen.cexterns, key=lambda v: str(v.variable.name)):
567
542
  varname = v.c_repr() if v.type is None else v.variable.name
568
543
  yield "extern ", None
569
544
  yield from type_to_c_repr_chunks(v.type, name=varname, name_type=v, full=False)
@@ -573,6 +548,7 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
573
548
  yield indent_str, None
574
549
 
575
550
  # header comments (if they exist)
551
+ assert self.codegen.cfunc is not None and self.codegen.cfunc.addr is not None
576
552
  header_comments = self.codegen.kb.comments.get(self.codegen.cfunc.addr, [])
577
553
  if header_comments:
578
554
  header_cmt = self._line_wrap_comment("".join(header_comments))
@@ -582,6 +558,7 @@ class CFunction(CConstruct): # pylint:disable=abstract-method
582
558
  yield "// attributes: PLT stub\n", None
583
559
 
584
560
  # return type
561
+ assert self.functy.returnty is not None
585
562
  yield self.functy.returnty.c_repr(name="").strip(" "), self.functy.returnty
586
563
  yield " ", None
587
564
  # function name
@@ -641,7 +618,8 @@ class CStatement(CConstruct): # pylint:disable=abstract-method
641
618
  Represents a statement in C.
642
619
  """
643
620
 
644
- __slots__ = ()
621
+ def __init__(self, tags=None, codegen=None):
622
+ super().__init__(codegen=codegen, tags=tags)
645
623
 
646
624
 
647
625
  class CExpression(CConstruct):
@@ -649,13 +627,10 @@ class CExpression(CConstruct):
649
627
  Base class for C expressions.
650
628
  """
651
629
 
652
- __slots__ = (
653
- "_type",
654
- "collapsed",
655
- )
630
+ __slots__ = ("_type", "collapsed")
656
631
 
657
- def __init__(self, collapsed=False, **kwargs):
658
- super().__init__(**kwargs)
632
+ def __init__(self, collapsed=False, tags=None, codegen=None):
633
+ super().__init__(codegen=codegen, tags=tags)
659
634
  self._type = None
660
635
  self.collapsed = collapsed
661
636
 
@@ -739,15 +714,13 @@ class CWhileLoop(CLoop):
739
714
  __slots__ = (
740
715
  "body",
741
716
  "condition",
742
- "tags",
743
717
  )
744
718
 
745
- def __init__(self, condition, body, tags=None, **kwargs):
719
+ def __init__(self, condition, body, **kwargs):
746
720
  super().__init__(**kwargs)
747
721
 
748
722
  self.condition = condition
749
723
  self.body = body
750
- self.tags = tags
751
724
 
752
725
  def c_repr_chunks(self, indent=0, asexpr=False):
753
726
  indent_str = self.indent_str(indent=indent)
@@ -787,15 +760,13 @@ class CDoWhileLoop(CLoop):
787
760
  __slots__ = (
788
761
  "body",
789
762
  "condition",
790
- "tags",
791
763
  )
792
764
 
793
- def __init__(self, condition, body, tags=None, **kwargs):
765
+ def __init__(self, condition, body, **kwargs):
794
766
  super().__init__(**kwargs)
795
767
 
796
768
  self.condition = condition
797
769
  self.body = body
798
- self.tags = tags
799
770
 
800
771
  def c_repr_chunks(self, indent=0, asexpr=False):
801
772
  indent_str = self.indent_str(indent=indent)
@@ -835,9 +806,14 @@ class CForLoop(CStatement):
835
806
  Represents a for-loop in C.
836
807
  """
837
808
 
838
- __slots__ = ("body", "condition", "initializer", "iterator", "tags")
809
+ __slots__ = (
810
+ "body",
811
+ "condition",
812
+ "initializer",
813
+ "iterator",
814
+ )
839
815
 
840
- def __init__(self, initializer, condition, iterator, body, tags=None, **kwargs):
816
+ def __init__(self, initializer, condition, iterator, body, **kwargs):
841
817
  super().__init__(**kwargs)
842
818
 
843
819
  self.initializer = initializer
@@ -845,8 +821,6 @@ class CForLoop(CStatement):
845
821
  self.iterator = iterator
846
822
  self.body = body
847
823
 
848
- self.tags = tags
849
-
850
824
  def c_repr_chunks(self, indent=0, asexpr=False):
851
825
  indent_str = self.indent_str(indent=indent)
852
826
  brace = CClosingObject("{")
@@ -887,7 +861,12 @@ class CIfElse(CStatement):
887
861
  Represents an if-else construct in C.
888
862
  """
889
863
 
890
- __slots__ = ("condition_and_nodes", "cstyle_ifs", "else_node", "simplify_else_scope", "tags")
864
+ __slots__ = (
865
+ "condition_and_nodes",
866
+ "cstyle_ifs",
867
+ "else_node",
868
+ "simplify_else_scope",
869
+ )
891
870
 
892
871
  def __init__(
893
872
  self,
@@ -895,7 +874,6 @@ class CIfElse(CStatement):
895
874
  else_node=None,
896
875
  simplify_else_scope=False,
897
876
  cstyle_ifs=True,
898
- tags=None,
899
877
  **kwargs,
900
878
  ):
901
879
  super().__init__(**kwargs)
@@ -904,7 +882,6 @@ class CIfElse(CStatement):
904
882
  self.else_node = else_node
905
883
  self.simplify_else_scope = simplify_else_scope
906
884
  self.cstyle_ifs = cstyle_ifs
907
- self.tags = tags
908
885
 
909
886
  if not self.condition_and_nodes:
910
887
  raise ValueError("You must specify at least one condition")
@@ -1014,15 +991,13 @@ class CIfBreak(CStatement):
1014
991
  __slots__ = (
1015
992
  "condition",
1016
993
  "cstyle_ifs",
1017
- "tags",
1018
994
  )
1019
995
 
1020
- def __init__(self, condition, cstyle_ifs=True, tags=None, **kwargs):
996
+ def __init__(self, condition, cstyle_ifs=True, **kwargs):
1021
997
  super().__init__(**kwargs)
1022
998
 
1023
999
  self.condition = condition
1024
1000
  self.cstyle_ifs = cstyle_ifs
1025
- self.tags = tags
1026
1001
 
1027
1002
  def c_repr_chunks(self, indent=0, asexpr=False):
1028
1003
  indent_str = self.indent_str(indent=indent)
@@ -1058,11 +1033,10 @@ class CBreak(CStatement):
1058
1033
  Represents a break statement in C.
1059
1034
  """
1060
1035
 
1061
- __slots__ = ("tags",)
1036
+ __slots__ = ()
1062
1037
 
1063
- def __init__(self, tags=None, **kwargs):
1038
+ def __init__(self, **kwargs):
1064
1039
  super().__init__(**kwargs)
1065
- self.tags = tags
1066
1040
 
1067
1041
  def c_repr_chunks(self, indent=0, asexpr=False):
1068
1042
  indent_str = self.indent_str(indent=indent)
@@ -1076,11 +1050,10 @@ class CContinue(CStatement):
1076
1050
  Represents a continue statement in C.
1077
1051
  """
1078
1052
 
1079
- __slots__ = ("tags",)
1053
+ __slots__ = ()
1080
1054
 
1081
- def __init__(self, tags=None, **kwargs):
1055
+ def __init__(self, **kwargs):
1082
1056
  super().__init__(**kwargs)
1083
- self.tags = tags
1084
1057
 
1085
1058
  def c_repr_chunks(self, indent=0, asexpr=False):
1086
1059
  indent_str = self.indent_str(indent=indent)
@@ -1094,15 +1067,14 @@ class CSwitchCase(CStatement):
1094
1067
  Represents a switch-case statement in C.
1095
1068
  """
1096
1069
 
1097
- __slots__ = ("cases", "default", "switch", "tags")
1070
+ __slots__ = ("cases", "default", "switch")
1098
1071
 
1099
- def __init__(self, switch, cases, default, tags=None, **kwargs):
1072
+ def __init__(self, switch, cases, default, **kwargs):
1100
1073
  super().__init__(**kwargs)
1101
1074
 
1102
1075
  self.switch = switch
1103
1076
  self.cases: list[tuple[int | tuple[int], CStatements]] = cases
1104
1077
  self.default = default
1105
- self.tags = tags
1106
1078
 
1107
1079
  def c_repr_chunks(self, indent=0, asexpr=False):
1108
1080
  indent_str = self.indent_str(indent=indent)
@@ -1153,14 +1125,13 @@ class CIncompleteSwitchCase(CStatement):
1153
1125
  structuring fails (for whatever reason).
1154
1126
  """
1155
1127
 
1156
- __slots__ = ("cases", "head", "tags")
1128
+ __slots__ = ("cases", "head")
1157
1129
 
1158
- def __init__(self, head, cases, tags=None, **kwargs):
1130
+ def __init__(self, head, cases, **kwargs):
1159
1131
  super().__init__(**kwargs)
1160
1132
 
1161
1133
  self.head = head
1162
1134
  self.cases: list[tuple[int, CStatements]] = cases
1163
- self.tags = tags
1164
1135
 
1165
1136
  def c_repr_chunks(self, indent=0, asexpr=False):
1166
1137
  indent_str = self.indent_str(indent=indent)
@@ -1199,18 +1170,13 @@ class CAssignment(CStatement):
1199
1170
  a = b
1200
1171
  """
1201
1172
 
1202
- __slots__ = (
1203
- "lhs",
1204
- "rhs",
1205
- "tags",
1206
- )
1173
+ __slots__ = ("lhs", "rhs")
1207
1174
 
1208
- def __init__(self, lhs, rhs, tags=None, **kwargs):
1175
+ def __init__(self, lhs, rhs, **kwargs):
1209
1176
  super().__init__(**kwargs)
1210
1177
 
1211
1178
  self.lhs = lhs
1212
1179
  self.rhs = rhs
1213
- self.tags = tags
1214
1180
 
1215
1181
  def c_repr_chunks(self, indent=0, asexpr=False):
1216
1182
  indent_str = self.indent_str(indent=indent)
@@ -1278,7 +1244,6 @@ class CFunctionCall(CStatement, CExpression):
1278
1244
  "returning",
1279
1245
  "show_demangled_name",
1280
1246
  "show_disambiguated_name",
1281
- "tags",
1282
1247
  )
1283
1248
 
1284
1249
  def __init__(
@@ -1288,20 +1253,21 @@ class CFunctionCall(CStatement, CExpression):
1288
1253
  args,
1289
1254
  returning=True,
1290
1255
  ret_expr=None,
1291
- tags=None,
1292
1256
  is_expr: bool = False,
1293
1257
  show_demangled_name=True,
1294
1258
  show_disambiguated_name: bool = True,
1259
+ tags=None,
1260
+ codegen=None,
1295
1261
  **kwargs,
1296
1262
  ):
1297
- super().__init__(**kwargs)
1263
+ super().__init__(tags=tags, codegen=codegen, **kwargs)
1264
+ CConstruct.__init__(self, tags=tags, codegen=codegen)
1298
1265
 
1299
1266
  self.callee_target = callee_target
1300
1267
  self.callee_func: Function | None = callee_func
1301
1268
  self.args = args if args is not None else []
1302
1269
  self.returning = returning
1303
1270
  self.ret_expr = ret_expr
1304
- self.tags = tags
1305
1271
  self.is_expr = is_expr
1306
1272
  self.show_demangled_name = show_demangled_name
1307
1273
  self.show_disambiguated_name = show_disambiguated_name
@@ -1390,16 +1356,12 @@ class CFunctionCall(CStatement, CExpression):
1390
1356
 
1391
1357
 
1392
1358
  class CReturn(CStatement):
1393
- __slots__ = (
1394
- "retval",
1395
- "tags",
1396
- )
1359
+ __slots__ = ("retval",)
1397
1360
 
1398
- def __init__(self, retval, tags=None, **kwargs):
1361
+ def __init__(self, retval, **kwargs):
1399
1362
  super().__init__(**kwargs)
1400
1363
 
1401
1364
  self.retval = retval
1402
- self.tags = tags
1403
1365
 
1404
1366
  def c_repr_chunks(self, indent=0, asexpr=False):
1405
1367
  indent_str = self.indent_str(indent=indent)
@@ -1416,12 +1378,11 @@ class CReturn(CStatement):
1416
1378
 
1417
1379
  class CGoto(CStatement):
1418
1380
  __slots__ = (
1419
- "tags",
1420
1381
  "target",
1421
1382
  "target_idx",
1422
1383
  )
1423
1384
 
1424
- def __init__(self, target, target_idx, tags=None, **kwargs):
1385
+ def __init__(self, target, target_idx, **kwargs):
1425
1386
  super().__init__(**kwargs)
1426
1387
 
1427
1388
  if isinstance(target, CConstant):
@@ -1430,7 +1391,6 @@ class CGoto(CStatement):
1430
1391
 
1431
1392
  self.target: int | CExpression = target
1432
1393
  self.target_idx = target_idx
1433
- self.tags = tags
1434
1394
 
1435
1395
  def c_repr_chunks(self, indent=0, asexpr=False):
1436
1396
  indent_str = self.indent_str(indent=indent)
@@ -1503,15 +1463,13 @@ class CLabel(CStatement):
1503
1463
  "block_idx",
1504
1464
  "ins_addr",
1505
1465
  "name",
1506
- "tags",
1507
1466
  )
1508
1467
 
1509
- def __init__(self, name: str, ins_addr: int, block_idx: int | None, tags=None, **kwargs):
1468
+ def __init__(self, name: str, ins_addr: int, block_idx: int | None, **kwargs):
1510
1469
  super().__init__(**kwargs)
1511
1470
  self.name = name
1512
1471
  self.ins_addr = ins_addr
1513
1472
  self.block_idx = block_idx
1514
- self.tags = tags
1515
1473
 
1516
1474
  def c_repr_chunks(self, indent=0, asexpr=False):
1517
1475
  # indent-_str = self.indent_str(indent=indent)
@@ -1526,16 +1484,14 @@ class CStructField(CExpression):
1526
1484
  "field",
1527
1485
  "offset",
1528
1486
  "struct_type",
1529
- "tags",
1530
1487
  )
1531
1488
 
1532
- def __init__(self, struct_type: SimStruct, offset, field, tags=None, **kwargs):
1489
+ def __init__(self, struct_type: SimStruct, offset, field, **kwargs):
1533
1490
  super().__init__(**kwargs)
1534
1491
 
1535
1492
  self.struct_type = struct_type
1536
1493
  self.offset = offset
1537
1494
  self.field = field
1538
- self.tags = tags
1539
1495
 
1540
1496
  @property
1541
1497
  def type(self):
@@ -1553,13 +1509,12 @@ class CFakeVariable(CExpression):
1553
1509
  An uninterpreted name to display in the decompilation output. Pretty much always represents an error?
1554
1510
  """
1555
1511
 
1556
- __slots__ = ("name", "tags")
1512
+ __slots__ = ("name",)
1557
1513
 
1558
- def __init__(self, name: str, ty: SimType, tags=None, **kwargs):
1514
+ def __init__(self, name: str, ty: SimType, **kwargs):
1559
1515
  super().__init__(**kwargs)
1560
1516
  self.name = name
1561
1517
  self._type = ty.with_arch(self.codegen.project.arch)
1562
- self.tags = tags
1563
1518
 
1564
1519
  @property
1565
1520
  def type(self):
@@ -1577,22 +1532,18 @@ class CVariable(CExpression):
1577
1532
  """
1578
1533
 
1579
1534
  __slots__ = (
1580
- "tags",
1581
1535
  "unified_variable",
1582
1536
  "variable",
1583
1537
  "variable_type",
1584
1538
  "vvar_id",
1585
1539
  )
1586
1540
 
1587
- def __init__(
1588
- self, variable: SimVariable, unified_variable=None, variable_type=None, tags=None, vvar_id=None, **kwargs
1589
- ):
1541
+ def __init__(self, variable: SimVariable, unified_variable=None, variable_type=None, vvar_id=None, **kwargs):
1590
1542
  super().__init__(**kwargs)
1591
1543
 
1592
1544
  self.variable: SimVariable = variable
1593
1545
  self.unified_variable: SimVariable | None = unified_variable
1594
1546
  self.variable_type: SimType = variable_type.with_arch(self.codegen.project.arch)
1595
- self.tags = tags
1596
1547
  self.vvar_id = vvar_id
1597
1548
 
1598
1549
  @property
@@ -1620,12 +1571,11 @@ class CIndexedVariable(CExpression):
1620
1571
  Represent a variable (an array) that is indexed.
1621
1572
  """
1622
1573
 
1623
- def __init__(self, variable: CExpression, index: CExpression, variable_type=None, tags=None, **kwargs):
1574
+ def __init__(self, variable: CExpression, index: CExpression, variable_type=None, **kwargs):
1624
1575
  super().__init__(**kwargs)
1625
1576
  self.variable = variable
1626
1577
  self.index: CExpression = index
1627
1578
  self._type = variable_type
1628
- self.tags = tags
1629
1579
 
1630
1580
  if self._type is None and self.variable.type is not None:
1631
1581
  u = unpack_typeref(self.variable.type)
@@ -1665,12 +1615,11 @@ class CVariableField(CExpression):
1665
1615
  Represent a field of a variable.
1666
1616
  """
1667
1617
 
1668
- def __init__(self, variable: CExpression, field: CStructField, var_is_ptr: bool = False, tags=None, **kwargs):
1618
+ def __init__(self, variable: CExpression, field: CStructField, var_is_ptr: bool = False, **kwargs):
1669
1619
  super().__init__(**kwargs)
1670
1620
  self.variable = variable
1671
1621
  self.field = field
1672
1622
  self.var_is_ptr = var_is_ptr
1673
- self.tags = tags
1674
1623
 
1675
1624
  @property
1676
1625
  def type(self):
@@ -1696,15 +1645,13 @@ class CUnaryOp(CExpression):
1696
1645
  __slots__ = (
1697
1646
  "op",
1698
1647
  "operand",
1699
- "tags",
1700
1648
  )
1701
1649
 
1702
- def __init__(self, op, operand: CExpression, tags=None, **kwargs):
1650
+ def __init__(self, op, operand: CExpression, **kwargs):
1703
1651
  super().__init__(**kwargs)
1704
1652
 
1705
1653
  self.op = op
1706
1654
  self.operand = operand
1707
- self.tags = tags
1708
1655
 
1709
1656
  if operand.type is not None:
1710
1657
  var_type = unpack_typeref(operand.type)
@@ -1791,15 +1738,14 @@ class CBinaryOp(CExpression):
1791
1738
  Binary operations.
1792
1739
  """
1793
1740
 
1794
- __slots__ = ("_cstyle_null_cmp", "common_type", "lhs", "op", "rhs", "tags")
1741
+ __slots__ = ("_cstyle_null_cmp", "common_type", "lhs", "op", "rhs")
1795
1742
 
1796
- def __init__(self, op, lhs, rhs, tags: dict | None = None, **kwargs):
1743
+ def __init__(self, op, lhs, rhs, **kwargs):
1797
1744
  super().__init__(**kwargs)
1798
1745
 
1799
1746
  self.op = op
1800
1747
  self.lhs = lhs
1801
1748
  self.rhs = rhs
1802
- self.tags = tags
1803
1749
  self._cstyle_null_cmp = self.codegen.cstyle_null_cmp
1804
1750
 
1805
1751
  self.common_type = self.compute_common_type(self.op, self.lhs.type, self.rhs.type)
@@ -2066,16 +2012,14 @@ class CTypeCast(CExpression):
2066
2012
  "dst_type",
2067
2013
  "expr",
2068
2014
  "src_type",
2069
- "tags",
2070
2015
  )
2071
2016
 
2072
- def __init__(self, src_type: SimType | None, dst_type: SimType, expr: CExpression, tags=None, **kwargs):
2017
+ def __init__(self, src_type: SimType | None, dst_type: SimType, expr: CExpression, **kwargs):
2073
2018
  super().__init__(**kwargs)
2074
2019
 
2075
2020
  self.src_type = (src_type or expr.type).with_arch(self.codegen.project.arch)
2076
2021
  self.dst_type = dst_type.with_arch(self.codegen.project.arch)
2077
2022
  self.expr = expr
2078
- self.tags = tags
2079
2023
 
2080
2024
  @property
2081
2025
  def type(self):
@@ -2106,17 +2050,15 @@ class CTypeCast(CExpression):
2106
2050
  class CConstant(CExpression):
2107
2051
  __slots__ = (
2108
2052
  "reference_values",
2109
- "tags",
2110
2053
  "value",
2111
2054
  )
2112
2055
 
2113
- def __init__(self, value, type_: SimType, reference_values=None, tags: dict | None = None, **kwargs):
2056
+ def __init__(self, value, type_: SimType, reference_values=None, **kwargs):
2114
2057
  super().__init__(**kwargs)
2115
2058
 
2116
2059
  self.value = value
2117
2060
  self._type = type_.with_arch(self.codegen.project.arch)
2118
2061
  self.reference_values = reference_values
2119
- self.tags = tags
2120
2062
 
2121
2063
  @property
2122
2064
  def _ident(self):
@@ -2304,16 +2246,12 @@ class CConstant(CExpression):
2304
2246
 
2305
2247
 
2306
2248
  class CRegister(CExpression):
2307
- __slots__ = (
2308
- "reg",
2309
- "tags",
2310
- )
2249
+ __slots__ = ("reg",)
2311
2250
 
2312
- def __init__(self, reg, tags=None, **kwargs):
2251
+ def __init__(self, reg, **kwargs):
2313
2252
  super().__init__(**kwargs)
2314
2253
 
2315
2254
  self.reg = reg
2316
- self.tags = tags
2317
2255
 
2318
2256
  @property
2319
2257
  def type(self):
@@ -2329,15 +2267,13 @@ class CITE(CExpression):
2329
2267
  "cond",
2330
2268
  "iffalse",
2331
2269
  "iftrue",
2332
- "tags",
2333
2270
  )
2334
2271
 
2335
- def __init__(self, cond, iftrue, iffalse, tags=None, **kwargs):
2272
+ def __init__(self, cond, iftrue, iffalse, **kwargs):
2336
2273
  super().__init__(**kwargs)
2337
2274
  self.cond = cond
2338
2275
  self.iftrue = iftrue
2339
2276
  self.iffalse = iffalse
2340
- self.tags = tags
2341
2277
 
2342
2278
  @property
2343
2279
  def type(self):
@@ -2362,13 +2298,15 @@ class CMultiStatementExpression(CExpression):
2362
2298
  (stmt0, stmt1, stmt2, expr)
2363
2299
  """
2364
2300
 
2365
- __slots__ = ("expr", "stmts", "tags")
2301
+ __slots__ = (
2302
+ "expr",
2303
+ "stmts",
2304
+ )
2366
2305
 
2367
- def __init__(self, stmts: CStatements, expr: CExpression, tags=None, **kwargs):
2306
+ def __init__(self, stmts: CStatements, expr: CExpression, **kwargs):
2368
2307
  super().__init__(**kwargs)
2369
2308
  self.stmts = stmts
2370
2309
  self.expr = expr
2371
- self.tags = tags
2372
2310
 
2373
2311
  @property
2374
2312
  def type(self):
@@ -2390,14 +2328,12 @@ class CVEXCCallExpression(CExpression):
2390
2328
  __slots__ = (
2391
2329
  "callee",
2392
2330
  "operands",
2393
- "tags",
2394
2331
  )
2395
2332
 
2396
- def __init__(self, callee: str, operands: list[CExpression], tags=None, **kwargs):
2333
+ def __init__(self, callee: str, operands: list[CExpression], **kwargs):
2397
2334
  super().__init__(**kwargs)
2398
2335
  self.callee = callee
2399
2336
  self.operands = operands
2400
- self.tags = tags
2401
2337
 
2402
2338
  @property
2403
2339
  def type(self):
@@ -3967,7 +3903,7 @@ class PointerArithmeticFixer(CStructuredCodeWalker):
3967
3903
  )
3968
3904
  else:
3969
3905
  op = "Add"
3970
- return CBinaryOp(op, out.operand.variable, const, out.operand.tags, codegen=out.codegen)
3906
+ return CBinaryOp(op, out.operand.variable, const, tags=out.operand.tags, codegen=out.codegen)
3971
3907
  return out
3972
3908
  return obj
3973
3909