Makefile.examples: Add makefile to build example.c for various archs.
[ScratchABit.git] / idc.py
blobe5ccdeb9bbd77469fb9bb900fda36596fe69e303
1 # ScratchABit - interactive disassembler
3 # Copyright (c) 2015 Paul Sokolovsky
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 from scratchabit import engine
18 import idaapi
21 SEGATTR_PERM = 1
24 def GetSegmentAttr(ea, attr):
25 assert attr == SEGATTR_PERM
26 off, area = engine.ADDRESS_SPACE.addr2area(addr)
27 props = engine.area_props(area)
28 ret = 0
29 if "R" in props:
30 ret |= idaapi.SEGPERM_READ
31 if "W" in props:
32 ret |= idaapi.SEGPERM_WRITE
33 if "X" in props:
34 ret |= idaapi.SEGPERM_EXEC
37 # Make filler
38 def MakeAlign(ea, cnt, align):
39 engine.ADDRESS_SPACE.make_filler(ea, cnt)