NationalSecurityAgency/ghidra · warning · DynamicMappingException
Cannot map %s:%s to dynamic adress
Error message
Cannot map %s:%s to dynamic adress
What it means
ArithmeticFrameVarnodeEvaluator.translateMemory() converts a static program address into a dynamic trace address using the static mapping service. If getOpenMappedLocation(trace, ProgramLocation(program,address), snap) returns null (no mapping exists for that program/address at this snap), it throws DynamicMappingException("Cannot map %s:%s to dynamic adress"). This surfaces while evaluating p-code varnodes that reference static memory during stack-frame value evaluation.
Source
Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/AbstractUnwoundFrame.java:83
* @param <U> the evaluation result type
*/
protected abstract class ArithmeticFrameVarnodeEvaluator<U>
extends ArithmeticVarnodeEvaluator<U> {
public ArithmeticFrameVarnodeEvaluator(PcodeArithmetic<U> arithmetic) {
super(arithmetic);
}
@Override
protected Address applyBase(long offset) {
return AbstractUnwoundFrame.this.applyBase(offset);
}
@Override
protected Address translateMemory(Program program, Address address) {
TraceLocation location = mappingService.getOpenMappedLocation(trace,
new ProgramLocation(program, address), snap);
if (location == null) {
throw new DynamicMappingException(program, address);
}
return location.getAddress();
}
}
/**
* A class which can evaluate high p-code varnodes in the context of a stack frame
*
* @param <U> the evaluation result type
*/
protected abstract class AbstractFrameVarnodeEvaluator<U> extends AbstractVarnodeEvaluator<U> {
@Override
protected Address applyBase(long offset) {
return AbstractUnwoundFrame.this.applyBase(offset);
}
@Override
protected Address translateMemory(Program program, Address address) {View on GitHub (pinned to d5f144c24d)
Solutions
- Establish static-to-dynamic mappings for the program regions the frame's variables reference (module/section mapping) before evaluating the frame.
- Catch DynamicMappingException (a subclass of EvaluationException) and skip/degrade the variable that lacks a mapping.
- Refresh mappings and re-evaluate after mapping changes.
Example fix
// before
var value = evaluator.evaluate(varnode); // throws DynamicMappingException: no mapping
// after
try {
var value = evaluator.evaluate(varnode);
} catch (DynamicMappingException e) {
Msg.warn(this, "No dynamic mapping for " + e.getMessage() + "; establish module mappings");
return null; // or trigger mapping refresh
} Defensive patterns
Strategy: try-catch
Validate before calling
// Before evaluating a varnode that references static memory, confirm a mapping exists
TraceLocation loc = mappingService.getOpenMappedLocation(
trace, new ProgramLocation(program, address), snap);
if (loc == null) {
// establish module mapping for this program/address before evaluating
} Type guard
public static boolean hasDynamicMapping(DebuggerStaticMappingService ms,
Trace trace, Program program, Address address, long snap) {
return ms.getOpenMappedLocation(trace,
new ProgramLocation(program, address), snap) != null;
} Try / catch
try {
T val = evaluator.evaluate(varnode);
} catch (DynamicMappingException e) {
// e.getMessage() == "Cannot map %s:%s to dynamic adress"
// establish static-to-dynamic mapping or skip the variable
} Prevention
- Establish static-to-dynamic module mappings before stack/variable evaluation.
- Catch DynamicMappingException (subclass of EvaluationException) around varnode evaluation.
- Refresh mappings after static/dynamic changes before re-evaluating frames.
When it happens
Trigger: Evaluating a high-pcode varnode (e.g. a stack/local variable whose storage references a static address) when no static-to-dynamic mapping covers that program+address at the current snap. Inspecting/unwinding a frame before mappings between the program and trace are established.
Common situations: Debugger stack unwinding / variable evaluation before the user has mapped modules. Mappings that cover code but not the data/local ranges referenced by the frame. Mapping changes or deletions while a frame is being evaluated.
Related errors
- The program containing the frame's function is unavailable,
- Current trace does not use Sleigh
- Timed out reading or writing target
- Error reading or writing target
- Mapping destination cannot be a TraceProgramView
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/c26b97734450308d.
Report an issue: GitHub.