@@ -644,9 +644,7 @@ class idc:
644644 SEGPERM_READ = 4 # Read
645645 SEGPERM_MAXVAL = 7 # (SEGPERM_EXEC + SEGPERM_WRITE + SEGPERM_READ)
646646
647- SFL_COMORG = (
648- 0x01 # IDP dependent field (IBM PC: if set, ORG directive is not commented out)
649- )
647+ SFL_COMORG = 0x01 # IDP dependent field (IBM PC: if set, ORG directive is not commented out)
650648 SFL_OBOK = 0x02 # orgbase is present? (IDP dependent field)
651649 SFL_HIDDEN = 0x04 # is the segment hidden?
652650 SFL_DEBUG = 0x08 # is the segment created for the debugger?
@@ -844,9 +842,7 @@ def GetSegmentAttr(self, ea, attr):
844842 elif attr == self .SEGATTR_COLOR :
845843 return self ._get_segment (ea ).color
846844 else :
847- raise NotImplementedError (
848- "segment attribute %d not yet implemented" % (attr )
849- )
845+ raise NotImplementedError ("segment attribute %d not yet implemented" % (attr ))
850846
851847 def MinEA (self ):
852848 segs = idb .analysis .Segments (self .idb ).segments .values ()
@@ -885,9 +881,7 @@ def ItemSize(self, ea):
885881 def NextHead (self , ea ):
886882 ea += 1
887883 flags = self .GetFlags (ea )
888- while (
889- flags is not None and flags != 0 and not self .api .ida_bytes .is_head (flags )
890- ):
884+ while flags is not None and flags != 0 and not self .api .ida_bytes .is_head (flags ):
891885 ea += 1
892886 # TODO: handle Index/KeyError here when we overrun a segment
893887 flags = self .GetFlags (ea )
@@ -1030,20 +1024,13 @@ def _disassemble(self, ea):
10301024 )
10311025 elif procname == "sparcb" :
10321026 if bitness == 32 :
1033- dis = self ._load_dis (
1034- capstone .CS_ARCH_SPARC , capstone .CS_MODE_BIG_ENDIAN
1035- )
1027+ dis = self ._load_dis (capstone .CS_ARCH_SPARC , capstone .CS_MODE_BIG_ENDIAN )
10361028 elif procname == "sparcl" :
10371029 if bitness == 32 :
1038- dis = self ._load_dis (
1039- capstone .CS_ARCH_SPARC , capstone .CS_MODE_LITTLE_ENDIAN
1040- )
1030+ dis = self ._load_dis (capstone .CS_ARCH_SPARC , capstone .CS_MODE_LITTLE_ENDIAN )
10411031
10421032 if dis is None :
1043- raise NotImplementedError (
1044- "unknown arch %s bit:%s inst_len:%d"
1045- % (procname , bitness , len (inst_buf ))
1046- )
1033+ raise NotImplementedError ("unknown arch %s bit:%s inst_len:%d" % (procname , bitness , len (inst_buf )))
10471034 dis .detail = True
10481035
10491036 try :
@@ -1294,22 +1281,12 @@ def isCustFmt1(flags):
12941281 @staticmethod
12951282 def isNum0 (flags ):
12961283 t = flags & FLAGS .MS_0TYPE
1297- return (
1298- t == FLAGS .FF_0NUMB
1299- or t == FLAGS .FF_0NUMO
1300- or t == FLAGS .FF_0NUMD
1301- or t == FLAGS .FF_0NUMH
1302- )
1284+ return t == FLAGS .FF_0NUMB or t == FLAGS .FF_0NUMO or t == FLAGS .FF_0NUMD or t == FLAGS .FF_0NUMH
13031285
13041286 @staticmethod
13051287 def isNum1 (flags ):
13061288 t = flags & FLAGS .MS_1TYPE
1307- return (
1308- t == FLAGS .FF_1NUMB
1309- or t == FLAGS .FF_1NUMO
1310- or t == FLAGS .FF_1NUMD
1311- or t == FLAGS .FF_1NUMH
1312- )
1289+ return t == FLAGS .FF_1NUMB or t == FLAGS .FF_1NUMO or t == FLAGS .FF_1NUMD or t == FLAGS .FF_1NUMH
13131290
13141291 @staticmethod
13151292 def get_optype_flags0 (flags ):
@@ -1529,11 +1506,7 @@ def next_inited(self, ea, maxea):
15291506 def get_item_end (self , ea ):
15301507 ea += 1
15311508 flags = self .api .idc .GetFlags (ea )
1532- while (
1533- flags is not None
1534- and not self .api .ida_bytes .is_head (flags )
1535- and self .api .idc .SegEnd (ea )
1536- ):
1509+ while flags is not None and not self .api .ida_bytes .is_head (flags ) and self .api .idc .SegEnd (ea ):
15371510 ea += 1
15381511 flags = self .api .idc .GetFlags (ea )
15391512 return ea
@@ -1919,11 +1892,7 @@ def _find_bb_end(self, ea):
19191892 Returns:
19201893 int: the address of the final instruction in the basic block. it may be the same as the start.
19211894 """
1922- if not is_empty (
1923- idb .analysis .get_crefs_from (
1924- self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]
1925- )
1926- ):
1895+ if not is_empty (idb .analysis .get_crefs_from (self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ])):
19271896 return ea
19281897
19291898 if not self .api .idc .GetFlags (ea ):
@@ -1946,11 +1915,7 @@ def _find_bb_end(self, ea):
19461915 if not self .api .ida_bytes .is_flow (flags ):
19471916 return last_ea
19481917
1949- if not is_empty (
1950- idb .analysis .get_crefs_from (
1951- self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]
1952- )
1953- ):
1918+ if not is_empty (idb .analysis .get_crefs_from (self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ])):
19541919 return ea
19551920
19561921 def _find_bb_start (self , ea ):
@@ -1972,11 +1937,7 @@ def _find_bb_start(self, ea):
19721937 last_ea = ea
19731938 ea = self .api .idc .PrevHead (ea )
19741939
1975- if not is_empty (
1976- idb .analysis .get_crefs_from (
1977- self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]
1978- )
1979- ):
1940+ if not is_empty (idb .analysis .get_crefs_from (self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ])):
19801941 return last_ea
19811942
19821943 if not self .api .ida_bytes .is_flow (flags ):
@@ -1993,9 +1954,7 @@ def _get_flow_preds(self, ea):
19931954
19941955 # get all the flow xrefs to this instruction.
19951956 # a flow xref is like a fallthrough or jump, not like a call.
1996- for xref in idb .analysis .get_crefs_to (
1997- self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]
1998- ):
1957+ for xref in idb .analysis .get_crefs_to (self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]):
19991958 yield xref
20001959
20011960 def _get_flow_succs (self , ea ):
@@ -2010,9 +1969,7 @@ def _get_flow_succs(self, ea):
20101969
20111970 # get all the flow xrefs from this instruction.
20121971 # a flow xref is like a fallthrough or jump, not like a call.
2013- for xref in idb .analysis .get_crefs_from (
2014- self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]
2015- ):
1972+ for xref in idb .analysis .get_crefs_from (self .idb , ea , types = [idaapi .fl_JN , idaapi .fl_JF , idaapi .fl_F ]):
20161973 yield xref
20171974
20181975 def FlowChart (self , func ):
@@ -2083,9 +2040,7 @@ def __init__(self, db, api, ea):
20832040 for xref in api .idaapi ._get_flow_preds (block .startEA ):
20842041 if xref .frm not in bbs_by_end :
20852042 pred_start = api .idaapi ._find_bb_start (xref .frm )
2086- pred = BasicBlock (
2087- self , pred_start , xref .frm , api .idc .NextHead (xref .frm )
2088- )
2043+ pred = BasicBlock (self , pred_start , xref .frm , api .idc .NextHead (xref .frm ))
20892044 bbs_by_start [pred .startEA ] = pred
20902045 bbs_by_end [pred .lastInstEA ] = pred
20912046 else :
@@ -2100,9 +2055,7 @@ def __init__(self, db, api, ea):
21002055 for xref in api .idaapi ._get_flow_succs (block .lastInstEA ):
21012056 if xref .to not in bbs_by_start :
21022057 succ_end = api .idaapi ._find_bb_end (xref .to )
2103- succ = BasicBlock (
2104- self , xref .to , succ_end , api .idc .NextHead (succ_end )
2105- )
2058+ succ = BasicBlock (self , xref .to , succ_end , api .idc .NextHead (succ_end ))
21062059 bbs_by_start [succ .startEA ] = succ
21072060 bbs_by_end [succ .lastInstEA ] = succ
21082061 else :
@@ -2541,9 +2494,7 @@ def DataRefsFrom(self, ea):
25412494
25422495 # calls are not data references.
25432496 # global variables are data references.
2544- for xref in idb .analysis .get_drefs_from (
2545- self .idb , ea , types = self .ALL_DREF_TYPES
2546- ):
2497+ for xref in idb .analysis .get_drefs_from (self .idb , ea , types = self .ALL_DREF_TYPES ):
25472498 yield xref .to
25482499
25492500 def DataRefsTo (self , ea ):
@@ -2806,9 +2757,7 @@ def get_first_struc_idx(self):
28062757 return 0 if len (self ._struct_ids ) > 0 else self .api .idc .BADADDR
28072758
28082759 def get_last_struc_idx (self ):
2809- return (
2810- self ._struct_ids [- 1 ] if len (self ._struct_ids ) > 0 else self .api .idc .BADADDR
2811- )
2760+ return self ._struct_ids [- 1 ] if len (self ._struct_ids ) > 0 else self .api .idc .BADADDR
28122761
28132762 def get_struc (self , id ):
28142763 """Get pointer to struct type info."""
@@ -2859,9 +2808,7 @@ def get_ordinal_from_idb_type(self, name, _type):
28592808 if not _type or len (_type ) == 0 :
28602809 return - 1
28612810 typ = self .get_named_type (name )
2862- if self .get_base_flags (typ .type .base_type ) == self .get_base_flags (
2863- ord (_type [0 ])
2864- ):
2811+ if self .get_base_flags (typ .type .base_type ) == self .get_base_flags (ord (_type [0 ])):
28652812 return typ .ordinal
28662813 else :
28672814 return - 1
0 commit comments