mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-3952 Updated the script categories to simplify and reduce the number of folders.
This commit is contained in:
parent
7772d98143
commit
7db176b2bd
82 changed files with 885 additions and 981 deletions
|
@ -1,13 +1,12 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -15,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
//Removes any offcut references to the current code unit.
|
||||
//@category References
|
||||
//@category
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -29,38 +28,38 @@ public class RemoveOffcutReferenceToCurrentInstructionScript extends GhidraScrip
|
|||
|
||||
Instruction instruction = getInstructionAt(currentAddress);
|
||||
|
||||
if ( instruction != null ) {
|
||||
removeReferences( instruction );
|
||||
if (instruction != null) {
|
||||
removeReferences(instruction);
|
||||
}
|
||||
|
||||
Data data = getDataAt(currentAddress);
|
||||
|
||||
if ( data != null ) {
|
||||
removeReferences( data );
|
||||
if (data != null) {
|
||||
removeReferences(data);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeReferences(CodeUnit codeUnit) {
|
||||
Address address = currentAddress.add( 1 );
|
||||
Address address = currentAddress.add(1);
|
||||
|
||||
while ( address.compareTo( codeUnit.getMaxAddress() ) <= 0) {
|
||||
while (address.compareTo(codeUnit.getMaxAddress()) <= 0) {
|
||||
|
||||
if ( monitor.isCancelled() ) {
|
||||
if (monitor.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference [] referencesTo = getReferencesTo(address);
|
||||
Reference[] referencesTo = getReferencesTo(address);
|
||||
|
||||
for ( Reference reference : referencesTo ) {
|
||||
for (Reference reference : referencesTo) {
|
||||
|
||||
if ( monitor.isCancelled() ) {
|
||||
if (monitor.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
|
||||
removeReference(reference);
|
||||
}
|
||||
|
||||
address = address.add( 1 );
|
||||
address = address.add(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue