This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/
xclrdata.idl
2552 lines (2237 loc) · 87.6 KB
/
xclrdata.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.
// See the LICENSE file in the project root for more information.
/*****************************************************************************
** **
** clrdata.idl - Common Language Runtime data access interfaces for **
** clients needing to access runtime state from outside **
** runtime, such as out-of-process debuggers. **
** **
** The access interface defines two different types of code running: **
** The host is the user of the access interface. **
** The target is the target of the access. **
** **
** The host and target can be have different instruction sets, **
** pointer sizes, runtime versions and so on. **
** **
*****************************************************************************/
import "clrdata.idl";
cpp_quote("#if 0")
typedef UINT32 mdToken;
typedef mdToken mdTypeDef;
typedef mdToken mdMethodDef;
typedef mdToken mdFieldDef;
typedef ULONG CorElementType;
#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
// The following definition is pasted in from winnt.h, which doesn't
// import cleanly as a whole.
typedef struct _EXCEPTION_RECORD64 {
DWORD ExceptionCode;
DWORD ExceptionFlags;
DWORD64 ExceptionRecord;
DWORD64 ExceptionAddress;
DWORD NumberParameters;
DWORD __unusedAlignment;
DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
} EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
cpp_quote("#endif")
/* ------------------------------------------------------------------------- *
* Forward declarations.
* ------------------------------------------------------------------------- */
/*
* The following interfaces (with an "IX" prefix instead of the conventional
* "I") are works in progress. They will change at least once before Whidbey
* ships.
*/
#pragma warning(push)
#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
interface IXCLRDataProcess;
interface IXCLRDataAppDomain;
interface IXCLRDataAssembly;
interface IXCLRDataModule;
interface IXCLRDataModule2;
interface IXCLRDataTypeDefinition;
interface IXCLRDataTypeInstance;
interface IXCLRDataMethodDefinition;
interface IXCLRDataMethodInstance;
interface IXCLRDataTask;
interface IXCLRDataStackWalk;
interface IXCLRDataFrame;
interface IXCLRDataFrame2;
interface IXCLRDataExceptionState;
interface IXCLRDataExceptionNotification;
interface IXCLRDataValue;
interface IXCLRDataTarget3;
interface IXCLRDataDisplay;
#pragma warning(pop)
typedef struct
{
CLRDATA_ADDRESS startAddress;
CLRDATA_ADDRESS endAddress;
} CLRDATA_ADDRESS_RANGE;
/*
* Many enumerators are based on an opaque state bundle.
*/
typedef ULONG64 CLRDATA_ENUM;
/*
* Exception code used for notifications in this interface.
*/
cpp_quote("#define CLRDATA_NOTIFY_EXCEPTION 0xe0444143")
/*
* General requests shared by two or more interfaces.
*/
typedef enum
{
CLRDATA_REQUEST_REVISION = 0xe0000000,
} CLRDataGeneralRequest;
/*
* The following three sets of flags share
* many common definitions are so are
* grouped into a block.
*/
typedef enum
{
CLRDATA_TYPE_DEFAULT = 0x00000000,
// Identify particular kinds of types. These flags
// are shared between type, field and value.
CLRDATA_TYPE_IS_PRIMITIVE = 0x00000001,
CLRDATA_TYPE_IS_VALUE_TYPE = 0x00000002,
CLRDATA_TYPE_IS_STRING = 0x00000004,
CLRDATA_TYPE_IS_ARRAY = 0x00000008,
CLRDATA_TYPE_IS_REFERENCE = 0x00000010,
CLRDATA_TYPE_IS_POINTER = 0x00000020,
CLRDATA_TYPE_IS_ENUM = 0x00000040,
// Alias for all field kinds.
CLRDATA_TYPE_ALL_KINDS = 0x7f,
} CLRDataTypeFlag;
typedef enum
{
CLRDATA_FIELD_DEFAULT = 0x00000000,
// Identify particular kinds of types. These flags
// are shared between type, field and value.
CLRDATA_FIELD_IS_PRIMITIVE = CLRDATA_TYPE_IS_PRIMITIVE,
CLRDATA_FIELD_IS_VALUE_TYPE = CLRDATA_TYPE_IS_VALUE_TYPE,
CLRDATA_FIELD_IS_STRING = CLRDATA_TYPE_IS_STRING,
CLRDATA_FIELD_IS_ARRAY = CLRDATA_TYPE_IS_ARRAY,
CLRDATA_FIELD_IS_REFERENCE = CLRDATA_TYPE_IS_REFERENCE,
CLRDATA_FIELD_IS_POINTER = CLRDATA_TYPE_IS_POINTER,
CLRDATA_FIELD_IS_ENUM = CLRDATA_TYPE_IS_ENUM,
// Alias for all field kinds.
CLRDATA_FIELD_ALL_KINDS = CLRDATA_TYPE_ALL_KINDS,
// Identify field properties. These flags are
// shared between field and value.
CLRDATA_FIELD_IS_INHERITED = 0x00000080,
CLRDATA_FIELD_IS_LITERAL = 0x00000100,
// Identify field storage location. These flags are
// shared between field and value.
CLRDATA_FIELD_FROM_INSTANCE = 0x00000200,
CLRDATA_FIELD_FROM_TASK_LOCAL = 0x00000400,
CLRDATA_FIELD_FROM_STATIC = 0x00000800,
// Alias for all types of field locations.
CLRDATA_FIELD_ALL_LOCATIONS = 0x00000e00,
// Alias for all fields from all locations.
CLRDATA_FIELD_ALL_FIELDS = 0x00000eff,
} CLRDataFieldFlag;
typedef enum
{
CLRDATA_VALUE_DEFAULT = 0x00000000,
// Identify particular kinds of types. These flags
// are shared between type, field and value.
CLRDATA_VALUE_IS_PRIMITIVE = CLRDATA_TYPE_IS_PRIMITIVE,
CLRDATA_VALUE_IS_VALUE_TYPE = CLRDATA_TYPE_IS_VALUE_TYPE,
CLRDATA_VALUE_IS_STRING = CLRDATA_TYPE_IS_STRING,
CLRDATA_VALUE_IS_ARRAY = CLRDATA_TYPE_IS_ARRAY,
CLRDATA_VALUE_IS_REFERENCE = CLRDATA_TYPE_IS_REFERENCE,
CLRDATA_VALUE_IS_POINTER = CLRDATA_TYPE_IS_POINTER,
CLRDATA_VALUE_IS_ENUM = CLRDATA_TYPE_IS_ENUM,
// Alias for all value kinds.
CLRDATA_VALUE_ALL_KINDS = CLRDATA_TYPE_ALL_KINDS,
// Identify field properties. These flags are
// shared between field and value.
CLRDATA_VALUE_IS_INHERITED = CLRDATA_FIELD_IS_INHERITED,
CLRDATA_VALUE_IS_LITERAL = CLRDATA_FIELD_IS_LITERAL,
// Identify field storage location. These flags are
// shared between field and value.
CLRDATA_VALUE_FROM_INSTANCE = CLRDATA_FIELD_FROM_INSTANCE,
CLRDATA_VALUE_FROM_TASK_LOCAL = CLRDATA_FIELD_FROM_TASK_LOCAL,
CLRDATA_VALUE_FROM_STATIC = CLRDATA_FIELD_FROM_STATIC,
// Alias for all types of field locations.
CLRDATA_VALUE_ALL_LOCATIONS = CLRDATA_FIELD_ALL_LOCATIONS,
// Alias for all fields from all locations.
CLRDATA_VALUE_ALL_FIELDS = CLRDATA_FIELD_ALL_FIELDS,
// Identify whether the value is a boxed object.
CLRDATA_VALUE_IS_BOXED = 0x00001000,
} CLRDataValueFlag;
[
object,
local,
uuid(59d9b5e1-4a6f-4531-84c3-51d12da22fd4),
pointer_default(unique)
]
interface IXCLRDataTarget3 : ICLRDataTarget2
{
/*
* Ask the target to recover metadata for
* an image. May not succeed.
*/
HRESULT GetMetaData([in] LPCWSTR imagePath,
[in] ULONG32 imageTimestamp,
[in] ULONG32 imageSize,
[in] GUID* mvid,
[in] ULONG32 mdRva,
[in] ULONG32 flags,
[in] ULONG32 bufferSize,
[out, size_is(bufferSize), length_is(*dataSize)]
BYTE* buffer,
[out] ULONG32* dataSize);
};
/*
* Flags used for *ByName methods.
*/
typedef enum
{
CLRDATA_BYNAME_CASE_SENSITIVE = 0x00000000,
CLRDATA_BYNAME_CASE_INSENSITIVE = 0x00000001,
} CLRDataByNameFlag;
/*
* Flags used in GetName methods.
*/
typedef enum
{
CLRDATA_GETNAME_DEFAULT = 0x00000000,
CLRDATA_GETNAME_NO_NAMESPACES = 0x00000001,
CLRDATA_GETNAME_NO_PARAMETERS = 0x00000002,
} CLRDataGetNameFlag;
typedef enum
{
CLRDATA_PROCESS_DEFAULT = 0x00000000,
CLRDATA_PROCESS_IN_GC = 0x00000001,
} CLRDataProcessFlag;
typedef enum
{
CLRDATA_ADDRESS_UNRECOGNIZED,
CLRDATA_ADDRESS_MANAGED_METHOD,
CLRDATA_ADDRESS_RUNTIME_MANAGED_CODE,
CLRDATA_ADDRESS_RUNTIME_UNMANAGED_CODE,
CLRDATA_ADDRESS_GC_DATA,
CLRDATA_ADDRESS_RUNTIME_MANAGED_STUB,
CLRDATA_ADDRESS_RUNTIME_UNMANAGED_STUB,
} CLRDataAddressType;
typedef enum
{
CLRDATA_NOTIFY_ON_MODULE_LOAD = 0x00000001,
CLRDATA_NOTIFY_ON_MODULE_UNLOAD = 0x00000002,
CLRDATA_NOTIFY_ON_EXCEPTION = 0x00000004,
CLRDATA_NOTIFY_ON_EXCEPTION_CATCH_ENTER = 0x00000008,
} CLRDataOtherNotifyFlag;
/*
* Data buffer and flags for follow-stub data.
*/
typedef struct
{
ULONG64 Data[8];
} CLRDATA_FOLLOW_STUB_BUFFER;
typedef enum
{
CLRDATA_FOLLOW_STUB_DEFAULT = 0x00000000,
} CLRDataFollowStubInFlag;
typedef enum
{
CLRDATA_FOLLOW_STUB_INTERMEDIATE = 0x00000000,
CLRDATA_FOLLOW_STUB_EXIT = 0x00000001,
} CLRDataFollowStubOutFlag;
typedef enum
{
CLRNATIVEIMAGE_PE_INFO = 0x00000001,
CLRNATIVEIMAGE_COR_INFO = 0x00000002,
CLRNATIVEIMAGE_FIXUP_TABLES = 0x00000004,
CLRNATIVEIMAGE_FIXUP_HISTOGRAM = 0x00000008,
CLRNATIVEIMAGE_MODULE = 0x00000010,
CLRNATIVEIMAGE_METHODS = 0x00000020,
CLRNATIVEIMAGE_DISASSEMBLE_CODE = 0x00000040,
CLRNATIVEIMAGE_IL = 0x00000080,
CLRNATIVEIMAGE_METHODTABLES = 0x00000100,
CLRNATIVEIMAGE_NATIVE_INFO = 0x00000200,
CLRNATIVEIMAGE_MODULE_TABLES = 0x00000400,
CLRNATIVEIMAGE_FROZEN_SEGMENT = 0x00000800,
CLRNATIVEIMAGE_PE_FILE = 0x00001000,
CLRNATIVEIMAGE_GC_INFO = 0x00002000,
CLRNATIVEIMAGE_EECLASSES = 0x00004000,
CLRNATIVEIMAGE_NATIVE_TABLES = 0x00008000,
CLRNATIVEIMAGE_PRECODES = 0x00010000,
CLRNATIVEIMAGE_TYPEDESCS = 0x00020000,
CLRNATIVEIMAGE_VERBOSE_TYPES = 0x00040000,
CLRNATIVEIMAGE_METHODDESCS = 0x00080000,
CLRNATIVEIMAGE_METADATA = 0x00100000,
CLRNATIVEIMAGE_DISABLE_NAMES = 0x00200000,
CLRNATIVEIMAGE_DISABLE_REBASING = 0x00400000,
CLRNATIVEIMAGE_SLIM_MODULE_TBLS = 0x00800000,
CLRNATIVEIMAGE_RESOURCES = 0x01000000,
CLRNATIVEIMAGE_FILE_OFFSET = 0x02000000,
CLRNATIVEIMAGE_DEBUG_TRACE = 0x04000000,
CLRNATIVEIMAGE_RELOCATIONS = 0x08000000,
CLRNATIVEIMAGE_FIXUP_THUNKS = 0x10000000,
CLRNATIVEIMAGE_DEBUG_COVERAGE = 0x80000000
} CLRNativeImageDumpOptions;
cpp_quote("#ifdef __cplusplus")
cpp_quote("inline CLRNativeImageDumpOptions operator|=(CLRNativeImageDumpOptions& lhs, CLRNativeImageDumpOptions rhs) { return (lhs = (CLRNativeImageDumpOptions)( ((unsigned)lhs) | ((unsigned)rhs) )); }")
cpp_quote("#endif")
typedef enum
{
CLRDATAHINT_DISPLAY_HINTS_NONE = 0,
//array hints 0x000000ff
CLRDATAHINT_DISPLAY_ARRAY_AS_TABLE = 0x00000001,
CLRDATAHINT_DISPLAY_ARRAY_AS_ARRAY = 0x00000002,
CLRDATAHINT_DISPLAY_ARRAY_AS_ARRAY_IDX = 0x00000003, //print idx as field 1
CLRDATAHINT_DISPLAY_ARRAY_AS_MAP = 0x00000004,
CLRDATAHINT_DISPLAY_ARRAY_HINT_MASK = 0x000000ff,
//structure hints
CLRDATAHINT_DISPLAY_STRUCT_AS_TABLE = 0x00000100,
CLRDATAHINT_DISPLAY_STRUCT_HINT_MASK = 0x0000ff00,
//separate fields with tabs
CLRDATAHINT_DISPLAY_SEP_TAB = 0x00000000,
//separate fields with spaces
CLRDATAHINT_DISPLAY_SEP_SPACE = 0x01000000,
//separate first field by a tab, and all other fields with spaces
CLRDATAHINT_DISPLAY_SEP_TAB_SPACE = 0x02000000,
CLRDATAHINT_DISPLAY_SEP_MASK = 0xff000000,
} CLRDataDisplayHints;
#pragma warning(push)
#pragma warning(disable:28718) /* suppress warning for interface IXCLRDataProcess */
/*
* This interface supports the loading of dependencies and processing of PE
* files for the NativeImageDumper.
*/
[
object,
local,
uuid(E5F3039D-2C0C-4230-A69E-12AF1C3E563C)
]
interface IXCLRLibrarySupport : IUnknown
{
//loads a dependency. It can fail if the image needs to be relocated.
HRESULT LoadHardboundDependency(const WCHAR * name, REFGUID mvid,
[out]SIZE_T *loadedBase);
HRESULT LoadSoftboundDependency(const WCHAR * name,
const BYTE * assemblymetadataBinding,
const BYTE * hash, ULONG hashLength,
[out]SIZE_T *loadedBase);
};
interface IXCLRDisassemblySupport;
typedef SIZE_T (__stdcall *CDSTranslateAddrCB)(IXCLRDisassemblySupport *, CLRDATA_ADDRESS, WCHAR *, SIZE_T, DWORDLONG *);
typedef SIZE_T (__stdcall *CDSTranslateFixupCB)(IXCLRDisassemblySupport *, CLRDATA_ADDRESS, SIZE_T, WCHAR *, SIZE_T, DWORDLONG *);
typedef SIZE_T (__stdcall *CDSTranslateConstCB)(IXCLRDisassemblySupport *, DWORD, WCHAR *, SIZE_T);
typedef SIZE_T (__stdcall *CDSTranslateRegrelCB)(IXCLRDisassemblySupport *, unsigned rega, CLRDATA_ADDRESS, WCHAR *, SIZE_T, DWORD *);
[
object,
local,
uuid(1F0F7134-D3F3-47DE-8E9B-C2FD358A2936)
]
interface IXCLRDisassemblySupport : IUnknown
{
HRESULT SetTranslateAddrCallback([in] CDSTranslateAddrCB cb);
HRESULT PvClientSet([in] void * pv);
SIZE_T CbDisassemble(CLRDATA_ADDRESS, const void *, SIZE_T);
SIZE_T Cinstruction();
BOOL FSelectInstruction(SIZE_T);
SIZE_T CchFormatInstr(WCHAR *, SIZE_T);
void *PvClient();
HRESULT SetTranslateFixupCallback([in]CDSTranslateFixupCB cb);
HRESULT SetTranslateConstCallback([in]CDSTranslateConstCB cb);
HRESULT SetTranslateRegrelCallback([in]CDSTranslateRegrelCB cb);
BOOL TargetIsAddress();
};
/*
* This interface is passed to CLRDataCreateInstance::DumpNativeImage. It
* handles display of the logical data in the ngen image.
*/
[
object,
local,
uuid(A3C1704A-4559-4a67-8D28-E8F4FE3B3F62)
]
interface IXCLRDataDisplay : IUnknown
{
HRESULT ErrorPrintF(const char * const fmt, ...);
HRESULT NativeImageDimensions(SIZE_T base, SIZE_T size, DWORD sectionAlign);
HRESULT Section(const char * const name, SIZE_T rva, SIZE_T size);
HRESULT GetDumpOptions([out] CLRNativeImageDumpOptions * pOptions);
//Start and end the document
HRESULT StartDocument();
HRESULT EndDocument();
//XML-Constructs that do not map to actual fields or structures
//A category is a top level section of the ngen output. For example,
//"Sections", "Directories", "CLR Info", etc.
HRESULT StartCategory(const char * const name);
HRESULT EndCategory();
//starts an element containing either xml text or other elements. Only
//used within arrays and lists. Otherwise use StartVStructure.
HRESULT StartElement(const char * const name);
HRESULT EndElement();
//like a Structure, but without a name and size. Used within categories
//and structures.
HRESULT StartVStructure(const char * const name );
HRESULT StartVStructureWithOffset( const char * const name,
unsigned fieldOffset,
unsigned fieldSize );
HRESULT EndVStructure();
//An element that contains xml text.
HRESULT StartTextElement(const char * const name);
HRESULT EndTextElement();
HRESULT WriteXmlText(const char * const fmt, ...);
HRESULT WriteXmlTextBlock(const char * const fmt, ...);
HRESULT WriteEmptyElement(const char * const element);
//produces <element>ptr</element>
HRESULT WriteElementPointer(const char * const element, SIZE_T ptr);
HRESULT WriteElementPointerAnnotated(const char * const element, SIZE_T ptr,
const WCHAR * const annotation );
//produces <element base="base" size="size"/>
HRESULT WriteElementAddress(const char * const element, SIZE_T base, SIZE_T size);
HRESULT WriteElementAddressNamed(const char * const element, const char * const name,
SIZE_T base, SIZE_T size);
HRESULT WriteElementAddressNamedW(const char * const element, const WCHAR * const name,
SIZE_T base, SIZE_T size);
HRESULT WriteElementString(const char * const element, const char * const data);
HRESULT WriteElementStringW(const char * const element, const WCHAR * const data);
HRESULT WriteElementInt(const char * const element, int value);
HRESULT WriteElementUInt(const char * const element, DWORD value);
HRESULT WriteElementEnumerated(const char * const element, DWORD value,
const WCHAR * const mnemonic);
//writes <element>value</element> if value != suppressIfEqual.
//in text mode the whole element is suppressed (and a "" is appended if
//inside an array or list.
HRESULT WriteElementIntWithSuppress( const char * const element, int value,
int suppressIfEqual );
//For text, it produces "(element)" or "" instead of "true" or "false".
HRESULT WriteElementFlag(const char * const element, BOOL flag);
//if countPrefix is not Null, displays a total at the end in text mode.
//Arrays have headings in both text and xml. Lists are "repeated elements"
HRESULT StartArray( const char * const name, const WCHAR * const fmt);
HRESULT EndArray( const char * const countPrefix );
HRESULT StartList( const WCHAR * const fmt );
HRESULT EndList();
//XML-Constructs that represent real C++ Data structure
HRESULT StartArrayWithOffset( const char * const name, unsigned fieldOffset,
unsigned fieldSize, const WCHAR * const fmt );
#if 0
//writes <element>value</element> if value != suppressIfEqual.
//in text mode the whole element is suppressed (and a "" is appended if
//inside an array or list.
HRESULT WriteFieldIntWithSuppress( const char * const element, unsigned offset,
int value, int suppressIfEqual );
#endif
HRESULT WriteFieldString(const char * const element, unsigned fieldOffset,
unsigned fieldSize, const char * const data);
HRESULT WriteFieldStringW(const char * const element, unsigned fieldOffset,
unsigned fieldSize, const WCHAR * const data);
//produces <element>ptr</element>
HRESULT WriteFieldPointer(const char * const element, unsigned fieldOffset,
unsigned fieldSize, SIZE_T ptr);
//produces <element>ptr+size</element>
HRESULT WriteFieldPointerWithSize(const char * const element,
unsigned fieldOffset, unsigned fieldSize,
SIZE_T ptr, SIZE_T size);
HRESULT WriteFieldInt(const char * const element, unsigned fieldOffset,
unsigned fieldSize, int value);
HRESULT WriteFieldUInt(const char * const element, unsigned fieldOffset,
unsigned fieldSize, DWORD value);
HRESULT WriteFieldEnumerated(const char * const element, unsigned fieldOffset,
unsigned fieldSize, DWORD value,
const WCHAR * const mnemonic);
HRESULT WriteFieldEmpty(const char * const element, unsigned fieldOffset,
unsigned fieldSize);
HRESULT WriteFieldFlag(const char * const element, unsigned fieldOffset,
unsigned fieldSize, BOOL flag);
HRESULT WriteFieldPointerAnnotated(const char * const element,
unsigned fieldOffset, unsigned fieldSize,
SIZE_T ptr, const WCHAR * const annotation);
//produces <element base="base" size="size"/>
HRESULT WriteFieldAddress(const char * const element, unsigned fieldOffset,
unsigned fieldSize, SIZE_T base, SIZE_T size);
//For text, it produces "(element)" or "" instead of "true" or "false".
#if 0
HRESULT WriteFieldFlag(const char * const element, unsigned offset, BOOL flag);
HRESULT WriteFieldInt(const char * const element, unsigned offset, int value);
HRESULT WriteFieldUInt(const char * const element, unsigned offset, DWORD value);
HRESULT WriteFieldEnumerated(const char * const element, unsigned offset,
DWORD value, const WCHAR * const mnemonic);
#endif
//structures are like categories and elements, but they have a base and
//size.
HRESULT StartStructure( const char * const name, SIZE_T ptr, SIZE_T size );
HRESULT StartStructureWithNegSpace( const char * const name, SIZE_T ptr,
SIZE_T startPtr, SIZE_T totalSize );
HRESULT StartStructureWithOffset( const char * const name, unsigned fieldOffset,
unsigned fieldSize, SIZE_T ptr,
SIZE_T size );
HRESULT EndStructure();
#if 0
//produces <element>ptr+size</element>
HRESULT WriteElementPointerWithSize(const char * const element, SIZE_T ptr,
SIZE_T size);
HRESULT WriteElementInt(const char * const element, int value);
HRESULT WriteFixupDescription(SIZE_T ptr, DWORD tagged, SIZE_T handle,
const char * const name );
//structures are like categories and elements, but they have a base and
//size.
HRESULT StartStructure( const char * const name, SIZE_T ptr, SIZE_T size );
HRESULT EndStructure();
#endif
};
/*
* Interface representing the process itself. Can be obtained via
* CLRDataCreateInstance.
*/
[
object,
local,
uuid(5c552ab6-fc09-4cb3-8e36-22fa03c798b7)
]
interface IXCLRDataProcess : IUnknown
{
/*
* Flush any cached data for this process. All ICLR* interfaces obtained
* for this process will become invalid with this call.
*/
HRESULT Flush();
/*
* Begin enumeration of tasks.
* Returns S_FALSE if the enumeration is empty.
*/
HRESULT StartEnumTasks([out] CLRDATA_ENUM* handle);
/*
* Get the next entry in the enumeration.
* Returns S_FALSE if there isn't a next entry.
*/
HRESULT EnumTask([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataTask** task);
/*
* Release the enumerator.
*/
HRESULT EndEnumTasks([in] CLRDATA_ENUM handle);
/*
* Get the managed task running on the given OS thread ID
*/
HRESULT GetTaskByOSThreadID([in] ULONG32 osThreadID,
[out] IXCLRDataTask** task);
/*
* Get the managed task corresponding to the given task ID.
*/
HRESULT GetTaskByUniqueID([in] ULONG64 taskID,
[out] IXCLRDataTask** task);
/*
* Get state flags, defined in CLRDataProcessFlag.
*/
HRESULT GetFlags([out] ULONG32* flags);
/*
* Determine whether the given interface represents
* the same target state.
*/
HRESULT IsSameObject([in] IXCLRDataProcess* process);
/*
* Get the managed object representing the process.
*/
HRESULT GetManagedObject([out] IXCLRDataValue** value);
/*
* Mark the process so that it attempts to reach the
* desired execution state the next time it executes.
*/
HRESULT GetDesiredExecutionState([out] ULONG32* state);
HRESULT SetDesiredExecutionState([in] ULONG32 state);
/*
* Return an indicator of the type of data referred
* to by the given address.
*/
HRESULT GetAddressType([in] CLRDATA_ADDRESS address,
[out] CLRDataAddressType* type);
/*
* Get a name for the given address if
* the address refers to non-managed-method information.
* Method names can be retrieved by using GetMethodInstanceByAddress
* and GetName on the method instance.
*
* Returns S_FALSE if the buffer is not large enough for the name,
* and sets nameLen to be the buffer length needed.
*/
HRESULT GetRuntimeNameByAddress([in] CLRDATA_ADDRESS address,
[in] ULONG32 flags,
[in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR nameBuf[],
[out] CLRDATA_ADDRESS* displacement);
/*
* App domain enumeration.
*/
HRESULT StartEnumAppDomains([out] CLRDATA_ENUM* handle);
HRESULT EnumAppDomain([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataAppDomain** appDomain);
HRESULT EndEnumAppDomains([in] CLRDATA_ENUM handle);
/*
* Find an app domain by its unique ID.
*/
HRESULT GetAppDomainByUniqueID([in] ULONG64 id,
[out] IXCLRDataAppDomain** appDomain);
/*
* Assembly enumeration.
*/
HRESULT StartEnumAssemblies([out] CLRDATA_ENUM* handle);
HRESULT EnumAssembly([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataAssembly **assembly);
HRESULT EndEnumAssemblies([in] CLRDATA_ENUM handle);
/*
* Module enumeration.
*/
HRESULT StartEnumModules([out] CLRDATA_ENUM* handle);
HRESULT EnumModule([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataModule **mod);
HRESULT EndEnumModules([in] CLRDATA_ENUM handle);
/*
* Look up a module by address.
*/
HRESULT GetModuleByAddress([in] CLRDATA_ADDRESS address,
[out] IXCLRDataModule** mod);
/*
* Look up method instances by native code address.
*/
HRESULT StartEnumMethodInstancesByAddress([in] CLRDATA_ADDRESS address,
[in] IXCLRDataAppDomain* appDomain,
[out] CLRDATA_ENUM* handle);
HRESULT EnumMethodInstanceByAddress([in] CLRDATA_ENUM* handle,
[out] IXCLRDataMethodInstance** method);
HRESULT EndEnumMethodInstancesByAddress([in] CLRDATA_ENUM handle);
/*
* Look up the name and value of a piece of data by its address.
*/
HRESULT GetDataByAddress([in] CLRDATA_ADDRESS address,
[in] ULONG32 flags,
[in] IXCLRDataAppDomain* appDomain,
[in] IXCLRDataTask* tlsTask,
[in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR nameBuf[],
[out] IXCLRDataValue** value,
[out] CLRDATA_ADDRESS* displacement);
/*
* Get managed state, if any, for the given system exception.
* OBSOLETE, DO NOT USE.
*/
HRESULT GetExceptionStateByExceptionRecord([in] EXCEPTION_RECORD64* record,
[out] IXCLRDataExceptionState **exState);
/*
* Translate a system exception record into
* a particular kind of notification if possible.
*/
HRESULT TranslateExceptionRecordToNotification([in] EXCEPTION_RECORD64* record,
[in] IXCLRDataExceptionNotification* notify);
HRESULT Request([in] ULONG32 reqCode,
[in] ULONG32 inBufferSize,
[in, size_is(inBufferSize)] BYTE* inBuffer,
[in] ULONG32 outBufferSize,
[out, size_is(outBufferSize)] BYTE* outBuffer);
/*
* Create a simple value based on the given
* type and address information.
*/
HRESULT CreateMemoryValue([in] IXCLRDataAppDomain* appDomain,
[in] IXCLRDataTask* tlsTask,
[in] IXCLRDataTypeInstance* type,
[in] CLRDATA_ADDRESS addr,
[out] IXCLRDataValue** value);
/*
* Update all existing notifications for a module.
* If module is NULL all modules are affected.
*/
HRESULT SetAllTypeNotifications(IXCLRDataModule* mod,
ULONG32 flags);
HRESULT SetAllCodeNotifications(IXCLRDataModule* mod,
ULONG32 flags);
/*
* Request notification when a type is
* loaded or unloaded.
* If mods is NULL singleMod is used as
* the module for all tokens.
* If flags is NULL singleFlags is used as
* the flags for all tokens.
*/
HRESULT GetTypeNotifications([in] ULONG32 numTokens,
[in, size_is(numTokens)]
IXCLRDataModule* mods[],
[in] IXCLRDataModule* singleMod,
[in, size_is(numTokens)] mdTypeDef tokens[],
[out, size_is(numTokens)] ULONG32 flags[]);
HRESULT SetTypeNotifications([in] ULONG32 numTokens,
[in, size_is(numTokens)]
IXCLRDataModule* mods[],
[in] IXCLRDataModule* singleMod,
[in, size_is(numTokens)] mdTypeDef tokens[],
[in, size_is(numTokens)] ULONG32 flags[],
[in] ULONG32 singleFlags);
/*
* Request notification when code is generated or
* discarded for a method.
* If mods is NULL singleMod is used as
* the module for all tokens.
* If flags is NULL singleFlags is used as
* the flags for all tokens.
*/
HRESULT GetCodeNotifications([in] ULONG32 numTokens,
[in, size_is(numTokens)]
IXCLRDataModule* mods[],
[in] IXCLRDataModule* singleMod,
[in, size_is(numTokens)] mdMethodDef tokens[],
[out, size_is(numTokens)] ULONG32 flags[]);
HRESULT SetCodeNotifications([in] ULONG32 numTokens,
[in, size_is(numTokens)]
IXCLRDataModule* mods[],
[in] IXCLRDataModule* singleMod,
[in, size_is(numTokens)] mdMethodDef tokens[],
[in, size_is(numTokens)] ULONG32 flags[],
[in] ULONG32 singleFlags);
/*
* Control notifications other than code and
* type notifications.
*/
HRESULT GetOtherNotificationFlags([out] ULONG32* flags);
HRESULT SetOtherNotificationFlags([in] ULONG32 flags);
/*
* Look up method definitions by IL code address.
*/
HRESULT StartEnumMethodDefinitionsByAddress([in] CLRDATA_ADDRESS address,
[out] CLRDATA_ENUM* handle);
HRESULT EnumMethodDefinitionByAddress([in] CLRDATA_ENUM* handle,
[out] IXCLRDataMethodDefinition** method);
HRESULT EndEnumMethodDefinitionsByAddress([in] CLRDATA_ENUM handle);
/*
* Given an address which is a CLR stub
* (and potentially state from a previous follow)
* determine the next execution address at which
* to check whether the stub has been exited.
* OBSOLETE: Use FollowStub2.
*/
HRESULT FollowStub([in] ULONG32 inFlags,
[in] CLRDATA_ADDRESS inAddr,
[in] CLRDATA_FOLLOW_STUB_BUFFER* inBuffer,
[out] CLRDATA_ADDRESS* outAddr,
[out] CLRDATA_FOLLOW_STUB_BUFFER* outBuffer,
[out] ULONG32* outFlags);
/* Requires revision 7. */
HRESULT FollowStub2([in] IXCLRDataTask* task,
[in] ULONG32 inFlags,
[in] CLRDATA_ADDRESS inAddr,
[in] CLRDATA_FOLLOW_STUB_BUFFER* inBuffer,
[out] CLRDATA_ADDRESS* outAddr,
[out] CLRDATA_FOLLOW_STUB_BUFFER* outBuffer,
[out] ULONG32* outFlags);
HRESULT DumpNativeImage([in] CLRDATA_ADDRESS loadedBase,
[in] LPCWSTR name,
[in] IXCLRDataDisplay* display,
[in] IXCLRLibrarySupport* libSupport,
[in] IXCLRDisassemblySupport* dis);
}
#pragma warning(pop)
/*
* Types used in IXCLRDataProcess2 and IXCLRDataExceptionNotification3
*/
typedef enum
{
GC_MARK_END = 1,
GC_EVENT_TYPE_MAX,
} GcEvt_t;
typedef struct
{
GcEvt_t typ;
[switch_is(typ)]
union
{
[case(GC_MARK_END)]
int condemnedGeneration;
};
} GcEvtArgs;
[
object,
local,
uuid(5c552ab6-fc09-4cb3-8e36-22fa03c798b8)
]
interface IXCLRDataProcess2 : IXCLRDataProcess
{
/*
* Request notification when a GC is triggered.
* GcEvtArgs specifies exactly which GC events
* are of interest.
*/
/*
* On entry gcEvtArgs is a mask, specifying all events of
* interest, in accordance with GcNotification::IsMatch
* On exit it represents the first entry matching the input.
*/
HRESULT GetGcNotification([in, out] GcEvtArgs* gcEvtArgs);
HRESULT SetGcNotification([in] GcEvtArgs gcEvtArgs);
}
typedef enum
{
CLRDATA_DOMAIN_DEFAULT = 0x00000000,
} CLRDataAppDomainFlag;
#pragma warning(push)
#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataAppDomain */
[
object,
local,
uuid(7CA04601-C702-4670-A63C-FA44F7DA7BD5)
]
interface IXCLRDataAppDomain : IUnknown
{
/*
* Get the process that contains this app domain.
*/
HRESULT GetProcess([out] IXCLRDataProcess** process);
/*
* Get the app domain's name.
*/
HRESULT GetName([in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR name[]);
/*
* Get a unique, stable identifier for this object.
*/
HRESULT GetUniqueID([out] ULONG64* id);
/*
* Get state flags, defined in CLRDataAppDomainFlag.
*/
HRESULT GetFlags([out] ULONG32* flags);
/*
* Determine whether the given interface represents
* the same target state.
*/
HRESULT IsSameObject([in] IXCLRDataAppDomain* appDomain);
/*
* Get the managed object representing the app domain.
*/
HRESULT GetManagedObject([out] IXCLRDataValue** value);
HRESULT Request([in] ULONG32 reqCode,
[in] ULONG32 inBufferSize,
[in, size_is(inBufferSize)] BYTE* inBuffer,
[in] ULONG32 outBufferSize,
[out, size_is(outBufferSize)] BYTE* outBuffer);
}
#pragma warning(pop)
typedef enum
{
CLRDATA_ASSEMBLY_DEFAULT = 0x00000000,
} CLRDataAssemblyFlag;
#pragma warning(push)
#pragma warning(disable:28718)
[
object,
local,
uuid(2FA17588-43C2-46ab-9B51-C8F01E39C9AC)
]
interface IXCLRDataAssembly : IUnknown
{
/*
* Enumerate modules in the assembly.
*/
HRESULT StartEnumModules([out] CLRDATA_ENUM* handle);
HRESULT EnumModule([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataModule **mod);
HRESULT EndEnumModules([in] CLRDATA_ENUM handle);
/*
* Get the assembly's base name.
*/
HRESULT GetName([in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR name[]);
/*
* Get the full path and filename for the assembly,
* if there is one.
*/
HRESULT GetFileName([in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR name[]);
/*
* Get state flags, defined in CLRDataAssemblyFlag.
*/
HRESULT GetFlags([out] ULONG32* flags);
/*
* Determine whether the given interface represents
* the same target state.
*/
HRESULT IsSameObject([in] IXCLRDataAssembly* assembly);
HRESULT Request([in] ULONG32 reqCode,
[in] ULONG32 inBufferSize,
[in, size_is(inBufferSize)] BYTE* inBuffer,
[in] ULONG32 outBufferSize,
[out, size_is(outBufferSize)] BYTE* outBuffer);
/*
* Enumerate the app domains using this assembly.
*/
HRESULT StartEnumAppDomains([out] CLRDATA_ENUM* handle);
HRESULT EnumAppDomain([in, out] CLRDATA_ENUM* handle,
[out] IXCLRDataAppDomain** appDomain);