Skip to content

Commit

Permalink
Add: Breakpoints now following project or single file
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgRottensteiner committed Sep 15, 2024
1 parent b6c8a99 commit f32d6b3
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 54 deletions.
29 changes: 22 additions & 7 deletions C64Studio/Documents/DebugBreakpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,33 @@ public override void OnApplicationEvent( ApplicationEvent Event )
case ApplicationEvent.Type.SHUTTING_DOWN:
Core.Settings.DialogSettings.StoreListViewColumns( "Debug.Breakpoints", listBreakpoints );
break;
case ApplicationEvent.Type.DOCUMENT_ACTIVATED:
{
listBreakpoints.Items.Clear();
if ( ( Event.Doc != null )
&& ( Event.Doc.Project != null ) )
{
RefillBreakpointList( Event.Doc.Project.Settings.BreakPoints );
}
else if ( Core.Debugging.Debugger != null )
{
// projectless debugging, use watches from debugger
RefillBreakpointList( Core.Debugging.BreakPoints );
}
else if ( ( Event.Doc != null )
&& ( Event.Doc.Type == ProjectElement.ElementType.ASM_SOURCE ) )
{
// assembler without project
var mappedBreakpoints = ( (SourceASMEx)Event.Doc.BaseDoc ).MapBreakpoints();
RefillBreakpointList( mappedBreakpoints );
}
}
break;
}
}



public void ClearAllBreakpointEntries()
{
listBreakpoints.Items.Clear();
}



public void RefillBreakpointList( Map<string, List<Breakpoint>> BreakPoints )
{
foreach ( var bpList in BreakPoints.Values )
Expand Down
4 changes: 2 additions & 2 deletions C64Studio/Documents/DebugMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -854,14 +854,14 @@ public override void OnApplicationEvent( ApplicationEvent Event )

protected override void OnSizeChanged( EventArgs e )
{
Debug.Log( $"DebugMemory size changed {ClientSize}" );
//Debug.Log( $"DebugMemory size changed {ClientSize}" );
base.OnSizeChanged( e );
}


protected override void OnLocationChanged( EventArgs e )
{
Debug.Log( $"DebugMemory location changed {Location}" );
//Debug.Log( $"DebugMemory location changed {Location}" );
base.OnLocationChanged( e );
}

Expand Down
11 changes: 7 additions & 4 deletions C64Studio/Documents/SourceASMEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4363,12 +4363,15 @@ public Map<string, List<Breakpoint>> MapBreakpoints()
{
var result = new Map<string,List<Breakpoint>>();

var allBPs = new List<Breakpoint>();
foreach ( var entries in m_BreakPoints.Values )
if ( m_BreakPoints.Count > 0 )
{
allBPs.AddRange( entries );
var allBPs = new List<Breakpoint>();
foreach ( var entries in m_BreakPoints.Values )
{
allBPs.AddRange( entries );
}
result.Add( DocumentInfo.RelativePath, allBPs );
}
result.Add( DocumentInfo.RelativePath, allBPs );
return result;
}

Expand Down
27 changes: 8 additions & 19 deletions C64Studio/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1479,31 +1479,29 @@ void MainForm_ApplicationEvent( RetroDevStudio.Types.ApplicationEvent Event )
}
else
{
m_DebugBreakpoints.ClearAllBreakpointEntries();
var project = Event.Doc.Project;
if ( project != null )
if ( StudioCore.Debugging.Debugger != null )
{
foreach ( var watch in project.Settings.WatchEntries )
// projectless debugging, use watches from debugger
m_DebugWatch.ClearAllWatchEntries();
foreach ( var watch in StudioCore.Debugging.Debugger.CurrentWatches() )
{
m_DebugWatch.AddWatchEntry( watch );
}
m_DebugBreakpoints.RefillBreakpointList( project.Settings.BreakPoints );
StudioCore.Debugging.BreakPoints = project.Settings.BreakPoints;
}
else if ( StudioCore.Debugging.Debugger != null )
else if ( project != null )
{
// projectless debugging, use watches from debugger
foreach ( var watch in StudioCore.Debugging.Debugger.CurrentWatches() )
m_DebugWatch.ClearAllWatchEntries();
foreach ( var watch in project.Settings.WatchEntries )
{
m_DebugWatch.AddWatchEntry( watch );
}
m_DebugBreakpoints.RefillBreakpointList( StudioCore.Debugging.BreakPoints );
StudioCore.Debugging.BreakPoints = project.Settings.BreakPoints;
}
else if ( Event.Doc.Type == ProjectElement.ElementType.ASM_SOURCE )
{
// assembler without project
var mappedBreakpoints = ( (SourceASMEx)Event.Doc.BaseDoc ).MapBreakpoints();
m_DebugBreakpoints.RefillBreakpointList( mappedBreakpoints );
StudioCore.Debugging.BreakPoints = mappedBreakpoints;
}

Expand Down Expand Up @@ -3385,10 +3383,6 @@ public void SetActiveProject( Project NewProject )
}
if ( m_CurrentProject != NewProject )
{
if ( m_CurrentProject != null )
{
m_CurrentProject.Settings.BreakPoints = StudioCore.Debugging.BreakPoints;
}
m_CurrentProject = NewProject;
RaiseApplicationEvent( new RetroDevStudio.Types.ApplicationEvent( RetroDevStudio.Types.ApplicationEvent.Type.ACTIVE_PROJECT_CHANGED, NewProject ) );
if ( mainToolConfig.ComboBox != null )
Expand Down Expand Up @@ -3965,11 +3959,6 @@ private void SaveSettings()

m_FindReplace.ToSettings( StudioCore.Settings );

if ( m_CurrentProject != null )
{
m_CurrentProject.Settings.BreakPoints = StudioCore.Debugging.BreakPoints;
}

GR.Memory.ByteBuffer SettingsData = StudioCore.Settings.ToBuffer( StudioCore );

string settingFilename = SettingsPath();
Expand Down
2 changes: 1 addition & 1 deletion C64Studio/Navigating.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void RenameSolution( string NewSolutionPath )
string solutionParentDir = solutionFullDir.Substring( GR.Path.GetDirectoryName( solutionFullDir ).Length + 1 );
bool solutionFolderIsRenamed = ( solutionParentDir == Solution.Name );
string newSolutionFullDir = GR.Path.GetDirectoryName( NewSolutionPath );
string renamedSolutionFullDir = GR.Path.Append( GR.Path.ParentDirectory( newSolutionFullDir ), newSolutionName );
string renamedSolutionFullDir = GR.Path.Append( GR.Path.GetDirectoryName( newSolutionFullDir ), newSolutionName );
string renamedSolutionFullPath = GR.Path.Append( renamedSolutionFullDir,GR.Path.GetFileName( NewSolutionPath ) );

try
Expand Down
23 changes: 2 additions & 21 deletions Common/Common/Path.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ public static int FindNextSeparator( string Path, int Offset, string Separator =



public static string ParentDirectory( string OrigPath, string Separators = PotentialPathSeparators )
public static string GetDirectoryName( string Path, string Separators = PotentialPathSeparators )
{
string cleanEnd = RemoveSeparator( OrigPath, Separators );
string cleanEnd = RemoveSeparator( Path, Separators );

int prevPos = cleanEnd.LastIndexOfAny( Separators.ToCharArray() );
if ( prevPos == -1 )
Expand All @@ -203,25 +203,6 @@ public static string ParentDirectory( string OrigPath, string Separators = Poten



public static string GetDirectoryName( string Path, string Separators = PotentialPathSeparators )
{
string result = Path;

int pos = result.Length;

while ( pos > 0 )
{
--pos;
if ( IsSeparator( result[pos], Separators ) )
{
return result.Substring( 0, pos );
}
}
return result;
}



public static string CommonPrefix( string PathArg1, string PathArg2, string Separators = PotentialPathSeparators )
{
if ( ( String.IsNullOrEmpty( PathArg1 ) )
Expand Down
Binary file modified Sample Projects/MacroTest/MacroTest.c64
Binary file not shown.
Binary file modified Sample Projects/MacroTest/MacroTest.s64
Binary file not shown.

0 comments on commit f32d6b3

Please sign in to comment.