mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-29 22:35:38 +08:00
GP-1956 update metadata on set language
This commit is contained in:
@@ -15,12 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
// Reloads the language specification associated with a program at runtime.
|
// Reloads the language specification associated with a program at runtime.
|
||||||
// @category sleigh
|
// @category sleigh
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.program.model.lang.Language;
|
import ghidra.program.model.lang.Language;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ReloadSleighLangauge extends GhidraScript {
|
public class ReloadSleighLangauge extends GhidraScript {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -37,7 +37,6 @@ public class ReloadSleighLangauge extends GhidraScript {
|
|||||||
e.getMessage());
|
e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentProgram.setLanguage(language, currentProgram.getCompilerSpec().getCompilerSpecID(),
|
currentProgram.setLanguage(language, null, true, monitor);
|
||||||
true, monitor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-8
@@ -1903,15 +1903,22 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||||||
throws IllegalStateException, IncompatibleLanguageException, LockException {
|
throws IllegalStateException, IncompatibleLanguageException, LockException {
|
||||||
if (newLanguage == language) {
|
if (newLanguage == language) {
|
||||||
setLanguage((LanguageTranslator) null, newCompilerSpecID, forceRedisassembly, monitor);
|
setLanguage((LanguageTranslator) null, newCompilerSpecID, forceRedisassembly, monitor);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
LanguageTranslator languageTranslator =
|
else {
|
||||||
LanguageTranslatorFactory.getLanguageTranslatorFactory()
|
LanguageTranslator languageTranslator =
|
||||||
.getLanguageTranslator(language, newLanguage);
|
LanguageTranslatorFactory.getLanguageTranslatorFactory()
|
||||||
if (languageTranslator == null) {
|
.getLanguageTranslator(language, newLanguage);
|
||||||
throw new IncompatibleLanguageException("Language translation not supported");
|
if (languageTranslator == null) {
|
||||||
|
throw new IncompatibleLanguageException("Language translation not supported");
|
||||||
|
}
|
||||||
|
setLanguage(languageTranslator, newCompilerSpecID, forceRedisassembly, monitor);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
updateMetadata();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
dbError(e);
|
||||||
}
|
}
|
||||||
setLanguage(languageTranslator, newCompilerSpecID, forceRedisassembly, monitor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1922,7 +1929,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||||||
* @param monitor task monitor
|
* @param monitor task monitor
|
||||||
* @throws LockException if exclusive access is missing
|
* @throws LockException if exclusive access is missing
|
||||||
*/
|
*/
|
||||||
public void setLanguage(LanguageTranslator translator, CompilerSpecID newCompilerSpecID,
|
private void setLanguage(LanguageTranslator translator, CompilerSpecID newCompilerSpecID,
|
||||||
boolean forceRedisassembly, TaskMonitor monitor) throws LockException {
|
boolean forceRedisassembly, TaskMonitor monitor) throws LockException {
|
||||||
|
|
||||||
checkExclusiveAccess();
|
checkExclusiveAccess();
|
||||||
|
|||||||
Reference in New Issue
Block a user