1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-04-20 04:16:47 +00:00

Work around edge case

The new GetOperandTargetOffset() function doesn't handle isolated
address regions quite right, because it uses a symbol table lookup
that doesn't know about them.  For now, we can work around it by
tweaking the behavior.
This commit is contained in:
Andy McFadden
2025-07-09 08:04:59 -07:00
parent c0e3809938
commit 332477f4ab
2 changed files with 20 additions and 1 deletions
+14 -1
View File
@@ -2474,9 +2474,22 @@ namespace SourceGen {
// answer when there are overlapping multi-byte values and masks. If we don't
// find a match, we still want to return "true" so that the caller can offer
// to create a new project symbol.
externalSym = project.SymbolTable.FindNonVariableByAddress(attr.OperandAddress,
//
// TODO: this symbol table lookup call does not correctly handle isolated
// address regions. It can return a user label with a matching address
// that shouldn't be visible, because user labels have higher priority
// than project symbols. We currently work around this by ignoring
// user label results.
Symbol sym = project.SymbolTable.FindNonVariableByAddress(attr.OperandAddress,
OpDef.MemoryEffect.ReadModifyWrite); // could get effect from op
externalAddr = attr.OperandAddress;
if (sym is DefSymbol) {
externalSym = sym;
} else {
// This can happen if we're in an isolated address region that blocks
// output resolution. Ignore the result. (We still set externalAddr for
// the benefit of the project symbol creation dialog's initial values.)
}
} else {
// Probably an immediate operand, nothing to do.
return false;
@@ -960,6 +960,12 @@ namespace SourceGen.WpfGui {
// when there are overlapping multi-byte values and masks.
if (externalSym == null) {
// Nothing currently defined.
//
// This can currently happen if we're in an isolated address region that blocks
// output resolution. The target address is effectively external, but
// a user label exists with the address, so our symbol search finds a match
// that overrules the external symbol. Happily, the upcoming project/platform
// symbol search works around this. (GetOperandTargetOffset() needs fixing.)
} else if (externalSym.SymbolSource == Symbol.Source.Platform) {
firstPlatform = externalSym;
} else if (externalSym.SymbolSource == Symbol.Source.Project) {