Merge remote-tracking branch 'origin/patch'
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package agent.gdb.manager.impl;
|
package agent.gdb.manager.impl;
|
||||||
|
|
||||||
import static ghidra.async.AsyncUtils.loop;
|
import static ghidra.async.AsyncUtils.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -40,6 +40,7 @@ import ghidra.async.AsyncLock.Hold;
|
||||||
import ghidra.dbg.error.DebuggerModelTerminatingException;
|
import ghidra.dbg.error.DebuggerModelTerminatingException;
|
||||||
import ghidra.dbg.util.HandlerMap;
|
import ghidra.dbg.util.HandlerMap;
|
||||||
import ghidra.dbg.util.PrefixMap;
|
import ghidra.dbg.util.PrefixMap;
|
||||||
|
import ghidra.framework.Application;
|
||||||
import ghidra.lifecycle.Internal;
|
import ghidra.lifecycle.Internal;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.datastruct.ListenerSet;
|
import ghidra.util.datastruct.ListenerSet;
|
||||||
|
@ -71,22 +72,9 @@ public class GdbManagerImpl implements GdbManager {
|
||||||
CLI, MI2;
|
CLI, MI2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean LOG_IO = true |
|
private static final boolean LOG_IO =
|
||||||
Boolean.parseBoolean(System.getProperty("agent.gdb.manager.log"));
|
Boolean.getBoolean("agent.gdb.manager.log");
|
||||||
private static final PrintWriter DBG_LOG;
|
private static PrintWriter DBG_LOG = null;
|
||||||
static {
|
|
||||||
if (LOG_IO) {
|
|
||||||
try {
|
|
||||||
DBG_LOG = new PrintWriter(new FileOutputStream(new File("GDB.log")));
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException e) {
|
|
||||||
throw new AssertionError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DBG_LOG = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static final String PROMPT_GDB = "(gdb)";
|
private static final String PROMPT_GDB = "(gdb)";
|
||||||
public static final int INTERRUPT_MAX_RETRIES = 3;
|
public static final int INTERRUPT_MAX_RETRIES = 3;
|
||||||
public static final int INTERRUPT_RETRY_PERIOD_MILLIS = 100;
|
public static final int INTERRUPT_RETRY_PERIOD_MILLIS = 100;
|
||||||
|
@ -111,6 +99,9 @@ public class GdbManagerImpl implements GdbManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (LOG_IO && DBG_LOG == null) {
|
||||||
|
initLog();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String line;
|
String line;
|
||||||
while (isAlive() && null != (line = reader.readLine())) {
|
while (isAlive() && null != (line = reader.readLine())) {
|
||||||
|
@ -208,6 +199,20 @@ public class GdbManagerImpl implements GdbManager {
|
||||||
defaultHandlers();
|
defaultHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initLog() {
|
||||||
|
try {
|
||||||
|
File userSettings = Application.getUserSettingsDirectory();
|
||||||
|
File logFile = new File(userSettings, "GDB.log");
|
||||||
|
if (!logFile.canWrite()) {
|
||||||
|
throw new AssertionError(logFile.getPath() + " appears to be unwritable");
|
||||||
|
}
|
||||||
|
DBG_LOG = new PrintWriter(new FileOutputStream(logFile));
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CompletableFuture<Void> event(Runnable r, String text) {
|
CompletableFuture<Void> event(Runnable r, String text) {
|
||||||
//Msg.debug(this, "Queueing event: " + text);
|
//Msg.debug(this, "Queueing event: " + text);
|
||||||
return CompletableFuture.runAsync(r, eventThread).exceptionally(ex -> {
|
return CompletableFuture.runAsync(r, eventThread).exceptionally(ex -> {
|
||||||
|
|
|
@ -67,7 +67,35 @@ public class GdbModelTargetProcessMemory
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
regions =
|
regions =
|
||||||
byStart.values().stream().map(this::getTargetRegion).collect(Collectors.toList());
|
byStart.values().stream().map(this::getTargetRegion).collect(Collectors.toList());
|
||||||
|
if (regions.isEmpty()) {
|
||||||
|
Map<BigInteger, GdbMemoryMapping> defaultMap =
|
||||||
|
new HashMap<BigInteger, GdbMemoryMapping>();
|
||||||
|
AddressSet addressSet = impl.getAddressFactory().getAddressSet();
|
||||||
|
BigInteger start = addressSet.getMinAddress().getOffsetAsBigInteger();
|
||||||
|
BigInteger end = addressSet.getMaxAddress().getOffsetAsBigInteger();
|
||||||
|
if (end.longValue() < 0) {
|
||||||
|
BigInteger split = BigInteger.valueOf(Long.MAX_VALUE);
|
||||||
|
GdbMemoryMapping lmem = new GdbMemoryMapping(start, split,
|
||||||
|
split.subtract(start), start.subtract(start), "defaultLow");
|
||||||
|
defaultMap.put(start, lmem);
|
||||||
|
split = split.add(BigInteger.valueOf(1));
|
||||||
|
GdbMemoryMapping hmem = new GdbMemoryMapping(split, end,
|
||||||
|
end.subtract(split), split.subtract(split), "defaultHigh");
|
||||||
|
defaultMap.put(split, hmem);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
GdbMemoryMapping mem = new GdbMemoryMapping(start, end,
|
||||||
|
end.subtract(start), start.subtract(start), "default");
|
||||||
|
defaultMap.put(start, mem);
|
||||||
|
}
|
||||||
|
regions =
|
||||||
|
defaultMap.values()
|
||||||
|
.stream()
|
||||||
|
.map(this::getTargetRegion)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setElements(regions, "Refreshed");
|
setElements(regions, "Refreshed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +106,10 @@ public class GdbModelTargetProcessMemory
|
||||||
setElements(List.of(), "Refreshed (while no process)");
|
setElements(List.of(), "Refreshed (while no process)");
|
||||||
return AsyncUtils.NIL;
|
return AsyncUtils.NIL;
|
||||||
}
|
}
|
||||||
return inferior.listMappings().thenAccept(this::updateUsingMappings);
|
return inferior.listMappings().exceptionally(ex -> {
|
||||||
|
Msg.error(this, "Could not list regions", ex);
|
||||||
|
return Map.of(); // empty map will be replaced with default
|
||||||
|
}).thenAccept(this::updateUsingMappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized GdbModelTargetMemoryRegion getTargetRegion(GdbMemoryMapping mapping) {
|
protected synchronized GdbModelTargetMemoryRegion getTargetRegion(GdbMemoryMapping mapping) {
|
||||||
|
|
|
@ -66,7 +66,9 @@ public class LinuxPtyChild extends LinuxPtyEndpoint implements PtyChild {
|
||||||
protected PtySession sessionUsingJavaLeader(String[] args, Map<String, String> env)
|
protected PtySession sessionUsingJavaLeader(String[] args, Map<String, String> env)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final List<String> argsList = new ArrayList<>();
|
final List<String> argsList = new ArrayList<>();
|
||||||
argsList.add("java");
|
String javaCommand =
|
||||||
|
System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
|
||||||
|
argsList.add(javaCommand);
|
||||||
argsList.add("-cp");
|
argsList.add("-cp");
|
||||||
argsList.add(System.getProperty("java.class.path"));
|
argsList.add(System.getProperty("java.class.path"));
|
||||||
argsList.add(LinuxPtySessionLeader.class.getCanonicalName());
|
argsList.add(LinuxPtySessionLeader.class.getCanonicalName());
|
||||||
|
|
|
@ -118,6 +118,19 @@ src/main/help/help/topics/DebuggerWatchesPlugin/DebuggerWatchesPlugin.html||GHID
|
||||||
src/main/help/help/topics/DebuggerWatchesPlugin/images/DebuggerWatchesPlugin.png||GHIDRA||||END|
|
src/main/help/help/topics/DebuggerWatchesPlugin/images/DebuggerWatchesPlugin.png||GHIDRA||||END|
|
||||||
src/main/resources/defaultTools/Debugger.tool||GHIDRA||||END|
|
src/main/resources/defaultTools/Debugger.tool||GHIDRA||||END|
|
||||||
src/main/resources/images/add.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
src/main/resources/images/add.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||||
|
src/main/resources/images/alt-breakpoint-clear.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-disable.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-enable.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-ineffective-d.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-ineffective-e.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-mixed-de.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-mixed-ed.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoint-set.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoints-clear-all.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoints-disable-all.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoints-enable-all.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoints-make-effective.png||GHIDRA||||END|
|
||||||
|
src/main/resources/images/alt-breakpoints.png||GHIDRA||||END|
|
||||||
src/main/resources/images/attach.png||GHIDRA||||END|
|
src/main/resources/images/attach.png||GHIDRA||||END|
|
||||||
src/main/resources/images/autoread.png||GHIDRA||||END|
|
src/main/resources/images/autoread.png||GHIDRA||||END|
|
||||||
src/main/resources/images/blank.png||GHIDRA||||END|
|
src/main/resources/images/blank.png||GHIDRA||||END|
|
||||||
|
|
|
@ -89,18 +89,32 @@ public interface DebuggerResources {
|
||||||
ImageIcon ICON_SNAP_BACKWARD = ResourceManager.loadImage("images/2leftarrow.png");
|
ImageIcon ICON_SNAP_BACKWARD = ResourceManager.loadImage("images/2leftarrow.png");
|
||||||
ImageIcon ICON_SEEK_PRESENT = ICON_RESUME;
|
ImageIcon ICON_SEEK_PRESENT = ICON_RESUME;
|
||||||
|
|
||||||
ImageIcon ICON_SET_BREAKPOINT = ResourceManager.loadImage("images/breakpoint-set.png");
|
boolean altIcons = Boolean.getBoolean("debugger.breakpoints.alt.icons");
|
||||||
ImageIcon ICON_CLEAR_BREAKPOINT = ResourceManager.loadImage("images/breakpoint-clear.png");
|
|
||||||
ImageIcon ICON_ENABLE_BREAKPOINT = ResourceManager.loadImage("images/breakpoint-enable.png");
|
ImageIcon ICON_SET_BREAKPOINT =
|
||||||
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-set.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-set.png");
|
||||||
|
ImageIcon ICON_CLEAR_BREAKPOINT =
|
||||||
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-clear.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-clear.png");
|
||||||
|
ImageIcon ICON_ENABLE_BREAKPOINT =
|
||||||
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-enable.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-enable.png");
|
||||||
ImageIcon ICON_ENABLE_ALL_BREAKPOINTS =
|
ImageIcon ICON_ENABLE_ALL_BREAKPOINTS =
|
||||||
ResourceManager.loadImage("images/breakpoints-enable-all.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoints-enable-all.png")
|
||||||
ImageIcon ICON_DISABLE_BREAKPOINT = ResourceManager.loadImage("images/breakpoint-disable.png");
|
: ResourceManager.loadImage("images/breakpoints-enable-all.png");
|
||||||
|
ImageIcon ICON_DISABLE_BREAKPOINT =
|
||||||
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-disable.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-disable.png");
|
||||||
ImageIcon ICON_DISABLE_ALL_BREAKPOINTS =
|
ImageIcon ICON_DISABLE_ALL_BREAKPOINTS =
|
||||||
ResourceManager.loadImage("images/breakpoints-disable-all.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoints-disable-all.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoints-disable-all.png");
|
||||||
ImageIcon ICON_CLEAR_ALL_BREAKPOINTS =
|
ImageIcon ICON_CLEAR_ALL_BREAKPOINTS =
|
||||||
ResourceManager.loadImage("images/breakpoints-clear-all.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoints-clear-all.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoints-clear-all.png");
|
||||||
ImageIcon ICON_MAKE_BREAKPOINTS_EFFECTIVE =
|
ImageIcon ICON_MAKE_BREAKPOINTS_EFFECTIVE =
|
||||||
ResourceManager.loadImage("images/breakpoints-make-effective.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoints-make-effective.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoints-make-effective.png");
|
||||||
|
|
||||||
// TODO: Some overlay to indicate dynamic, or new icon altogether
|
// TODO: Some overlay to indicate dynamic, or new icon altogether
|
||||||
ImageIcon ICON_LISTING = ResourceManager.loadImage("images/Browser.gif");
|
ImageIcon ICON_LISTING = ResourceManager.loadImage("images/Browser.gif");
|
||||||
|
@ -279,16 +293,21 @@ public interface DebuggerResources {
|
||||||
int PRIORITY_BREAKPOINT_INEFFECTIVE_D_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
int PRIORITY_BREAKPOINT_INEFFECTIVE_D_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
||||||
int PRIORITY_BREAKPOINT_MIXED_ED_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
int PRIORITY_BREAKPOINT_MIXED_ED_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
||||||
int PRIORITY_BREAKPOINT_MIXED_DE_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
int PRIORITY_BREAKPOINT_MIXED_DE_MARKER = MarkerService.BREAKPOINT_PRIORITY;
|
||||||
|
|
||||||
ImageIcon ICON_BREAKPOINT_ENABLED_MARKER = ICON_ENABLE_BREAKPOINT;
|
ImageIcon ICON_BREAKPOINT_ENABLED_MARKER = ICON_ENABLE_BREAKPOINT;
|
||||||
ImageIcon ICON_BREAKPOINT_DISABLED_MARKER = ICON_DISABLE_BREAKPOINT;
|
ImageIcon ICON_BREAKPOINT_DISABLED_MARKER = ICON_DISABLE_BREAKPOINT;
|
||||||
ImageIcon ICON_BREAKPOINT_MIXED_ED_MARKER =
|
ImageIcon ICON_BREAKPOINT_MIXED_ED_MARKER =
|
||||||
ResourceManager.loadImage("images/breakpoint-mixed-ed.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-mixed-ed.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-mixed-ed.png");
|
||||||
ImageIcon ICON_BREAKPOINT_MIXED_DE_MARKER =
|
ImageIcon ICON_BREAKPOINT_MIXED_DE_MARKER =
|
||||||
ResourceManager.loadImage("images/breakpoint-mixed-de.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-mixed-de.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-mixed-de.png");
|
||||||
ImageIcon ICON_BREAKPOINT_INEFFECTIVE_E_MARKER =
|
ImageIcon ICON_BREAKPOINT_INEFFECTIVE_E_MARKER =
|
||||||
ResourceManager.loadImage("images/breakpoint-ineffective-e.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-ineffective-e.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-ineffective-e.png");
|
||||||
ImageIcon ICON_BREAKPOINT_INEFFECTIVE_D_MARKER =
|
ImageIcon ICON_BREAKPOINT_INEFFECTIVE_D_MARKER =
|
||||||
ResourceManager.loadImage("images/breakpoint-ineffective-d.png");
|
altIcons ? ResourceManager.loadImage("images/alt-breakpoint-ineffective-d.png")
|
||||||
|
: ResourceManager.loadImage("images/breakpoint-ineffective-d.png");
|
||||||
|
|
||||||
Icon ICON_UNIQUE_REF_READ =
|
Icon ICON_UNIQUE_REF_READ =
|
||||||
new RotateIcon(ResourceManager.loadImage("images/cursor_arrow.gif"), 180); // TODO
|
new RotateIcon(ResourceManager.loadImage("images/cursor_arrow.gif"), 180); // TODO
|
||||||
|
@ -1734,4 +1753,5 @@ public interface DebuggerResources {
|
||||||
action.setSelected(value);
|
action.setSelected(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class DebuggerBreakpointEnablementTableCellRenderer
|
||||||
setIcon(iconForEnablement(en));
|
setIcon(iconForEnablement(en));
|
||||||
setHorizontalAlignment(SwingConstants.CENTER);
|
setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
setText("");
|
setText("");
|
||||||
|
setToolTipText(en.name());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class DebuggerBreakpointLocEnabledTableCellRenderer
|
||||||
setIcon(iconForEnabled(en));
|
setIcon(iconForEnabled(en));
|
||||||
setHorizontalAlignment(SwingConstants.CENTER);
|
setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
setText("");
|
setText("");
|
||||||
|
setToolTipText(en ? "ENABLED" : "DISABLED");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoint-disable.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoint-enable.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 302 B |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoint-mixed-de.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoint-mixed-ed.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoint-set.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoints-clear-all.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoints-disable-all.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoints-enable-all.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
Ghidra/Debug/Debugger/src/main/resources/images/alt-breakpoints.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
|
@ -278,8 +278,9 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
|
|
||||||
{
|
{
|
||||||
spc = (AddrSpace *)0;
|
spc = (AddrSpace *)0;
|
||||||
|
bool seenLast = false;
|
||||||
first = 0;
|
first = 0;
|
||||||
last = ~((uintb)0);
|
last = 0;
|
||||||
for(int4 i=0;i<el->getNumAttributes();++i) {
|
for(int4 i=0;i<el->getNumAttributes();++i) {
|
||||||
if (el->getAttributeName(i) == "space") {
|
if (el->getAttributeName(i) == "space") {
|
||||||
spc = manage->getSpaceByName(el->getAttributeValue(i));
|
spc = manage->getSpaceByName(el->getAttributeValue(i));
|
||||||
|
@ -295,6 +296,7 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
istringstream s(el->getAttributeValue(i));
|
istringstream s(el->getAttributeValue(i));
|
||||||
s.unsetf(ios::dec | ios::hex | ios::oct);
|
s.unsetf(ios::dec | ios::hex | ios::oct);
|
||||||
s >> last;
|
s >> last;
|
||||||
|
seenLast = true;
|
||||||
}
|
}
|
||||||
else if (el->getAttributeName(i) == "name") {
|
else if (el->getAttributeName(i) == "name") {
|
||||||
const Translate *trans = manage->getDefaultCodeSpace()->getTrans();
|
const Translate *trans = manage->getDefaultCodeSpace()->getTrans();
|
||||||
|
@ -302,12 +304,16 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
spc = point.space;
|
spc = point.space;
|
||||||
first = point.offset;
|
first = point.offset;
|
||||||
last = (first-1) + point.size;
|
last = (first-1) + point.size;
|
||||||
break; // There should be no (space,first,last) attributes
|
return; // There should be no (space,first,last) attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spc == (AddrSpace *)0)
|
if (spc == (AddrSpace *)0)
|
||||||
throw LowlevelError("No address space indicated in range tag");
|
throw LowlevelError("No address space indicated in range tag");
|
||||||
last = spc->wrapOffset(last);
|
if (!seenLast) {
|
||||||
|
last = spc->getHighest();
|
||||||
|
}
|
||||||
|
if (first > spc->getHighest() || last > spc->getHighest() || last < first)
|
||||||
|
throw LowlevelError("Illegal range tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert a new Range merging as appropriate to maintain the disjoint cover
|
/// Insert a new Range merging as appropriate to maintain the disjoint cover
|
||||||
|
|
|
@ -98,7 +98,7 @@ void IfcLoadFile::execute(istream &s)
|
||||||
if (capa->getName() == "xml") // If file is xml
|
if (capa->getName() == "xml") // If file is xml
|
||||||
dcp->conf->readLoaderSymbols("::"); // Read in loader symbols
|
dcp->conf->readLoaderSymbols("::"); // Read in loader symbols
|
||||||
#ifdef OPACTION_DEBUG
|
#ifdef OPACTION_DEBUG
|
||||||
dcp->conf->setDebugStream(status->optr);
|
dcp->conf->setDebugStream(status->fileoptr);
|
||||||
#endif
|
#endif
|
||||||
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ void IfcRestore::execute(istream &s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPACTION_DEBUG
|
#ifdef OPACTION_DEBUG
|
||||||
dcp->conf->setDebugStream(status->optr);
|
dcp->conf->setDebugStream(status->fileoptr);
|
||||||
#endif
|
#endif
|
||||||
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,7 +545,7 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
|
||||||
<defblock>[0-9]|[1-9][0-9]+ { return scan_number(yytext,&yylval,false); }
|
<defblock>[0-9]|[1-9][0-9]+ { return scan_number(yytext,&yylval,false); }
|
||||||
<defblock>0x[0-9a-fA-F]+ { return scan_number(yytext,&yylval,false); }
|
<defblock>0x[0-9a-fA-F]+ { return scan_number(yytext,&yylval,false); }
|
||||||
<defblock>0b[01]+ { return scan_number(yytext,&yylval,false); }
|
<defblock>0b[01]+ { return scan_number(yytext,&yylval,false); }
|
||||||
<defblock>\"([^\"]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
|
<defblock>\"([^\"[:cntrl:]]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
|
||||||
<defblock>[\r\ \t\v]+
|
<defblock>[\r\ \t\v]+
|
||||||
<defblock>\n { slgh->nextLine(); }
|
<defblock>\n { slgh->nextLine(); }
|
||||||
<defblock>. { return yytext[0]; }
|
<defblock>. { return yytext[0]; }
|
||||||
|
@ -557,7 +557,7 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
|
||||||
<print>\^ { yylval.ch = '^'; return '^'; }
|
<print>\^ { yylval.ch = '^'; return '^'; }
|
||||||
<print>is { BEGIN(pattern); actionon=0; return IS_KEY; }
|
<print>is { BEGIN(pattern); actionon=0; return IS_KEY; }
|
||||||
<print>[a-zA-Z_.][a-zA-Z0-9_.]* { yylval.str = new string(yytext); return SYMBOLSTRING; }
|
<print>[a-zA-Z_.][a-zA-Z0-9_.]* { yylval.str = new string(yytext); return SYMBOLSTRING; }
|
||||||
<print>\"([^\"]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
|
<print>\"([^\"[:cntrl:]]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
|
||||||
<print>[\r\ \t\v]+ { yylval.ch = ' '; return ' '; }
|
<print>[\r\ \t\v]+ { yylval.ch = ' '; return ' '; }
|
||||||
<print>\n { slgh->nextLine(); return ' '; }
|
<print>\n { slgh->nextLine(); return ' '; }
|
||||||
<print>. { return yytext[0]; }
|
<print>. { return yytext[0]; }
|
||||||
|
|
|
@ -1058,13 +1058,13 @@ public class DecompileCallback {
|
||||||
Address last = range.getMaxAddress();
|
Address last = range.getMaxAddress();
|
||||||
boolean readonly = true; // Treat function body as readonly
|
boolean readonly = true; // Treat function body as readonly
|
||||||
return buildHoleXML(first.getAddressSpace().getPhysicalSpace().getName(),
|
return buildHoleXML(first.getAddressSpace().getPhysicalSpace().getName(),
|
||||||
first.getOffset(), last.getOffset(), readonly, false);
|
first.getUnsignedOffset(), last.getUnsignedOffset(), readonly, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// There is probably some sort of error, just return a block
|
// There is probably some sort of error, just return a block
|
||||||
// containing the single queried address
|
// containing the single queried address
|
||||||
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
|
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
|
||||||
addr.getOffset(), true, false);
|
addr.getUnsignedOffset(), addr.getUnsignedOffset(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getExtraPopOverride(Function func, Address addr) {
|
private int getExtraPopOverride(Function func, Address addr) {
|
||||||
|
@ -1175,8 +1175,8 @@ public class DecompileCallback {
|
||||||
// after.getOffset(),readonly,isVolatile);
|
// after.getOffset(),readonly,isVolatile);
|
||||||
boolean readonly = isReadOnlyNoData(addr);
|
boolean readonly = isReadOnlyNoData(addr);
|
||||||
boolean isvolatile = isVolatileNoData(addr);
|
boolean isvolatile = isVolatileNoData(addr);
|
||||||
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
|
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
|
||||||
addr.getOffset(), readonly, isvolatile);
|
addr.getUnsignedOffset(), addr.getUnsignedOffset(), readonly, isvolatile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildExternalRef(Address addr, ExternalReference ref) {
|
private String buildExternalRef(Address addr, ExternalReference ref) {
|
||||||
|
|
|
@ -516,7 +516,8 @@ public class CppExporter extends Exporter {
|
||||||
Address entryPoint = function.getEntryPoint();
|
Address entryPoint = function.getEntryPoint();
|
||||||
CodeUnit codeUnitAt = function.getProgram().getListing().getCodeUnitAt(entryPoint);
|
CodeUnit codeUnitAt = function.getProgram().getListing().getCodeUnitAt(entryPoint);
|
||||||
if (codeUnitAt == null || !(codeUnitAt instanceof Instruction)) {
|
if (codeUnitAt == null || !(codeUnitAt instanceof Instruction)) {
|
||||||
return new CPPResult(entryPoint, function.getPrototypeString(false, false), null);
|
return new CPPResult(entryPoint, function.getPrototypeString(false, false) + ';',
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.setMessage("Decompiling " + function.getName());
|
monitor.setMessage("Decompiling " + function.getName());
|
||||||
|
|
|
@ -808,7 +808,7 @@ public class BasicCompilerSpec implements CompilerSpec {
|
||||||
seenLast = true;
|
seenLast = true;
|
||||||
}
|
}
|
||||||
if (!seenLast) {
|
if (!seenLast) {
|
||||||
last = addressSpace.getMaxAddress().getOffset();
|
last = addressSpace.getMaxAddress().getUnsignedOffset();
|
||||||
}
|
}
|
||||||
if (extraRanges == null) {
|
if (extraRanges == null) {
|
||||||
extraRanges = new ArrayList<>();
|
extraRanges = new ArrayList<>();
|
||||||
|
|