-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathcordebug.idl
7860 lines (6836 loc) · 268 KB
/
cordebug.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*****************************************************************************
** **
** Cordebug.idl - Common Language Runtime Debugging interfaces. **
** **
*****************************************************************************/
/* ------------------------------------------------------------------------- *
* Imported types
* ------------------------------------------------------------------------- */
#if !DEFINITIONS_FROM_NON_IMPORTABLE_PLACES
cpp_quote("#if 0")
import "unknwn.idl";
import "objidl.idl";
typedef UINT32 mdToken;
typedef mdToken mdModule;
typedef SIZE_T mdScope;
typedef mdToken mdTypeDef;
typedef mdToken mdSourceFile;
typedef mdToken mdMemberRef;
typedef mdToken mdMethodDef;
typedef mdToken mdFieldDef;
typedef mdToken mdSignature;
typedef ULONG CorElementType;
typedef SIZE_T PCCOR_SIGNATURE;
typedef SIZE_T LPDEBUG_EVENT;
typedef SIZE_T LPSTARTUPINFOW;
typedef SIZE_T LPPROCESS_INFORMATION;
typedef const void far *LPCVOID;
cpp_quote("#endif")
typedef [wire_marshal(unsigned long)] void *HPROCESS;
typedef [wire_marshal(unsigned long)] void *HTHREAD;
typedef UINT64 TASKID;
typedef DWORD CONNID;
#endif
cpp_quote("#ifndef _COR_IL_MAP")
cpp_quote("#define _COR_IL_MAP")
// Note that this structure is also defined in CorProf.idl - PROPAGATE CHANGES
// BOTH WAYS, or this'll become a really insidious bug some day.
typedef struct _COR_IL_MAP
{
ULONG32 oldOffset; // Old IL offset relative to beginning of function
ULONG32 newOffset; // New IL offset relative to beginning of function
BOOL fAccurate; // TRUE if mapping is known to be good, FALSE otherwise
} COR_IL_MAP;
cpp_quote("#endif //_COR_IL_MAP")
cpp_quote("#ifndef _COR_DEBUG_IL_TO_NATIVE_MAP_")
cpp_quote("#define _COR_DEBUG_IL_TO_NATIVE_MAP_")
/* ICorDebugCode:: GetILToNativeMapping returns an array of
* COR_DEBUG_IL_TO_NATIVE_MAP structures. In order to convey that certain
* ranges of native instructions correspond to special regions of code (for
* example, the prolog), an entry in the array may have it's ilOffset field set
* to one of these values.
*/
typedef enum CorDebugIlToNativeMappingTypes
{
NO_MAPPING = -1,
PROLOG = -2,
EPILOG = -3
} CorDebugIlToNativeMappingTypes;
typedef struct COR_DEBUG_IL_TO_NATIVE_MAP
{
ULONG32 ilOffset;
ULONG32 nativeStartOffset;
ULONG32 nativeEndOffset;
} COR_DEBUG_IL_TO_NATIVE_MAP;
cpp_quote("#endif // _COR_DEBUG_IL_TO_NATIVE_MAP_")
cpp_quote("#define REMOTE_DEBUGGING_DLL_ENTRY L\"Software\\\\Microsoft\\\\.NETFramework\\\\Debugger\\\\ActivateRemoteDebugging\"")
typedef enum CorDebugJITCompilerFlags
{
CORDEBUG_JIT_DEFAULT = 0x1, // Track info, enable optimizations
CORDEBUG_JIT_DISABLE_OPTIMIZATION = 0x3, // Includes track info, disable opts,
CORDEBUG_JIT_ENABLE_ENC = 0x7 // Includes track & disable opt & Edit and Continue.
} CorDebugJITCompilerFlags;
typedef enum CorDebugJITCompilerFlagsDecprecated
{
CORDEBUG_JIT_TRACK_DEBUG_INFO = 0x1, // Use CORDEBUG_JIT_DEFAULT instead
} CorDebugJITCompilerFlagsDeprecated;
typedef enum CorDebugNGENPolicy
{
DISABLE_LOCAL_NIC = 1 // indicates that the native image cache for a modern application should be ignored
} CorDebugNGENPolicy;
/* ------------------------------------------------------------------------- *
* Forward declarations
* ------------------------------------------------------------------------- */
#pragma warning(push)
#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
interface ICorDebug;
interface ICorDebugController;
interface ICorDebugProcess;
interface ICorDebugProcess2;
interface ICorDebugAppDomain;
interface ICorDebugAssembly;
interface ICorDebugAssembly2;
interface ICorDebugBreakpoint;
interface ICorDebugFunctionBreakpoint;
interface ICorDebugModuleBreakpoint;
interface ICorDebugValueBreakpoint;
interface ICorDebugStepper;
interface ICorDebugEval;
interface ICorDebugEval2;
interface ICorDebugThread;
interface ICorDebugThread2;
interface ICorDebugThread3;
interface ICorDebugThread4;
interface ICorDebugThread5;
interface ICorDebugStackWalk;
interface ICorDebugChain;
interface ICorDebugFrame;
interface ICorDebugILFrame;
interface ICorDebugInternalFrame;
interface ICorDebugInternalFrame2;
interface ICorDebugNativeFrame;
interface ICorDebugNativeFrame2;
interface ICorDebugRuntimeUnwindableFrame;
interface ICorDebugContext;
interface ICorDebugModule;
interface ICorDebugFunction;
interface ICorDebugFunction2;
interface ICorDebugCode;
interface ICorDebugILCode;
interface ICorDebugClass;
interface ICorDebugType;
interface ICorDebugValue;
interface ICorDebugGenericValue;
interface ICorDebugReferenceValue;
interface ICorDebugHeapValue;
interface ICorDebugHeapValue2;
interface ICorDebugHeapValue3;
interface ICorDebugHeapValue4;
interface ICorDebugHandleValue;
interface ICorDebugObjectValue;
interface ICorDebugStringValue;
interface ICorDebugArrayValue;
interface ICorDebugEnum;
interface ICorDebugObjectEnum;
interface ICorDebugProcessEnum;
interface ICorDebugBreakpointEnum;
interface ICorDebugStepperEnum;
interface ICorDebugModuleEnum;
interface ICorDebugThreadEnum;
interface ICorDebugChainEnum;
interface ICorDebugTypeEnum;
interface ICorDebugCodeEnum;
interface ICorDebugFrameEnum;
interface ICorDebugValueEnum;
interface ICorDebugVariableHomeEnum;
interface ICorDebugAppDomainEnum;
interface ICorDebugAssemblyEnum;
interface ICorDebugBlockingObjectEnum;
interface ICorDebugErrorInfoEnum;
interface ICorDebugMDA;
/* DEPRECATED */
interface ICorDebugEditAndContinueSnapshot;
/* DEPRECATED */
interface ICorDebugEditAndContinueErrorInfo;
#pragma warning(pop)
// All target addresses in ICorDebug are represented as 0-extended 64-bit integer values.
typedef ULONG64 CORDB_ADDRESS;
typedef ULONG64 CORDB_REGISTER;
typedef DWORD CORDB_CONTINUE_STATUS;
typedef enum CorDebugBlockingReason {
BLOCKING_NONE = 0x0,
BLOCKING_MONITOR_CRITICAL_SECTION = 0x1,
BLOCKING_MONITOR_EVENT = 0x2
} CorDebugBlockingReason;
typedef struct CorDebugBlockingObject {
ICorDebugValue *pBlockingObject;
DWORD dwTimeout;
CorDebugBlockingReason blockingReason;
} CorDebugBlockingObject;
typedef struct CorDebugExceptionObjectStackFrame
{
ICorDebugModule* pModule;
CORDB_ADDRESS ip;
mdMethodDef methodDef;
BOOL isLastForeignExceptionFrame;
} CorDebugExceptionObjectStackFrame;
typedef struct CorDebugGuidToTypeMapping
{
GUID iid;
ICorDebugType * pType;
} CorDebugGuidToTypeMapping;
/*
* Callback interface for providing access to a particular target process. The
* debugging services will call functions on this interface to access memory
* and other data in the target process. The debugger client must implement
* this interface as appropriate for the particular target (for example, a live
* process or a memory dump). The DataTarget will only be invoked from within
* the implementation of other ICorDebug APIs (i.e. the debugger client has
* control over which thread it is invoked on, and when)
*
* Error HRESULTS returned by DataTarget APIs will propagate up and be returned
* by the active ICorDebug API call.
*
* The DataTarget implementation must always return up-to-date information
* about the target. The target process should be stopped (not changing
* in any way) while ICorDebug APIs (and hence DataTarget APIs) are being
* called. If the target is a live process and it's state changes,
* OpenVirtualProcess needs to be called again to provide a replacement
* ICorDebugProcess instance.
*/
[
object,
local,
uuid(FE06DC28-49FB-4636-A4A3-E80DB4AE116C),
pointer_default(unique)
]
interface ICorDebugDataTarget : IUnknown
{
/*
* GetPlatform returns the processor architecture and operating system on
* which the target process is (or was) running.
*
* This is used by ICorDebug to determine details of the target process
* such as its pointer size, address space layout, register set,
* instruction format, context layout, and calling conventions, etc.
* This platforms in this list are the only ones supported by this version
* of ICorDebug, but more may be added in future versions.
*
* Note that this may actually indicate the platform which is being
* emulated for the target, not the actual hardware in use. For example,
* a process running in the WOW on Windows x64 should use
* CORDB_PLATFORM_WINDOWS_X86.
*
* Implementations should be sure to describe what the platform of the
* target actually is, not just what the host expects it to be.
*
* This function must succeed. If it fails, the DataTarget is unusable.
*/
typedef enum CorDebugPlatform
{
CORDB_PLATFORM_WINDOWS_X86, // Windows on Intel x86
CORDB_PLATFORM_WINDOWS_AMD64, // Windows x64 (Amd64, Intel EM64T)
CORDB_PLATFORM_WINDOWS_IA64, // Windows on Intel IA-64
CORDB_PLATFORM_MAC_PPC, // Mac OS on PowerPC (Deprecated)
CORDB_PLATFORM_MAC_X86, // Mac OS on Intel x86 (Deprecated, use CORDB_PLATFORM_POSIX_X86)
CORDB_PLATFORM_WINDOWS_ARM, // Windows on ARM
CORDB_PLATFORM_MAC_AMD64, // Mac OS on Intel x64 (Deprecated, use CORDB_PLATFORM_POSIX_AMD64)
CORDB_PLATFORM_WINDOWS_ARM64, // Windows on ARM64
CORDB_PLATFORM_POSIX_AMD64, // Posix supporting OS on Intel x64
CORDB_PLATFORM_POSIX_X86, // Posix supporting OS on Intel x86
CORDB_PLATFORM_POSIX_ARM, // Posix supporting OS on ARM32
CORDB_PLATFORM_POSIX_ARM64, // Posix supporting OS on ARM64
CORDB_PLATFORM_POSIX_LOONGARCH64, // Posix supporting OS on LoongArch64
CORDB_PLATFORM_POSIX_RISCV64 // Posix supporting OS on RISC64
} CorDebugPlatform;
HRESULT GetPlatform([out] CorDebugPlatform * pTargetPlatform);
/*
* ReadVirtual - Read virtual memory from the target process.
*
* Requests contiguous memory starting at the specified target address to
* be read from the target process into the supplied buffer. If at least
* the first byte (at the specified start address) can be read, the call
* should return success (to support efficient reading of data structures
* with self-describing length, like null-terminated strings).
*
* On success, the actual number of bytes read must be stored into
* pBytesRead.
*/
HRESULT ReadVirtual([in] CORDB_ADDRESS address,
[out, size_is(bytesRequested), length_is(*pBytesRead)] BYTE * pBuffer,
[in] ULONG32 bytesRequested,
[out] ULONG32 * pBytesRead);
/*
* GetThreadContext - Get the thread context (register values) for a thread.
*
* Requests the current thread context for the specified (operating-system
* defined) thread identifier. The size and format of the context record
* is platform dependant, and is determined by the result of the call to
* GetPlatform.
*
* The context flags specify, in a platform-dependent manor, which portions
* of the context should be read. contextSize specifies the size of the
* supplied buffer, but the function is free to not fill the whole buffer
* if it is possible to determine the actual size from the context.
*
* On Windows platforms, the buffer must be a CONTEXT structure appropriate
* for the machine type specified by GetPlatform. contextFlags has the
* same values as the ContextFlags field of CONTEXT.
*/
HRESULT GetThreadContext([in] DWORD dwThreadID,
[in] ULONG32 contextFlags,
[in] ULONG32 contextSize,
[out, size_is(contextSize)] BYTE * pContext);
};
/*
* Used to retrieve the debug-symbol information for a static field.
*/
[
object,
local,
uuid(CBF9DA63-F68D-4BBB-A21C-15A45EAADF5B),
pointer_default(unique)
]
interface ICorDebugStaticFieldSymbol : IUnknown
{
/*
* GetName - gives the name of the static field
*/
HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
/*
* GetSize - gives the size of the static field
*/
HRESULT GetSize([out] ULONG32 *pcbSize);
/*
* GetAddress - gives the RVA of the static field
*/
HRESULT GetAddress([out] CORDB_ADDRESS *pRVA);
}
/*
* Used to retrieve the debug-symbol information for an instance field.
*/
[
object,
local,
uuid(A074096B-3ADC-4485-81DA-68C7A4EA52DB),
pointer_default(unique)
]
interface ICorDebugInstanceFieldSymbol : IUnknown
{
/*
* GetName - gives the name of the instance field
*/
HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
/*
* GetSize - gives the size of the instance field
*/
HRESULT GetSize([out] ULONG32 *pcbSize);
/*
* GetOffset - gives the offset of the instance field in its parent class
*/
HRESULT GetOffset([out] ULONG32 *pcbOffset);
}
/*
* Used to retrieve the debug-symbol information for a variable.
*/
[
object,
local,
uuid(707E8932-1163-48D9-8A93-F5B1F480FBB7),
pointer_default(unique)
]
interface ICorDebugVariableSymbol : IUnknown
{
/*
* GetName - gives the name of the variable
*/
HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
/*
* GetSize - gives the size of a variable
*/
HRESULT GetSize([out] ULONG32 *pcbValue);
/*
* GetValue - Used to get the value of a variable as a byte array.
*
* offset: read the value starting at this offset in variable, this is used when reading member fields in an object
* context: thread context used to read the value
* cbContext: size of thread context
*
* cbValue: size of pValue buffer
* pcbValue: size of pValue buffer filled with value
* pValue: buffer used to hold the read value
*/
HRESULT GetValue([in] ULONG32 offset,
[in] ULONG32 cbContext,
[in, size_is(cbContext)] BYTE context[],
[in] ULONG32 cbValue,
[out] ULONG32 *pcbValue,
[out, size_is(cbValue), length_is(*pcbValue)] BYTE pValue[]);
/*
* SetValue - Given a byte array, sets it as the value of the variable.
*
* offset: set the value starting at this offset in variable, this is used when writing member fields in an object
* threadID: thread id used to indentify the thread whose context must be updated to reflect the new value
* context: thread context used to write the value
* cbContext: size of thread context
*
* cbValue: size of pValue buffer
* pValue: buffer to hold the value to set
*/
HRESULT SetValue([in] ULONG32 offset,
[in] DWORD threadID,
[in] ULONG32 cbContext,
[in, size_is(cbContext)] BYTE context[],
[in] ULONG32 cbValue,
[in, size_is(cbValue)] BYTE pValue[]);
/*
* GetSlotIndex - Gives the managed slot-index of a local variable.
* This slot-index can be used to retrieve the metadata information for this local.
*
* Returns E_FAIL if the variable is a function argument.
*/
HRESULT GetSlotIndex([out] ULONG32 *pSlotIndex);
}
/*
* Represents an in-memory buffer.
*/
[
object,
uuid(677888B3-D160-4B8C-A73B-D79E6AAA1D13),
local,
pointer_default(unique)
]
interface ICorDebugMemoryBuffer : IUnknown
{
/*
* GetStartAddress - Gives the address where buffer starts.
*/
HRESULT GetStartAddress([out] LPCVOID *address);
/*
* GetStartAddress - Gives the size of memory buffer.
*/
HRESULT GetSize([out] ULONG32 *pcbBufferLength);
}
/*
* Used to get information about a merged assembly.
*/
[
object,
uuid(FAA8637B-3BBE-4671-8E26-3B59875B922A),
local,
pointer_default(unique)
]
interface ICorDebugMergedAssemblyRecord : IUnknown
{
/*
* GetSimpleName - Gives the simple name of the assembly (for example "System.Collections")
* These names do not include qualifiers such as file extensions, culture, version, or public key token
*/
HRESULT GetSimpleName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
/*
* GetVersion - Gives the assembly version information
*/
HRESULT GetVersion([out] USHORT *pMajor, [out] USHORT *pMinor, [out] USHORT *pBuild, [out] USHORT *pRevision);
/*
* GetCulture - Gives culture string for the assembly (for example "neutral" or "en-US")
*/
HRESULT GetCulture([in] ULONG32 cchCulture, [out] ULONG32 *pcchCulture, [out, size_is(cchCulture), length_is(*pcchCulture)] WCHAR szCulture[]);
/*
* GetPublicKey - Gives the assembly public key
*/
HRESULT GetPublicKey([in] ULONG32 cbPublicKey, [out] ULONG32 *pcbPublicKey, [out, size_is(cbPublicKey), length_is(*pcbPublicKey)] BYTE pbPublicKey[]);
/*
* GetPublicKeyToken - Gives the assembly public key token (the last 8 bytes of a SHA1 hash of the public key)
*/
HRESULT GetPublicKeyToken([in] ULONG32 cbPublicKeyToken, [out] ULONG32 *pcbPublicKeyToken,
[out, size_is(cbPublicKeyToken), length_is(*pcbPublicKeyToken)] BYTE pbPublicKeyToken[]);
/*
* GetIndex - Gives prefix index used to prevent name collisions in the merged metadata type names
*/
HRESULT GetIndex([out] ULONG32 *pIndex);
}
/*
* Used to retrieve debug symbol information.
*/
[
object,
uuid(3948A999-FD8A-4C38-A708-8A71E9B04DBB),
local,
pointer_default(unique)
]
interface ICorDebugSymbolProvider : IUnknown
{
/*
* GetStaticFieldSymbols - given a typespec signature, gives back its static field symbols
*/
HRESULT GetStaticFieldSymbols([in] ULONG32 cbSignature,
[in, size_is(cbSignature)] BYTE typeSig[],
[in] ULONG32 cRequestedSymbols,
[out] ULONG32 *pcFetchedSymbols,
[out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugStaticFieldSymbol *pSymbols[]);
/*
* GetInstanceFieldSymbols - given a typespec signature, gives back its instance field symbols
*/
HRESULT GetInstanceFieldSymbols([in] ULONG32 cbSignature,
[in, size_is(cbSignature)] BYTE typeSig[],
[in] ULONG32 cRequestedSymbols,
[out] ULONG32 *pcFetchedSymbols,
[out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugInstanceFieldSymbol *pSymbols[]);
/*
* GetMethodLocalSymbols - given rva in a method, gives back its local symbols
*/
HRESULT GetMethodLocalSymbols([in] ULONG32 nativeRVA,
[in] ULONG32 cRequestedSymbols,
[out] ULONG32 *pcFetchedSymbols,
[out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugVariableSymbol *pSymbols[]);
/*
* GetMethodParameterSymbols - given rva in a method, gives back its parameter symbols
*/
HRESULT GetMethodParameterSymbols([in] ULONG32 nativeRVA,
[in] ULONG32 cRequestedSymbols,
[out] ULONG32 *pcFetchedSymbols,
[out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugVariableSymbol *pSymbols[]);
/*
* GetMergedAssemblyRecords - gets symbol records for all the merged assemblies
*/
HRESULT GetMergedAssemblyRecords([in] ULONG32 cRequestedRecords,
[out] ULONG32 *pcFetchedRecords,
[out, size_is(cRequestedRecords), length_is(*pcFetchedRecords)] ICorDebugMergedAssemblyRecord *pRecords[]);
/*
* GetMethodProps - given an rva in a method, gives back the
* pMethodToken - method's token
* pcGenericParams - number of generic parameters associated with this method
* cbSignature - size of signature array, set to 0 and pass signature as NULL to get the actual size in pcbSignature
* pcbSignature - returned size of signature
* signature - buffer to hold the type-spec signatures of all generic parameters
*/
HRESULT GetMethodProps([in] ULONG32 codeRva,
[out] mdToken *pMethodToken,
[out] ULONG32 *pcGenericParams,
[in] ULONG32 cbSignature,
[out] ULONG32 *pcbSignature,
[out, size_is(cbSignature), length_is(*pcbSignature)] BYTE signature[]);
/*
* GetTypeProps - given a vtable rva, gives back the
* cbSignature - size of signature array, set to 0 and pass signature as NULL to get the actual size in pcbSignature
* pcbSignature - returned size of signature
* signature - buffer to hold the signature of type corresponding to input vtableRva
*/
HRESULT GetTypeProps([in] ULONG32 vtableRva,
[in] ULONG32 cbSignature,
[out] ULONG32 *pcbSignature,
[out, size_is(cbSignature), length_is(*pcbSignature)] BYTE signature[]);
/*
* GetCodeRange - given rva in a method, gives back the method start address and size.
*/
HRESULT GetCodeRange([in] ULONG32 codeRva, [out] ULONG32* pCodeStartAddress, ULONG32* pCodeSize);
/*
* GetAssemblyImageBytes - given an RVA in the merged assembly and size, reads data from the merged assembly and gives it back as an ICorDebugMemoryBuffer
*/
HRESULT GetAssemblyImageBytes([in] CORDB_ADDRESS rva, [in] ULONG32 length, [out] ICorDebugMemoryBuffer** ppMemoryBuffer);
/*
* GetObjectSize - given a typespec signature, gives back its object size
*/
HRESULT GetObjectSize([in] ULONG32 cbSignature,
[in, size_is(cbSignature)] BYTE typeSig[],
[out] ULONG32 *pObjectSize);
/*
* GetAssemblyImageMetadata - gives back the merged assembly metadata as an ICorDebugMemoryBuffer
*/
HRESULT GetAssemblyImageMetadata([out] ICorDebugMemoryBuffer** ppMemoryBuffer);
}
/*
* Used to retrieve debug symbol information.
*/
[
object,
uuid(F9801807-4764-4330-9E67-4F685094165E),
local,
pointer_default(unique)
]
interface ICorDebugSymbolProvider2 : IUnknown
{
/*
* Gives back the generic dictionary map as an ICorDebugMemoryBuffer
*
* At the highest level, the map consists of two sections.
* The first section contains a "directory" of all dictionaries (RVA) covered by this map, the second section
* is a byte aligned heap with instantiation information starting right after the last directory entry.
* Each entry in the "directory" refers to an offset inside the "heap" (relative to the start of the heap).
* Please note that it is possible that multiple directory entries point to the same offset into the heap.
*
* Contents of the map:
*
* - First 4 bytes: number of RVA/dictionary entries (N)
* If the high bit is set, the following N entries are sorted by RVA in ascending order.
*
* - N 8 byte wide entries, each entry consisting of 2 4-byte entries:
* 1st 4 byte entry - RVA: the dictionary's RVA
* 2nd 4 byte entry - Offset: an offset relative to the start of the heap.
*
* - Heap
*
* The heap's size can be computed be a stream reader by subtracting the directory size + 4.
*
* The format for each instantiation info in heap is as follows:
* - Length of this instantiation info (in bytes, not including this length information) in compressed ECMA metadata format.
* - Number of instantiation types (T, in compressed ECMA metadata format)
* - T types, each expressed in ECMA type signature format
*
* The inclusion of the length for each heap element enables simple sorting of the directory section without affecting the heap.
*/
HRESULT GetGenericDictionaryInfo([out] ICorDebugMemoryBuffer** ppMemoryBuffer);
/*
* GetFrameProps:
* For a given code-rva, gives the method start rva (pCodeStartRva) and parent
* frame's start rva (pParentFrameStartRva).
* If there is no parent frame, then pParentFrameStartRva is set to 0
*/
HRESULT GetFrameProps([in] ULONG32 codeRva,
[out] ULONG32 *pCodeStartRva,
[out] ULONG32 *pParentFrameStartRva);
}
/*
* Implemented by the debugger and helps in stack unwinding.
*/
[
object,
uuid(F69126B7-C787-4F6B-AE96-A569786FC670),
local,
pointer_default(unique)
]
interface ICorDebugVirtualUnwinder : IUnknown
{
/*
* Get the current context of this unwinder.
*
* contextBuf is passed in by ICorDebugStackWalk. As unwinding may only restore a subset of the
* registers, such as only non-volatile registers, the context may not exactly match the register
* state at the time of the actual call.
*
* Any failing HRESULT received by mscordbi is considered fatal and will cause ICorDebug
* APIs to return CORDBG_E_DATA_TARGET_ERROR.
*/
HRESULT GetContext([in] ULONG32 contextFlags,
[in] ULONG32 cbContextBuf,
[out] ULONG32* contextSize,
[out, size_is(cbContextBuf)] BYTE contextBuf[]);
/*
* Advances to the callers context.
*
* If a failing HRESULT is returned ICorDebug APIs will return CORDBG_E_DATA_TARGET_ERROR.
* If the unwind can not be completed because there are no more frames the unwinder should
* return CORDBG_S_AT_END_OF_STACK.
* If the unwind occurred successfully return S_OK.
*
* The stackwalker should ensure forward progress is being made, so that eventually a call
* to Next() will return a failing HRESULT or CORDBG_S_AT_END_OF_STACK. Returning S_OK
* indefinitely may cause an infinite loop.
*/
HRESULT Next();
}
[
object,
uuid(2eb364da-605b-4e8d-b333-3394c4828d41),
local,
pointer_default(unique)
]
interface ICorDebugDataTarget2 : IUnknown
{
/*
* GetImageFromPointer:
* Given address in a module, gives back the module base address and size.
*/
HRESULT GetImageFromPointer([in] CORDB_ADDRESS addr, [out] CORDB_ADDRESS *pImageBase, [out] ULONG32 *pSize);
/*
* GetImageLocation:
* Given module base address, gives back the module's path.
*/
HRESULT GetImageLocation([in] CORDB_ADDRESS baseAddress,
[in] ULONG32 cchName,
[out] ULONG32 *pcchName,
[out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
/*
* GetImageLocation:
* Given address in a module, gives back a symbol-provider for the module.
*/
HRESULT GetSymbolProviderForImage([in] CORDB_ADDRESS imageBaseAddress, [out] ICorDebugSymbolProvider **ppSymProvider);
/*
* EnumerateThreadIDs:
* Gives back the list of active thread ids.
*/
HRESULT EnumerateThreadIDs([in] ULONG32 cThreadIds, [out] ULONG32 *pcThreadIds, [out, size_is(cThreadIds), length_is(*pcThreadIds)] ULONG32 pThreadIds[]);
/*
* CreateVirtualUnwinder:
* Create a new stack unwinder that starts unwinding from initialContext (which isn't
* necessarily the leaf of a thread).
* Any failing HRESULT received by mscordbi is considered fatal and will cause ICorDebug
* APIs to return CORDBG_E_DATA_TARGET_ERROR.
*/
HRESULT CreateVirtualUnwinder([in] DWORD nativeThreadID,
[in] ULONG32 contextFlags,
[in] ULONG32 cbContext,
[in, size_is(cbContext)] BYTE initialContext[],
[out] ICorDebugVirtualUnwinder ** ppUnwinder);
};
/*
* Provides the information about a loaded module.
* Note that this interface is implemented by debugger and is used by DBI to get
* the loaded module information from debugger.
*/
[
object,
uuid(817F343A-6630-4578-96C5-D11BC0EC5EE2),
local,
pointer_default(unique)
]
interface ICorDebugLoadedModule : IUnknown
{
/*
* gives the base address
*/
HRESULT GetBaseAddress([out] CORDB_ADDRESS *pAddress);
/*
* gives the module name
*/
HRESULT GetName([in] ULONG32 cchName,
[out] ULONG32 *pcchName,
[out, size_is(cchName),
length_is(*pcchName)] WCHAR szName[]);
/*
* gives the module size
*/
HRESULT GetSize([out] ULONG32 *pcBytes);
};
[
object,
uuid(D05E60C3-848C-4E7D-894E-623320FF6AFA),
local,
pointer_default(unique)
]
interface ICorDebugDataTarget3 : IUnknown
{
/*
* gives back the list of modules loaded so far.
*/
HRESULT GetLoadedModules([in] ULONG32 cRequestedModules,
[out] ULONG32 *pcFetchedModules,
[out, size_is(cRequestedModules),
length_is(*pcFetchedModules)] ICorDebugLoadedModule *pLoadedModules[]);
};
/*
* Data target that knows how to obtain debugee's process id.
* Debugee is not necessarily a living process at that time or on the same machine.
*/
[
object,
uuid(E799DC06-E099-4713-BDD9-906D3CC02CF2),
local,
pointer_default(unique)
]
interface ICorDebugDataTarget4 : IUnknown
{
/*
* Unwinds one native stack frame in the target process/thread
*/
HRESULT VirtualUnwind([in] DWORD threadId,
[in] ULONG32 contextSize,
[in, out, size_is(contextSize)] BYTE *context);
};
/*
* Mutable extension to the data target. This version of ICorDebugDataTarget
* can be implemented by targets that wish to support modification of the target
* process (such as for live invasive debugging).
*
* All of these APIs are optional in the sense that no core inspection-based
* debugging functionality will be lost by not implementing this interface or
* by the failure of these methods. Any failure HRESULT from these APIs will
* propagate out as the HRESULT from the ICorDebug API call.
*
* Note that a single ICorDebug API call may result in multiple mutations,
* and there is no mechanism for ensuring related mutations are applied
* transactionally (all-or-none). This means that if a mutation fails after
* others (for the same ICorDebug call) have succeeded, the target process may
* be left in an inconsistent state and debugging may become unreliable.
*/
[
object,
uuid(A1B8A756-3CB6-4CCB-979F-3DF999673A59),
local,
pointer_default(unique)
]
interface ICorDebugMutableDataTarget : ICorDebugDataTarget
{
/*
* WriteVirtual - write memory into the target process address space
*
* Write the specified buffer into the target process at the specified
* address. If any bytes cannot be written, the call should fail without
* changing any bytes in the target (otherwise the target may be in an
* inconsistent state which makes further debugging unreliable).
*/
HRESULT WriteVirtual([in] CORDB_ADDRESS address,
[in, size_is(bytesRequested)] const BYTE * pBuffer,
[in] ULONG32 bytesRequested);
/*
* SetThreadContext - set the context (register values) for a thread.
*
* Updates the current context for the thread specified by the (OS-defined)
* dwThreadID. The format of the context record is determined by the platform
* indicated by GetPlatform. On Windows, this is a CONTEXT structure.
* contextSize specifies the size of the buffer being passed.
*/
HRESULT SetThreadContext([in] DWORD dwThreadID,
[in] ULONG32 contextSize,
[in, size_is(contextSize)] const BYTE * pContext);
/*
* Invoke to change the continue-status for the outstanding debug-event on
* the specified thread.
*
* Arguments:
* dwThreadId - OS Thread Id of the debug event
* continueStatus - New continue status being requested. See the
* definition of CORDB_CONTINUE_STATUS for details.
*
* This API is used when the Debugger makes an ICorDebug API request
* which requires the current debug event to be handled in a way that is
* potentially different from which it would be otherwise. For example,
* if there is an outstanding exception, and the debugger requests an
* operation that would cancel the exception (such as SetIp or FuncEval),
* than this API is used to request the exception be cancelled.
*/
HRESULT ContinueStatusChanged([in] DWORD dwThreadId,
[in] CORDB_CONTINUE_STATUS continueStatus);
};
/*
* Interface used by the data access services layer to locate metadata
* of assemblies in a target.
*
* The API client must implement this interface as appropriate for the
* particular target (for example, a live process or a memory dump).
*
*/
[
object,
local,
uuid(7cef8ba9-2ef7-42bf-973f-4171474f87d9),
pointer_default(unique)
]
interface ICorDebugMetaDataLocator : IUnknown
{
/*
* Ask the debugger to return the full path to a module whose metadata is
* needed to complete an operation the debugger requested.
*
* Arguments:
* wszImagePath - This buffer will always contain a NULL-terminated string
* representing the full path to the file when available, and the
* FileName.extension otherwise.
* dwImageTimeStamp - The TimeStamp from the image's PE headers; can
* potentially be used for a symsrv lookup.
* dwImageSize - Size of the image from PE headers; potentially used for
* a symsrv lookup.
* cchPathBuffer - The count of WCHARs pointed to by wszPathBuffer.
* pcchPathBuffer - When the callee returns E_NOT_SUFFICIENT_BUFFER, contains
* the count of WCHARs needed to store the path.
* For all other return values, pcchPathBuffer contains the count of
* WCHARs written to wszPathBuffer.
* wszPathBuffer - Pointer to a buffer into which the debugger will copy
* the full path to the file containing the requested metadata.
* CorOpenFlags.ofReadOnly access to the metadata in this file will
* be requested.
*
* Assumptions:
* The returned file represents a Windows module containing the metadata
* needed to complete a request made by the debugger.
*
* Return Value:
* S_OK on success. wszPathBuffer contains the full path to the file and
* is NULL-terminated.
*
* E_NOT_SUFFICIENT_BUFFER if the current size of wszPathBuffer is not
* sufficient to hold the full path. pcchPathBuffer will contain the
* needed count of WCHARs, including the terminating NULL.
* In this case GetMetaData will be called a second time with the
* requested buffer size.
*
* All other failure HRESULTs are interpreted to mean that the file
* is not retrievable.
*
* Notes:
* If wszImagePath contains a full path for a module from a dump, that
* path will be the path from the machine where the dump was collected.
* The file may not exist at this location, or an incorrect file with the
* same name may be stored on the path.
*/
HRESULT GetMetaData( [in] LPCWSTR wszImagePath,
[in] DWORD dwImageTimeStamp,
[in] DWORD dwImageSize,
[in] ULONG32 cchPathBuffer,
[out, annotation("_Out_")] ULONG32 * pcchPathBuffer,
[out, size_is(cchPathBuffer), length_is(*pcchPathBuffer), annotation("_Out_writes_to_(cchPathBuffer, *pcchPathBuffer) ")] WCHAR wszPathBuffer[]);
};
/* ------------------------------------------------------------------------- *
* User Callback interface
* ------------------------------------------------------------------------- */
#pragma warning(push)
#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugManagedCallback */
/*
* ICorDebugManagedCallback is implemented by the user of the
* ICorDebug interfaces in order to respond to events in managed code
* in the debuggee process.
* This interface handles manage debug events from v1.0/v1.1
*/
[
object,
local,
uuid(3d6f5f60-7538-11d3-8d5b-00104b35e7ef),
pointer_default(unique)
]
interface ICorDebugManagedCallback : IUnknown
{
/*
* All callbacks are called with the process in the synchronized state