mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Merge remote-tracking branch
'origin/GP-5866_caheckman_PR-4864_astrelsky_renameglobal' (Closes #4864, Closes #8121)
This commit is contained in:
commit
0348223d62
1 changed files with 8 additions and 3 deletions
|
@ -73,6 +73,7 @@ public class RenameGlobalAction extends AbstractDecompilerAction {
|
||||||
final ClangToken tokenAtCursor = context.getTokenAtCursor();
|
final ClangToken tokenAtCursor = context.getTokenAtCursor();
|
||||||
HighSymbol highSymbol = tokenAtCursor.getHighSymbol(context.getHighFunction());
|
HighSymbol highSymbol = tokenAtCursor.getHighSymbol(context.getHighFunction());
|
||||||
Symbol symbol = null;
|
Symbol symbol = null;
|
||||||
|
AddEditDialog dialog = new AddEditDialog("Rename Global", context.getTool());
|
||||||
if (highSymbol instanceof HighCodeSymbol) {
|
if (highSymbol instanceof HighCodeSymbol) {
|
||||||
symbol = ((HighCodeSymbol) highSymbol).getCodeSymbol();
|
symbol = ((HighCodeSymbol) highSymbol).getCodeSymbol();
|
||||||
if (symbol == null) {
|
if (symbol == null) {
|
||||||
|
@ -80,6 +81,11 @@ public class RenameGlobalAction extends AbstractDecompilerAction {
|
||||||
Address addr = ((HighCodeSymbol) highSymbol).getStorage().getMinAddress();
|
Address addr = ((HighCodeSymbol) highSymbol).getStorage().getMinAddress();
|
||||||
SymbolTable symbolTable = context.getProgram().getSymbolTable();
|
SymbolTable symbolTable = context.getProgram().getSymbolTable();
|
||||||
symbol = symbolTable.getPrimarySymbol(addr);
|
symbol = symbolTable.getPrimarySymbol(addr);
|
||||||
|
if (symbol == null) {
|
||||||
|
// there may be no default primary symbol when it is an offcut reference
|
||||||
|
dialog.addLabel(addr, context.getProgram());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (symbol == null) {
|
if (symbol == null) {
|
||||||
|
@ -87,7 +93,6 @@ public class RenameGlobalAction extends AbstractDecompilerAction {
|
||||||
"Memory storage not found for global variable");
|
"Memory storage not found for global variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AddEditDialog dialog = new AddEditDialog("Rename Global", context.getTool());
|
|
||||||
dialog.editLabel(symbol, context.getProgram());
|
dialog.editLabel(symbol, context.getProgram());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue