Skip to content

Commit ecb1165

Browse files
authored
Merge pull request #1376 from microsoft/main
Merge main into 'release-cpptools' for v1.13.5
2 parents e5ef4f7 + cf94006 commit ecb1165

File tree

10 files changed

+1294
-1515
lines changed

10 files changed

+1294
-1515
lines changed

src/MICore/CommandFactories/MICommandFactory.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public virtual IEnumerable<Guid> GetSupportedExceptionCategories()
557557
/// exceptions in the category. Note that this clear all previous exception breakpoints set in this category.</param>
558558
/// <param name="exceptionBreakpointState">Indicates when the exception breakpoint should fire</param>
559559
/// <returns>Task containing the exception breakpoint id's for the various set exceptions</returns>
560-
public virtual Task<IEnumerable<ulong>> SetExceptionBreakpoints(Guid exceptionCategory, /*OPTIONAL*/ IEnumerable<string> exceptionNames, ExceptionBreakpointStates exceptionBreakpointState)
560+
public virtual Task<IEnumerable<long>> SetExceptionBreakpoints(Guid exceptionCategory, /*OPTIONAL*/ IEnumerable<string> exceptionNames, ExceptionBreakpointStates exceptionBreakpointState)
561561
{
562562
// NOTES:
563563
// GDB /MI has no support for exceptions. Though they do have it through the non-MI through a 'catch' command. Example:
@@ -573,7 +573,7 @@ public virtual Task<IEnumerable<ulong>> SetExceptionBreakpoints(Guid exceptionCa
573573
throw new NotImplementedException();
574574
}
575575

576-
public virtual Task RemoveExceptionBreakpoint(Guid exceptionCategory, IEnumerable<ulong> exceptionBreakpoints)
576+
public virtual Task RemoveExceptionBreakpoint(Guid exceptionCategory, IEnumerable<long> exceptionBreakpoints)
577577
{
578578
throw new NotImplementedException();
579579
}
@@ -658,8 +658,7 @@ public virtual bool IsAsyncBreakSignal(Results results)
658658

659659
if (results.TryFindString("reason") == "signal-received")
660660
{
661-
if (results.TryFindString("signal-name") == "SIGINT" ||
662-
results.TryFindString("signal-name") == "SIGTRAP")
661+
if (results.TryFindString("signal-name") == "SIGTRAP")
663662
{
664663
isAsyncBreak = true;
665664
}
@@ -700,4 +699,4 @@ public virtual bool SupportsBreakpointChecksums()
700699
}
701700
#endregion
702701
}
703-
}
702+
}

src/MICore/CommandFactories/gdb.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ public override IEnumerable<Guid> GetSupportedExceptionCategories()
310310
return new Guid[] { new Guid(CppExceptionCategoryString) };
311311
}
312312

313-
public override async Task<IEnumerable<ulong>> SetExceptionBreakpoints(Guid exceptionCategory, IEnumerable<string> exceptionNames, ExceptionBreakpointStates exceptionBreakpointStates)
313+
public override async Task<IEnumerable<long>> SetExceptionBreakpoints(Guid exceptionCategory, IEnumerable<string> exceptionNames, ExceptionBreakpointStates exceptionBreakpointStates)
314314
{
315315
string command;
316316
Results result;
317-
List<ulong> breakpointNumbers = new List<ulong>();
317+
List<long> breakpointNumbers = new List<long>();
318318

319319
if (exceptionNames == null) // set breakpoint for all exceptions in exceptionCategory
320320
{
@@ -353,9 +353,9 @@ public override async Task<IEnumerable<ulong>> SetExceptionBreakpoints(Guid exce
353353
return breakpointNumbers;
354354
}
355355

356-
public override async Task RemoveExceptionBreakpoint(Guid exceptionCategory, IEnumerable<ulong> exceptionBreakpoints)
356+
public override async Task RemoveExceptionBreakpoint(Guid exceptionCategory, IEnumerable<long> exceptionBreakpoints)
357357
{
358-
foreach (ulong breakpointNumber in exceptionBreakpoints)
358+
foreach (long breakpointNumber in exceptionBreakpoints)
359359
{
360360
await BreakDelete(breakpointNumber.ToString(CultureInfo.InvariantCulture));
361361
}

src/MICore/Debugger.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,9 @@ private string Escape(string str)
784784
case '\\':
785785
outStr.Append("\\\\");
786786
break;
787+
case '\n':
788+
outStr.Append("\\n");
789+
break;
787790
default:
788791
outStr.Append(str[i]);
789792
break;

src/MICore/UnixUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ internal static void Interrupt(int pid)
259259

260260
private static void Kill(int pid, int signal)
261261
{
262-
var k = Process.Start("/bin/kill", String.Format(CultureInfo.InvariantCulture, "-{0} {1}", signal, pid));
262+
var k = Process.Start("kill", String.Format(CultureInfo.InvariantCulture, "-{0} {1}", signal, pid));
263263
k.WaitForExit();
264264
}
265265
}

src/MIDebugEngine/Engine.Impl/ExceptionManager.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private class ExceptionCategorySettings
102102
// 1. Writes and reads when *NOT* on the FlushSettingsUpdates thread - collection should be locked on itself
103103
// 2. Reads on the FlushSettingsUpdates thread - no locking is needed
104104
public ExceptionBreakpointStates CategoryState;
105-
public readonly Dictionary<string, ulong> CurrentRules = new Dictionary<string, ulong>();
105+
public readonly Dictionary<string, long> CurrentRules = new Dictionary<string, long>();
106106

107107
private readonly object _updateLock = new object();
108108
/*OPTIONAL*/
@@ -302,7 +302,7 @@ public bool TryGetExceptionBreakpoint(string bkptno, ulong address, TupleValue f
302302
ExceptionCategorySettings categorySettings;
303303
if (_categoryMap.TryGetValue(CppExceptionCategoryGuid, out categorySettings))
304304
{
305-
ulong breakpointNumber = Convert.ToUInt32(bkptno, CultureInfo.InvariantCulture);
305+
long breakpointNumber = Convert.ToInt32(bkptno, CultureInfo.InvariantCulture);
306306
lock (categorySettings.CurrentRules)
307307
{
308308
exceptionName = categorySettings.CurrentRules.FirstOrDefault(pair => pair.Value == breakpointNumber).Key;
@@ -511,8 +511,8 @@ private async Task UpdateCategory(Guid categoryId, ExceptionCategorySettings cat
511511
{
512512
try
513513
{
514-
IEnumerable<ulong> breakpointIds = await _commandFactory.SetExceptionBreakpoints(categoryId, null, newCategoryState);
515-
ulong breakpointId = breakpointIds.Single();
514+
IEnumerable<long> breakpointIds = await _commandFactory.SetExceptionBreakpoints(categoryId, null, newCategoryState);
515+
long breakpointId = breakpointIds.Single();
516516
lock (categorySettings.CurrentRules)
517517
{
518518
categorySettings.CurrentRules.Add("*", breakpointId);
@@ -531,12 +531,12 @@ private async Task UpdateCategory(Guid categoryId, ExceptionCategorySettings cat
531531
if (updates.RulesToRemove.Count > 0)
532532
{
533533
// Detach these exceptions from 'CurrentRules'
534-
List<ulong> breakpointsToRemove = new List<ulong>();
534+
List<long> breakpointsToRemove = new List<long>();
535535
lock (categorySettings.CurrentRules)
536536
{
537537
foreach (string exceptionToRemove in updates.RulesToRemove)
538538
{
539-
ulong breakpointId;
539+
long breakpointId;
540540
if (!categorySettings.CurrentRules.TryGetValue(exceptionToRemove, out breakpointId))
541541
continue;
542542

@@ -575,7 +575,7 @@ private async Task UpdateCategory(Guid categoryId, ExceptionCategorySettings cat
575575
{
576576
try
577577
{
578-
IEnumerable<ulong> breakpointIds = await _commandFactory.SetExceptionBreakpoints(categoryId, exceptionNames, grouping.Key);
578+
IEnumerable<long> breakpointIds = await _commandFactory.SetExceptionBreakpoints(categoryId, exceptionNames, grouping.Key);
579579

580580
lock (categorySettings.CurrentRules)
581581
{
@@ -584,7 +584,7 @@ private async Task UpdateCategory(Guid categoryId, ExceptionCategorySettings cat
584584
// remove old breakpoint if exceptionName is in categorySettings.CurrentRules.Keys
585585
if (categorySettings.CurrentRules.ContainsKey(exceptionName))
586586
{
587-
_commandFactory.RemoveExceptionBreakpoint(categoryId, new ulong[] { categorySettings.CurrentRules[exceptionName] });
587+
_commandFactory.RemoveExceptionBreakpoint(categoryId, new long[] { categorySettings.CurrentRules[exceptionName] });
588588
}
589589
categorySettings.CurrentRules[exceptionName] = breakpointId;
590590
return 1;
@@ -609,15 +609,15 @@ private async Task UpdateCategory(Guid categoryId, ExceptionCategorySettings cat
609609
}
610610
if (!isBreakThrown)
611611
{
612-
ulong breakpointId;
612+
long breakpointId;
613613
lock (categorySettings.CurrentRules)
614614
{
615615
foreach (string exceptionName in exceptionNames)
616616
{
617617
if (!categorySettings.CurrentRules.TryGetValue(exceptionName, out breakpointId))
618618
continue;
619619

620-
_commandFactory.RemoveExceptionBreakpoint(categoryId, new ulong[] { breakpointId });
620+
_commandFactory.RemoveExceptionBreakpoint(categoryId, new long[] { breakpointId });
621621
categorySettings.CurrentRules.Remove(exceptionName);
622622
}
623623
}

0 commit comments

Comments
 (0)