@@ -31,75 +31,78 @@ protected int AddComment(DrawContext view, int x, int y, float fvalue, IntPtr iv
3131 }
3232 }
3333
34- var namedAddress = view . Process . GetNamedAddress ( ivalue ) ;
35- if ( ! string . IsNullOrEmpty ( namedAddress ) )
34+ if ( ivalue != IntPtr . Zero )
3635 {
37- if ( view . Settings . ShowCommentPointer )
36+ var namedAddress = view . Process . GetNamedAddress ( ivalue ) ;
37+ if ( ! string . IsNullOrEmpty ( namedAddress ) )
3838 {
39- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . NoneId , "->" ) + view . Font . Width ;
40- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , namedAddress ) + view . Font . Width ;
41- }
42- 43- if ( view . Settings . ShowCommentRtti )
44- {
45- var rtti = view . Process . ReadRemoteRuntimeTypeInformation ( ivalue ) ;
46- if ( ! string . IsNullOrEmpty ( rtti ) )
39+ if ( view . Settings . ShowCommentPointer )
4740 {
48- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , rtti ) + view . Font . Width ;
41+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . NoneId , "->" ) + view . Font . Width ;
42+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , namedAddress ) + view . Font . Width ;
4943 }
50- }
5144
52- if ( view . Settings . ShowCommentSymbol )
53- {
54- var module = view . Process . GetModuleToPointer ( ivalue ) ;
55- if ( module != null )
45+ if ( view . Settings . ShowCommentRtti )
5646 {
57- var symbols = view . Process . Symbols . GetSymbolsForModule ( module ) ;
58- var symbol = symbols ? . GetSymbolString ( ivalue , module ) ;
59- if ( ! string . IsNullOrEmpty ( symbol ) )
47+ var rtti = view . Process . ReadRemoteRuntimeTypeInformation ( ivalue ) ;
48+ if ( ! string . IsNullOrEmpty ( rtti ) )
6049 {
61- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , symbol ) + view . Font . Width ;
50+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , rtti ) + view . Font . Width ;
6251 }
6352 }
64- }
6553
66- if ( view . Settings . ShowCommentString )
67- {
68- var data = view . Process . ReadRemoteMemory ( ivalue , 64 ) ;
69- 70- var isWideString = false ;
71- string text = null ;
72- 73- // First check if it could be an UTF8 string and if not try UTF16.
74- if ( data . Take ( IntPtr . Size ) . InterpretAsSingleByteCharacter ( ) . IsPrintableData ( ) )
54+ if ( view . Settings . ShowCommentSymbol )
7555 {
76- text = new string ( Encoding . UTF8 . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
56+ var module = view . Process . GetModuleToPointer ( ivalue ) ;
57+ if ( module != null )
58+ {
59+ var symbols = view . Process . Symbols . GetSymbolsForModule ( module ) ;
60+ var symbol = symbols ? . GetSymbolString ( ivalue , module ) ;
61+ if ( ! string . IsNullOrEmpty ( symbol ) )
62+ {
63+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , symbol ) + view . Font . Width ;
64+ }
65+ }
7766 }
78- else if ( data . Take ( IntPtr . Size * 2 ) . InterpretAsDoubleByteCharacter ( ) . IsPrintableData ( ) )
67+ 68+ if ( view . Settings . ShowCommentString )
7969 {
80- isWideString = true ;
70+ var data = view . Process . ReadRemoteMemory ( ivalue , 64 ) ;
8171
82- text = new string ( Encoding . Unicode . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
83- }
72+ var isWideString = false ;
73+ string text = null ;
8474
85- if ( text != null )
86- {
87- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , isWideString ? "L'" : "'" ) ;
88- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . ReadOnlyId , text ) ;
89- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , "'" ) + view . Font . Width ;
90- }
91- }
75+ // First check if it could be an UTF8 string and if not try UTF16.
76+ if ( data . Take ( IntPtr . Size ) . InterpretAsSingleByteCharacter ( ) . IsPrintableData ( ) )
77+ {
78+ text = new string ( Encoding . UTF8 . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
79+ }
80+ else if ( data . Take ( IntPtr . Size * 2 ) . InterpretAsDoubleByteCharacter ( ) . IsPrintableData ( ) )
81+ {
82+ isWideString = true ;
9283
93- if ( view . Settings . ShowCommentPluginInfo )
94- {
95- var nodeAddress = view . Address + Offset ;
84+ text = new string ( Encoding . Unicode . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
85+ }
86+ 87+ if ( text != null )
88+ {
89+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , isWideString ? "L'" : "'" ) ;
90+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . ReadOnlyId , text ) ;
91+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , "'" ) + view . Font . Width ;
92+ }
93+ }
9694
97- foreach ( var reader in NodeInfoReader )
95+ if ( view . Settings . ShowCommentPluginInfo )
9896 {
99- var info = reader . ReadNodeInfo ( this , view . Process , view . Memory , nodeAddress , ivalue ) ;
100- if ( info != null )
97+ var nodeAddress = view . Address + Offset ;
98+ 99+ foreach ( var reader in NodeInfoReader )
101100 {
102- x = AddText ( view , x , y , view . Settings . PluginColor , HotSpot . ReadOnlyId , info ) + view . Font . Width ;
101+ var info = reader . ReadNodeInfo ( this , view . Process , view . Memory , nodeAddress , ivalue ) ;
102+ if ( info != null )
103+ {
104+ x = AddText ( view , x , y , view . Settings . PluginColor , HotSpot . ReadOnlyId , info ) + view . Font . Width ;
105+ }
103106 }
104107 }
105108 }
0 commit comments