-
Notifications
You must be signed in to change notification settings - Fork 53
Examples | Exporting and Importing Notations from the Database
Ali Rizvi-Santiago edited this page Nov 18, 2022
·
3 revisions
This is the same as the tools.tags.export()
function.
savegame = {}
for ea, content in db.select(): # db.select queries the index which contains only "your" notations
savegame[ea] = content
savegame2 = {}
for funcea in db.functions(): # use db.selectcontents(), if you only want functions you've touched
f = {}
for ea, content in func.select(ea): # use func.iterate() if you just want __everything__
f[ea] = content
fr = {}
for m, content in func.frame(ea).select(): # for just __all__ the members, just use func.frame(ea) w/o the .select()
fr[m.offset] = content
savegame2[funcea] = f, fr
# send them all to another process
import pickle
mysavegame = pickle.dumps((savegame, savegame2))
socket.send(mysavegame)
This is the same as tools.tags.apply()
function.
If you're working with a fresh database, make sure to copy your function boundaries as well so the addresses line up.
(hint: use function.chunks
to grab them, and function.chunk.top
or function.chunk.bottom
to modify them. New functions can be created with function.new
)
for f, content in savegame2.items():
for ea, tags in content.items():
for k, v in tags.items():
db.tag(ea, k, v)
continue
continue
for ea, tags in savegame.items():
if function.within(ea):
[func.tag(ea, k, v) for k, v in tags.items()]
else:
[database.tag(ea, k, v) for k, v in tags.items()]
continue
|