Skip to content

Catch exception when there is memory overlap #6

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kost-div
Copy link

Currently, when there is memory overlap in memory ranges, it fails with following exception:

Loading SVD file...
        Done!
Generating memory regions...
Traceback (most recent call last):
  File "/opt/ghidra-scripts/SVD-Loader-Ghidra/SVD-Loader.py", line 113, in <module>
    t = currentProgram.memory.createUninitializedBlock(r.name, addr, length, False)
  File "/opt/ghidra-scripts/SVD-Loader-Ghidra/SVD-Loader.py", line 113, in <module>
    t = currentProgram.memory.createUninitializedBlock(r.name, addr, length, False)
        at ghidra.program.database.mem.MemoryMapDB.checkRange(MemoryMapDB.java:1864)
        at ghidra.program.database.mem.MemoryMapDB.createUninitializedBlock(MemoryMapDB.java:611)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
ghidra.program.model.mem.MemoryConflictException: ghidra.program.model.mem.MemoryConflictException: Part of range (40023000, 400233ff) already exists in memory.
SVD-Loader.py> Finished!

So, clearly general exception block do not catch specific exception for memory overlap.

Fix catch correct exception and displays the following:

  Loading SVD file...
	Done!
Generating memory regions...
	Failed to generate due to conflict in memory block for: CRC
('\t', ghidra.program.model.mem.MemoryConflictException: Part of range (40023000, 400233ff) already exists in memory.)

Hope it helps and thanks for the SVD loader!

@rpavlik rpavlik mentioned this pull request Feb 21, 2021
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

Successfully merging this pull request may close these issues.

1 participant