From 804210b7eb944104ed450769dea7f580c614d363 Mon Sep 17 00:00:00 2001 From: dev747368 <48332326+dev747368@users.noreply.github.com> Date: Mon, 28 Apr 2025 20:44:24 +0000 Subject: [PATCH] GP-5624 fix markup of gcwritebarrier enabled flag when dwarf is present DWARF can lay down a more detailed struct that encompasses the enabled flag, but it prevents the decompiler from simplifying its output. This change clears any DWARF struct laid down over the enabled flag. --- .../app/plugin/core/analysis/GolangSymbolAnalyzer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java index 4b941a2e56..f1aad117cf 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java @@ -756,9 +756,12 @@ public class GolangSymbolAnalyzer extends AbstractAnalyzer { } // mark the 4 bytes of the flag with a data type and set it to constant mutability. try { + // this will overwrite any DWARF discovered struct (that encompasses the flag) + // that was placed here, which is necessary to allow the decompiler to determine + // that the flag is a constant value. Data flagData = DataUtilities.createData(program, flagAddr, AbstractIntegerDataType.getUnsignedDataType(4, null), 4, - ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA); + ClearDataMode.CLEAR_ALL_CONFLICT_DATA); MutabilitySettingsDefinition.DEF.setChoice(flagData, MutabilitySettingsDefinition.CONSTANT); markupSession.labelAddress(flagAddr, "runtime.writeBarrier.discovered");