1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-28 09:29:37 +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() {
foreach (AddressMap.AddressMapEntry entry in AddrMap) {
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
/// <summary>
@ -850,7 +874,10 @@ namespace SourceGen {
Validate();
reanalysisTimer.EndTask("Validate");
#endif
reanalysisTimer.StartTask("ErrorCheck");
ValidateAddressMap();
ValidateVisualizationSets();
reanalysisTimer.EndTask("ErrorCheck");
reanalysisTimer.EndTask("DisasmProject.Analyze()");
//reanalysisTimer.DumpTimes("DisasmProject timers:", debugLog);

View File

@ -49,6 +49,7 @@ namespace SourceGen {
Unknown = 0,
HiddenLabel,
HiddenLocalVariableTable,
HiddenVisualization,
UnresolvedWeakRef,
InvalidOffsetOrLength,
InvalidDescriptor,
@ -64,6 +65,7 @@ namespace SourceGen {
None,
LabelIgnored,
LocalVariableTableIgnored,
VisualizationIgnored,
FormatDescriptorIgnored,
}
public ProblemResolution Resolution { get; private set; }
@ -71,6 +73,8 @@ namespace SourceGen {
public MessageEntry(SeverityLevel severity, int offset, MessageType mtype,
object context, ProblemResolution resolution) {
Debug.Assert(context != null);
Severity = severity;
Offset = offset;
MsgType = mtype;
@ -155,6 +159,9 @@ namespace SourceGen {
case MessageEntry.MessageType.HiddenLocalVariableTable:
problem = Res.Strings.MSG_HIDDEN_LOCAL_VARIABLE_TABLE;
break;
case MessageEntry.MessageType.HiddenVisualization:
problem = Res.Strings.MSG_HIDDEN_VISUALIZATION;
break;
case MessageEntry.MessageType.UnresolvedWeakRef:
problem = Res.Strings.MSG_UNRESOLVED_WEAK_REF;
break;
@ -188,6 +195,9 @@ namespace SourceGen {
case MessageEntry.ProblemResolution.FormatDescriptorIgnored:
resolution = Res.Strings.MSG_FORMAT_DESCRIPTOR_IGNORED;
break;
case MessageEntry.ProblemResolution.VisualizationIgnored:
resolution = Res.Strings.MSG_VISUALIZATION_IGNORED;
break;
default:
resolution = "???";
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_MsgHiddenLabel">Hidden label</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_MsgInvalidOffsetOrLength">Invalid offset or len</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_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_NoExportedSymbolsFound">No exported symbols found.</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");
public static string MSG_HIDDEN_LOCAL_VARIABLE_TABLE =
(string)Application.Current.FindResource("str_MsgHiddenLocalVariableTable");
public static string MSG_HIDDEN_VISUALIZATION =
(string)Application.Current.FindResource("str_MsgHiddenVisualization");
public static string MSG_INVALID_DESCRIPTOR =
(string)Application.Current.FindResource("str_MsgInvalidDescriptor");
public static string MSG_INVALID_OFFSET_OR_LENGTH =
@ -225,6 +227,8 @@ namespace SourceGen.Res {
(string)Application.Current.FindResource("str_MsgLocalVariableTableIgnored");
public static string MSG_UNRESOLVED_WEAK_REF =
(string)Application.Current.FindResource("str_MsgUnresolvedWeakRef");
public static string MSG_VISUALIZATION_IGNORED =
(string)Application.Current.FindResource("str_MsgVisualizationIgnored");
public static string NO_FILES_AVAILABLE =
(string)Application.Current.FindResource("str_NoFilesAvailable");
public static string NO_EXPORTED_SYMBOLS_FOUND =