Skip to content

Commit 859ae65

Browse files
committed
Read data from file name based on process id.
1 parent e9b0a36 commit 859ae65

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

PmipCallStackFilter.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,21 @@ public static bool TryGetDescriptionForIP(ulong ip, out string name)
8787
return true;
8888
}
8989

90-
public static void RefreshStackData(DkmStackWalkFrame frame)
90+
public static void RefreshStackData(string fileName)
9191
{
9292
try
9393
{
94-
var fileName = "D:\\jon.txt";
94+
if (!File.Exists(fileName))
95+
{
96+
File.WriteAllText(fileName, string.Empty);
97+
return;
98+
}
99+
95100
var fileInfo = new FileInfo(fileName);
96101
if (fileInfo.Length == previousFileLength)
97102
return;
98103

99-
var list = new List<Range>(IPs?.Length * 2 ?? 1000);
104+
var list = new List<Range>(1000);
100105
using (var inStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
101106
using (var file = new StreamReader(inStream))
102107
{
@@ -134,7 +139,8 @@ public static void RefreshStackData(DkmStackWalkFrame frame)
134139

135140
public static DkmStackWalkFrame PmipStackFrame(DkmStackContext stackContext, DkmStackWalkFrame frame)
136141
{
137-
RefreshStackData(frame);
142+
var fileName = Path.Combine(Path.GetTempPath(), "pmip." + frame.Process.LivePart.Id);
143+
RefreshStackData(fileName);
138144
string name = null;
139145
if (TryGetDescriptionForIP(frame.InstructionAddress.CPUInstructionPart.InstructionPointer, out name))
140146
return DkmStackWalkFrame.Create(

0 commit comments

Comments
 (0)