@@ -888,13 +888,15 @@ protected override void OnEnableBreakEvent (BreakEventInfo binfo, bool enable)
888
888
{
889
889
MtaThread . Run ( delegate
890
890
{
891
- CorBreakpoint bp = binfo . Handle as CorFunctionBreakpoint ;
892
- if ( bp != null ) {
893
- try {
894
- bp . Activate ( enable ) ;
895
- }
896
- catch ( COMException e ) {
897
- HandleBreakpointException ( binfo , e ) ;
891
+ var bpList = binfo . Handle as List < CorFunctionBreakpoint > ;
892
+ if ( bpList != null ) {
893
+ foreach ( var bp in bpList ) {
894
+ try {
895
+ bp . Activate ( enable ) ;
896
+ }
897
+ catch ( COMException e ) {
898
+ HandleBreakpointException ( binfo , e ) ;
899
+ }
898
900
}
899
901
}
900
902
} ) ;
@@ -1040,16 +1042,21 @@ protected override BreakEventInfo OnInsertBreakEvent (BreakEvent be)
1040
1042
// FIXME: implement breaking on function name
1041
1043
binfo . SetStatus ( BreakEventStatus . Invalid , "Function breakpoint is not implemented" ) ;
1042
1044
return binfo ;
1043
- } else {
1044
- DocInfo doc = null ;
1045
+ }
1046
+ else {
1047
+ var docInfos = new List < DocInfo > ( ) ;
1045
1048
lock ( appDomainsLock ) {
1046
1049
foreach ( var appDomainInfo in appDomains ) {
1047
1050
var documents = appDomainInfo . Value . Documents ;
1048
- if ( documents . TryGetValue ( Path . GetFullPath ( bp . FileName ) , out doc ) ) {
1049
- break ;
1051
+ DocInfo docInfo = null ;
1052
+ if ( documents . TryGetValue ( Path . GetFullPath ( bp . FileName ) , out docInfo ) ) {
1053
+ docInfos . Add ( docInfo ) ;
1050
1054
}
1051
1055
}
1052
1056
}
1057
+
1058
+ var doc = docInfos . FirstOrDefault ( ) ; //get info about source position using SymbolReader of first DocInfo
1059
+
1053
1060
if ( doc == null ) {
1054
1061
binfo . SetStatus ( BreakEventStatus . NotBound , string . Format ( "{0} is not found among the loaded symbol documents" , bp . FileName ) ) ;
1055
1062
return binfo ;
@@ -1145,16 +1152,22 @@ protected override BreakEventInfo OnInsertBreakEvent (BreakEvent be)
1145
1152
return binfo ;
1146
1153
}
1147
1154
1148
- CorFunction func = doc . ModuleInfo . Module . GetFunctionFromToken ( bestMethod . Token . GetToken ( ) ) ;
1149
- try {
1150
- CorFunctionBreakpoint corBp = func . ILCode . CreateBreakpoint ( bestSp . Offset ) ;
1151
- breakpoints [ corBp ] = binfo ;
1152
- binfo . Handle = corBp ;
1153
- corBp . Activate ( bp . Enabled ) ;
1154
- binfo . SetStatus ( BreakEventStatus . Bound , null ) ;
1155
- }
1156
- catch ( COMException e ) {
1157
- HandleBreakpointException ( binfo , e ) ;
1155
+ foreach ( var docInfo in docInfos ) {
1156
+ CorFunction func = docInfo . ModuleInfo . Module . GetFunctionFromToken ( bestMethod . Token . GetToken ( ) ) ;
1157
+
1158
+ try {
1159
+ CorFunctionBreakpoint corBp = func . ILCode . CreateBreakpoint ( bestSp . Offset ) ;
1160
+ breakpoints [ corBp ] = binfo ;
1161
+
1162
+ if ( binfo . Handle == null )
1163
+ binfo . Handle = new List < CorFunctionBreakpoint > ( ) ;
1164
+ ( binfo . Handle as List < CorFunctionBreakpoint > ) . Add ( corBp ) ;
1165
+ corBp . Activate ( bp . Enabled ) ;
1166
+ binfo . SetStatus ( BreakEventStatus . Bound , null ) ;
1167
+ }
1168
+ catch ( COMException e ) {
1169
+ HandleBreakpointException ( binfo , e ) ;
1170
+ }
1158
1171
}
1159
1172
return binfo ;
1160
1173
}
@@ -1298,12 +1311,14 @@ protected override void OnRemoveBreakEvent (BreakEventInfo bi)
1298
1311
1299
1312
MtaThread . Run ( delegate
1300
1313
{
1301
- CorFunctionBreakpoint corBp = ( CorFunctionBreakpoint ) bi . Handle ;
1302
- try {
1303
- corBp . Activate ( false ) ;
1304
- }
1305
- catch ( COMException e ) {
1306
- HandleBreakpointException ( bi , e ) ;
1314
+ var corBpList = ( List < CorFunctionBreakpoint > ) bi . Handle ;
1315
+ foreach ( var corBp in corBpList ) {
1316
+ try {
1317
+ corBp . Activate ( false ) ;
1318
+ }
1319
+ catch ( COMException e ) {
1320
+ HandleBreakpointException ( bi , e ) ;
1321
+ }
1307
1322
}
1308
1323
} ) ;
1309
1324
}
0 commit comments