1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-30 06:29:32 +00:00

Check for hidden visualizations

As always, we try to prevent this from happening, but a determined
user can accomplish anything.
This commit is contained in:
Andy McFadden 2019-12-25 11:12:59 -08:00
parent f11ef0dce4
commit 3acf83ead3
4 changed files with 43 additions and 0 deletions

View File

@ -689,6 +689,9 @@ namespace SourceGen {
} }
} }
/// <summary>
/// Checks to see if any part of the address map runs across a bank boundary.
/// </summary>
private void ValidateAddressMap() { private void ValidateAddressMap() {
foreach (AddressMap.AddressMapEntry entry in AddrMap) { foreach (AddressMap.AddressMapEntry entry in AddrMap) {
if ((entry.Addr & 0xff0000) != ((entry.Addr + entry.Length - 1) & 0xff0000)) { if ((entry.Addr & 0xff0000) != ((entry.Addr + entry.Length - 1) & 0xff0000)) {
@ -705,6 +708,27 @@ namespace SourceGen {
} }
} }
/// <summary>
/// Checks for hidden visualization sets.
/// </summary>
private void ValidateVisualizationSets() {
foreach (KeyValuePair<int, VisualizationSet> kvp in VisualizationSets) {
Anattrib attr = GetAnattrib(kvp.Key);
if (!attr.IsStart) {
string tag = string.Empty;
if (kvp.Value.Count > 0) {
tag = kvp.Value[0].Tag;
}
Messages.Add(new MessageList.MessageEntry(
MessageList.MessageEntry.SeverityLevel.Warning,
kvp.Key,
MessageList.MessageEntry.MessageType.HiddenVisualization,
tag,
MessageList.MessageEntry.ProblemResolution.VisualizationIgnored));
}
}
}
#region Analysis #region Analysis
/// <summary> /// <summary>
@ -850,7 +874,10 @@ namespace SourceGen {
Validate(); Validate();
reanalysisTimer.EndTask("Validate"); reanalysisTimer.EndTask("Validate");
#endif #endif
reanalysisTimer.StartTask("ErrorCheck");
ValidateAddressMap(); ValidateAddressMap();
ValidateVisualizationSets();
reanalysisTimer.EndTask("ErrorCheck");
reanalysisTimer.EndTask("DisasmProject.Analyze()"); reanalysisTimer.EndTask("DisasmProject.Analyze()");
//reanalysisTimer.DumpTimes("DisasmProject timers:", debugLog); //reanalysisTimer.DumpTimes("DisasmProject timers:", debugLog);

View File

@ -49,6 +49,7 @@ namespace SourceGen {
Unknown = 0, Unknown = 0,
HiddenLabel, HiddenLabel,
HiddenLocalVariableTable, HiddenLocalVariableTable,
HiddenVisualization,
UnresolvedWeakRef, UnresolvedWeakRef,
InvalidOffsetOrLength, InvalidOffsetOrLength,
InvalidDescriptor, InvalidDescriptor,
@ -64,6 +65,7 @@ namespace SourceGen {
None, None,
LabelIgnored, LabelIgnored,
LocalVariableTableIgnored, LocalVariableTableIgnored,
VisualizationIgnored,
FormatDescriptorIgnored, FormatDescriptorIgnored,
} }
public ProblemResolution Resolution { get; private set; } public ProblemResolution Resolution { get; private set; }
@ -71,6 +73,8 @@ namespace SourceGen {
public MessageEntry(SeverityLevel severity, int offset, MessageType mtype, public MessageEntry(SeverityLevel severity, int offset, MessageType mtype,
object context, ProblemResolution resolution) { object context, ProblemResolution resolution) {
Debug.Assert(context != null);
Severity = severity; Severity = severity;
Offset = offset; Offset = offset;
MsgType = mtype; MsgType = mtype;
@ -155,6 +159,9 @@ namespace SourceGen {
case MessageEntry.MessageType.HiddenLocalVariableTable: case MessageEntry.MessageType.HiddenLocalVariableTable:
problem = Res.Strings.MSG_HIDDEN_LOCAL_VARIABLE_TABLE; problem = Res.Strings.MSG_HIDDEN_LOCAL_VARIABLE_TABLE;
break; break;
case MessageEntry.MessageType.HiddenVisualization:
problem = Res.Strings.MSG_HIDDEN_VISUALIZATION;
break;
case MessageEntry.MessageType.UnresolvedWeakRef: case MessageEntry.MessageType.UnresolvedWeakRef:
problem = Res.Strings.MSG_UNRESOLVED_WEAK_REF; problem = Res.Strings.MSG_UNRESOLVED_WEAK_REF;
break; break;
@ -188,6 +195,9 @@ namespace SourceGen {
case MessageEntry.ProblemResolution.FormatDescriptorIgnored: case MessageEntry.ProblemResolution.FormatDescriptorIgnored:
resolution = Res.Strings.MSG_FORMAT_DESCRIPTOR_IGNORED; resolution = Res.Strings.MSG_FORMAT_DESCRIPTOR_IGNORED;
break; break;
case MessageEntry.ProblemResolution.VisualizationIgnored:
resolution = Res.Strings.MSG_VISUALIZATION_IGNORED;
break;
default: default:
resolution = "???"; resolution = "???";
break; break;

View File

@ -117,11 +117,13 @@ limitations under the License.
<system:String x:Key="str_MsgFormatDescriptorIgnored">Format ignored</system:String> <system:String x:Key="str_MsgFormatDescriptorIgnored">Format ignored</system:String>
<system:String x:Key="str_MsgHiddenLabel">Hidden label</system:String> <system:String x:Key="str_MsgHiddenLabel">Hidden label</system:String>
<system:String x:Key="str_MsgHiddenLocalVariableTable">Hidden variable table</system:String> <system:String x:Key="str_MsgHiddenLocalVariableTable">Hidden variable table</system:String>
<system:String x:Key="str_MsgHiddenVisualization">Hidden visualization</system:String>
<system:String x:Key="str_MsgInvalidDescriptor">Invalid format desc</system:String> <system:String x:Key="str_MsgInvalidDescriptor">Invalid format desc</system:String>
<system:String x:Key="str_MsgInvalidOffsetOrLength">Invalid offset or len</system:String> <system:String x:Key="str_MsgInvalidOffsetOrLength">Invalid offset or len</system:String>
<system:String x:Key="str_MsgLabelIgnored">Label ignored</system:String> <system:String x:Key="str_MsgLabelIgnored">Label ignored</system:String>
<system:String x:Key="str_MsgLocalVariableTableIgnored">LV table skipped over</system:String> <system:String x:Key="str_MsgLocalVariableTableIgnored">LV table skipped over</system:String>
<system:String x:Key="str_MsgUnresolvedWeakRef">Ref'd symbol not found</system:String> <system:String x:Key="str_MsgUnresolvedWeakRef">Ref'd symbol not found</system:String>
<system:String x:Key="str_MsgVisualizationIgnored">Visualization ignored</system:String>
<system:String x:Key="str_NoFilesAvailable">no files available</system:String> <system:String x:Key="str_NoFilesAvailable">no files available</system:String>
<system:String x:Key="str_NoExportedSymbolsFound">No exported symbols found.</system:String> <system:String x:Key="str_NoExportedSymbolsFound">No exported symbols found.</system:String>
<system:String x:Key="str_OpenDataDoesntExist">The file doesn't exist.</system:String> <system:String x:Key="str_OpenDataDoesntExist">The file doesn't exist.</system:String>

View File

@ -215,6 +215,8 @@ namespace SourceGen.Res {
(string)Application.Current.FindResource("str_MsgHiddenLabel"); (string)Application.Current.FindResource("str_MsgHiddenLabel");
public static string MSG_HIDDEN_LOCAL_VARIABLE_TABLE = public static string MSG_HIDDEN_LOCAL_VARIABLE_TABLE =
(string)Application.Current.FindResource("str_MsgHiddenLocalVariableTable"); (string)Application.Current.FindResource("str_MsgHiddenLocalVariableTable");
public static string MSG_HIDDEN_VISUALIZATION =
(string)Application.Current.FindResource("str_MsgHiddenVisualization");
public static string MSG_INVALID_DESCRIPTOR = public static string MSG_INVALID_DESCRIPTOR =
(string)Application.Current.FindResource("str_MsgInvalidDescriptor"); (string)Application.Current.FindResource("str_MsgInvalidDescriptor");
public static string MSG_INVALID_OFFSET_OR_LENGTH = public static string MSG_INVALID_OFFSET_OR_LENGTH =
@ -225,6 +227,8 @@ namespace SourceGen.Res {
(string)Application.Current.FindResource("str_MsgLocalVariableTableIgnored"); (string)Application.Current.FindResource("str_MsgLocalVariableTableIgnored");
public static string MSG_UNRESOLVED_WEAK_REF = public static string MSG_UNRESOLVED_WEAK_REF =
(string)Application.Current.FindResource("str_MsgUnresolvedWeakRef"); (string)Application.Current.FindResource("str_MsgUnresolvedWeakRef");
public static string MSG_VISUALIZATION_IGNORED =
(string)Application.Current.FindResource("str_MsgVisualizationIgnored");
public static string NO_FILES_AVAILABLE = public static string NO_FILES_AVAILABLE =
(string)Application.Current.FindResource("str_NoFilesAvailable"); (string)Application.Current.FindResource("str_NoFilesAvailable");
public static string NO_EXPORTED_SYMBOLS_FOUND = public static string NO_EXPORTED_SYMBOLS_FOUND =