Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 3 #8

Open
kerneltea opened this issue Sep 26, 2021 · 2 comments
Open

KeyError: 3 #8

kerneltea opened this issue Sep 26, 2021 · 2 comments

Comments

@kerneltea
Copy link

Hello,

I am trying to use Darter on a libapp.so extracted (unzipped) from a .APK generated by flutter from a Flutter app,
Encountered the following problem

Traceback (most recent call last):
File "/Users/realcradle/dev/python/disassembly/main.py", line 110, in
getFiles('samples/libapp.so', '')
File "/Users/realcradle/dev/python/disassembly/main.py", line 91, in getFiles
s = parse_elf_snapshot(elfFile)
File "/Users/realcradle/dev/python/disassembly/darter/file.py", line 42, in parse_elf_snapshot
base = Snapshot(data=blobs[0], data_offset=offsets[0],
File "/Users/realcradle/dev/python/disassembly/darter/core.py", line 232, in parse
self.initialize_clusters()
File "/Users/realcradle/dev/python/disassembly/darter/core.py", line 374, in initialize_clusters
key = map1[self.kind]
KeyError: 3

image

image

@mildsunrise
Copy link
Owner

oh, there's a new kind of snapshot? sorry, I've been disconnected from dart development for a while

@mildsunrise
Copy link
Owner

yes, it seems they added a new kFullCore kind of snapshot, in dart-lang/sdk@d77fff7?branch=d77fff73075426306d2c3d77ccf61afd3eba9ab1, but they added it at the start so kFullAOT snapshots now have the number 3 rather than 2.

I should fix that but I have no time to get this project up to date, sorry.
You can fix the code for your version, by changing:

kKind = [
('kFull', "Full snapshot of core libraries or an application"),
('kFullJIT', "Full + JIT code"),
('kFullAOT', "Full + AOT code"),
('kMessage', "A partial snapshot used only for isolate messaging"),
('kNone', "gen_snapshot"),
('kInvalid', None),
]

to

kKind = [
    ('kFull', "Full snapshot of an application"),
    ('kFullCore', "Full snapshot of core libraries. Agnostic to null safety."),
    ('kFullJIT', "Full + JIT code"),
    ('kFullAOT', "Full + AOT code"),
    ('kMessage', "A partial snapshot used only for isolate messaging"),
    ('kNone', "gen_snapshot"),
    ('kInvalid', None),
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants