mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 01:39:21 +02:00
Compare commits
5 commits
8fad5fc01d
...
bc6701a24d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bc6701a24d | ||
![]() |
0613d364fc | ||
![]() |
deddc84205 | ||
![]() |
221939c0a9 | ||
![]() |
48754fb98d |
3 changed files with 14 additions and 10 deletions
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -1606,14 +1606,13 @@ public class ElfHeader implements StructConverter {
|
||||||
* @return the section header that contains the address
|
* @return the section header that contains the address
|
||||||
*/
|
*/
|
||||||
public ElfSectionHeader getSectionLoadHeaderContaining(long address) {
|
public ElfSectionHeader getSectionLoadHeaderContaining(long address) {
|
||||||
// FIXME: verify
|
|
||||||
for (ElfSectionHeader sectionHeader : sectionHeaders) {
|
for (ElfSectionHeader sectionHeader : sectionHeaders) {
|
||||||
if (!sectionHeader.isAlloc()) {
|
if (!sectionHeader.isAlloc()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
long start = sectionHeader.getAddress();
|
long start = sectionHeader.getAddress();
|
||||||
long end = start + sectionHeader.getSize();
|
long end = start + sectionHeader.getSize();
|
||||||
if (start <= address && address <= end) {
|
if (start <= address && address < end) {
|
||||||
return sectionHeader;
|
return sectionHeader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,9 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to signal that the updateManager has finished loading the final contents gathered
|
* Used to signal that the updateManager has finished loading the final contents gathered
|
||||||
* by this job. By default, the value is 0, which means there is nothing to wait for. If we
|
* by this job. This is also updated if this job is cancelled.
|
||||||
* flush, this will be set to 1.
|
|
||||||
*/
|
*/
|
||||||
private volatile CountDownLatch completedCallbackLatch = new CountDownLatch(0);
|
private volatile CountDownLatch completedCallbackLatch = new CountDownLatch(1);
|
||||||
private volatile boolean isCancelled = false;
|
private volatile boolean isCancelled = false;
|
||||||
private volatile IncrementalUpdatingAccumulator incrementalAccumulator;
|
private volatile IncrementalUpdatingAccumulator incrementalAccumulator;
|
||||||
|
|
||||||
|
@ -140,14 +139,19 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||||
// -We release the lock
|
// -We release the lock
|
||||||
// -A block on jobDone() can now complete as we release the lock
|
// -A block on jobDone() can now complete as we release the lock
|
||||||
// -jobDone() will notify listeners in an invokeLater(), which puts it behind ours
|
// -jobDone() will notify listeners in an invokeLater(), which puts it behind ours
|
||||||
//
|
//
|
||||||
completedCallbackLatch = new CountDownLatch(1);
|
|
||||||
Swing.runLater(() -> updateManager.addThreadedTableListener(IncrementalLoadJob.this));
|
Swing.runLater(() -> updateManager.addThreadedTableListener(IncrementalLoadJob.this));
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForThreadedTableUpdateManagerToFinish();
|
waitForThreadedTableUpdateManagerToFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for the final flushed data to be added to the table. We will get called when the data
|
||||||
|
* is finished loading or cancelled. The latch will also be released if the cancel method of
|
||||||
|
* this job is called. This can happen if the work queue is told to cancel all jobs, which can
|
||||||
|
* happen if a new reload job is requested.
|
||||||
|
*/
|
||||||
private void waitForThreadedTableUpdateManagerToFinish() {
|
private void waitForThreadedTableUpdateManagerToFinish() {
|
||||||
try {
|
try {
|
||||||
completedCallbackLatch.await();
|
completedCallbackLatch.await();
|
||||||
|
@ -179,6 +183,7 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||||
super.cancel();
|
super.cancel();
|
||||||
isCancelled = true;
|
isCancelled = true;
|
||||||
incrementalAccumulator.cancel();
|
incrementalAccumulator.cancel();
|
||||||
|
completedCallbackLatch.countDown();
|
||||||
|
|
||||||
// Note: cannot do this here, since the cancel() call may happen asynchronously and after
|
// Note: cannot do this here, since the cancel() call may happen asynchronously and after
|
||||||
// a call to reload() on the table model. Assume that the model itself has already
|
// a call to reload() on the table model. Assume that the model itself has already
|
||||||
|
|
|
@ -203,7 +203,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelCurrentWorkerJob() {
|
private void cancelCurrentWorkerJob() {
|
||||||
if (worker != null && worker.isBusy()) {
|
if (worker != null) {
|
||||||
worker.clearAllJobsWithInterrupt_IKnowTheRisks();
|
worker.clearAllJobsWithInterrupt_IKnowTheRisks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue