From b821aec51993f91acd66c001b47667f73ff73142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 12 Mar 2022 14:29:33 +0100 Subject: [PATCH 1/4] Fix pcodeparse.y after only the generated pcodeparse.cc was changed 311a22c038eab8181b61042ccbfceb7897f428a5 has changed the purely generated pcodeparse.cc instead of updating pcodeparse.y and re-generating the source. This meant that the .y file was out of sync with the .h file and re-generating would lead to compiler errors because of the uintb/uint4 mismatch. --- Ghidra/Features/Decompiler/src/decompile/cpp/pcodeparse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeparse.y b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeparse.y index a86239a0d7..b376fb6c75 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeparse.y +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeparse.y @@ -635,10 +635,10 @@ void PcodeLexer::initialize(istream *t) } } -uintb PcodeSnippet::allocateTemp(void) +uint4 PcodeSnippet::allocateTemp(void) { // Allocate a variable in the unique space and return the offset - uintb res = tempbase; + uint4 res = tempbase; tempbase += 16; return res; } From b8b306497a3cd95d0d6985f3ddfac6fc6aa484bc Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Thu, 14 Apr 2022 12:25:31 -0400 Subject: [PATCH 2/4] GP-1847 Added missing attribute to PROGRAM.DTD --- .../app/util/xml/RelocationTableXmlMgr.java | 26 ++++++++++++------- .../Base/src/main/resources/PROGRAM.DTD | 9 ++++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/RelocationTableXmlMgr.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/RelocationTableXmlMgr.java index 7dbb07c3c4..90def5dcea 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/RelocationTableXmlMgr.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/RelocationTableXmlMgr.java @@ -1,6 +1,5 @@ /* ### * 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. @@ -16,6 +15,11 @@ */ package ghidra.app.util.xml; +import java.util.Iterator; +import java.util.StringTokenizer; + +import org.apache.commons.lang3.StringUtils; + import ghidra.app.util.importer.MessageLog; import ghidra.program.model.address.*; import ghidra.program.model.listing.Program; @@ -28,9 +32,6 @@ import ghidra.util.xml.*; import ghidra.xml.XmlElement; import ghidra.xml.XmlPullParser; -import java.util.Iterator; -import java.util.StringTokenizer; - class RelocationTableXmlMgr { private Program program; @@ -66,8 +67,8 @@ class RelocationTableXmlMgr { } int type = XmlUtilities.parseInt(element.getAttribute("TYPE")); long[] values = unpackLongs(element.getAttribute("VALUE")); - byte[] bytes = unpackBytes(element.getAttribute("BYTES")); - String symbolName = element.getAttribute("SYMBOL_NAME"); + byte[] bytes = unpackBytes(element.getAttribute("BYTES")); // optional + String symbolName = element.getAttribute("SYMBOL_NAME"); // optional relocTable.add(addr, type, values, bytes, symbolName); } @@ -120,7 +121,7 @@ class RelocationTableXmlMgr { private String pack(byte[] values) { if (values == null || values.length == 0) { - return ""; + return null; } StringBuffer buf = new StringBuffer(); for (byte v : values) { @@ -149,9 +150,14 @@ class RelocationTableXmlMgr { attrs.addAttribute("ADDRESS", XmlProgramUtilities.toString(reloc.getAddress())); attrs.addAttribute("TYPE", reloc.getType(), true); attrs.addAttribute("VALUE", pack(reloc.getValues())); - attrs.addAttribute("BYTES", pack(reloc.getBytes())); - attrs.addAttribute("SYMBOL_NAME", reloc.getSymbolName()); - + String packedBytes = pack(reloc.getBytes()); + if (packedBytes != null) { + attrs.addAttribute("BYTES", packedBytes); + } + String symName = reloc.getSymbolName(); + if (!StringUtils.isEmpty(symName)) { + attrs.addAttribute("SYMBOL_NAME", reloc.getSymbolName()); + } writer.startElement("RELOCATION", attrs); writer.endElement("RELOCATION"); } diff --git a/Ghidra/Features/Base/src/main/resources/PROGRAM.DTD b/Ghidra/Features/Base/src/main/resources/PROGRAM.DTD index 02c5b5c0ad..99f1aa39be 100644 --- a/Ghidra/Features/Base/src/main/resources/PROGRAM.DTD +++ b/Ghidra/Features/Base/src/main/resources/PROGRAM.DTD @@ -159,10 +159,11 @@ - - - - + + + + + From 447425b809cb97fc1be55ad6a92fd2b330cd05f9 Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Thu, 14 Apr 2022 12:41:47 -0400 Subject: [PATCH 3/4] GP-1844 minor fix to CompositeDBAdapterV5V6 --- .../program/database/data/CompositeDBAdapterV5V6.java | 2 +- .../ghidra/program/model/data/CompositeDataTypeImpl.java | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CompositeDBAdapterV5V6.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CompositeDBAdapterV5V6.java index b652059788..d2b3b3e914 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CompositeDBAdapterV5V6.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CompositeDBAdapterV5V6.java @@ -113,7 +113,7 @@ class CompositeDBAdapterV5V6 extends CompositeDBAdapter { if (compositeTable.getSchema().getVersion() == V5_VERSION) { throw new UnsupportedOperationException(); } - if (packValue < CompositeInternal.DEFAULT_ALIGNMENT) { + if (packValue < CompositeInternal.DEFAULT_PACKING) { packValue = CompositeInternal.NO_PACKING; } else { diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/CompositeDataTypeImpl.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/CompositeDataTypeImpl.java index 2c971b8e82..57b0eedaa9 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/CompositeDataTypeImpl.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/CompositeDataTypeImpl.java @@ -28,12 +28,6 @@ import ghidra.util.exception.NotYetImplementedException; */ public abstract class CompositeDataTypeImpl extends GenericDataType implements CompositeInternal { - // Strings used for toString formatting - private static final String ALIGN_NAME = "aligned"; - private static final String PACKING_NAME = "pack"; - private static final String DISABLED_PACKING_NAME = "disabled"; - private static final String DEFAULT_PACKING_NAME = ""; - private String description; protected int minimumAlignment = DEFAULT_ALIGNMENT; From 0ec41f09521a92b3531ac6a6b8de702fdac1c21b Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Thu, 14 Apr 2022 12:52:00 -0400 Subject: [PATCH 4/4] GP-1877 minor corrections to ChangeHistory --- .../Public_Release/src/global/docs/ChangeHistory.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html index 426cc31d86..5e6acbd2a5 100644 --- a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html +++ b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html @@ -25,7 +25,7 @@
  • Analysis. Fixed another bug with recovering Objective-C method names. (GP-1642, Issue #3817)
  • Analysis. Certain switch cases using the AARCH64 CSEL instruction will now recover correctly. Previously internal CBRANCH instructions could cause switch flow recovery failure in the decompiler switch analyzer. (GP-1687)
  • Analysis. Fixed unused Microsoft Demangler options. (GP-1688, Issue #3892)
  • -
  • Analysis. (U) Reverted change (GP-1575) introduced with Ghidra 10.1 which improperly factored image-base into analysis of ELF LSDA Gcc exception records. (GP-1702)
  • +
  • Analysis. Reverted change (GP-1575) introduced with Ghidra 10.1 which improperly factored image-base into analysis of ELF LSDA GCC exception records. (GP-1702)
  • Build. Fixed gradle buildGhidra issue where a second build doesn't include all the files. This issue appears to be a bug introduced in Gradle 7. (GP-1648, Issue #3827)
  • Data Types. Fixed display of multiple Enum values. (GP-1657, Issue #3810)
  • Debugger. Now invalidating caches for dbgeng/dbgmodel in the GADP variants so the memory is not left stale. (GP-846)
  • @@ -354,7 +354,7 @@
  • Data Types. When creating a substructure from existing components, the new structure will adopt the pack setting of the parent structure from which it was created. Note that a packed structure may still move based upon component alignment rules. (GP-1111, Issue #3193)
  • Decompiler. Added E key binding to the Decompiler's Equate action. (GP-1146, Issue #3195)
  • GUI. Added Apply button to analysis options dialog. Also added a last chance save/cancel dialog that is shown when a user cancels an options dialog that has unsaved changes. (GP-1169, Issue #3274)
  • -
  • Scripting. For stripped gcc binaries, improved prototype RecoverClassesFromRTTIScript identification of vtables and simple class data, constructors, and destructors. (GP-1055, Issue #3266)
  • +
  • Scripting. For stripped GCC binaries, improved prototype RecoverClassesFromRTTIScript identification of vtables and simple class data, constructors, and destructors. (GP-1055, Issue #3266)
  • Bugs

    @@ -799,7 +799,7 @@
  • Processors. Added manual index file for the M6809 processor. (GT-3449, Issue #1414)
  • Processors. Corrected issues related to retained instruction context during a language upgrade. In some rare cases this retained context could interfere with the instruction re-disassembly. This context-clearing mechanism is controlled by a new pspec property: resetContextOnUpgrade. (GT-3531)
  • Processors. Updated PIC24/PIC30 index file to match latest manual. Added support for dsPIC33C. (GT-3562)
  • -
  • Processors. Added missing call-fixup to handle call side-effects for 32 bit gcc programs for get_pc_thunk.ax/si. (GP-10)
  • +
  • Processors. Added missing call-fixup to handle call side-effects for 32 bit GCC programs for get_pc_thunk.ax/si. (GP-10)
  • Processors. Added ExitProcess to PEFunctionsThatDoNotReturn. (GP-35)
  • Processors. External Disassembly field in the Listing now shows Thumb disassembly when appropriate TMode context has been established on a memory location. (GP-49)
  • Processors. Changed RISC-V jump instructions to the more appropriate goto instead of call. (GP-54, Issue #2120)