Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 39703ca

Browse files
author
Mike McLaughlin
authored
Fix !PrintException (pe) -lines bug where line number/source info is not being displayed. (#6241)
The argument bLineNumbers to FormatGeneratedException was being used a local flag.
1 parent 3e9d463 commit 39703ca

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/ToolBox/SOS/Strike/strike.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,21 +2229,21 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr,
22292229
__out_ecount_opt(bufferLength) WCHAR *wszBuffer,
22302230
size_t bufferLength,
22312231
BOOL bAsync,
2232-
BOOL bNestedCase=FALSE,
2233-
BOOL bLineNumbers=FALSE)
2232+
BOOL bNestedCase = FALSE,
2233+
BOOL bLineNumbers = FALSE)
22342234
{
22352235
UINT count = bytes / sizeof(StackTraceElement);
22362236
size_t Length = 0;
22372237

2238-
if (wszBuffer && bufferLength>0)
2238+
if (wszBuffer && bufferLength > 0)
22392239
{
22402240
wszBuffer[0] = L'\0';
22412241
}
22422242

22432243
// Buffer is calculated for sprintf below (" %p %p %S\n");
22442244
WCHAR wszLineBuffer[mdNameLen + 8 + sizeof(size_t)*2 + MAX_LONGPATH + 8];
22452245

2246-
if (count==0)
2246+
if (count == 0)
22472247
{
22482248
return 0;
22492249
}
@@ -2307,22 +2307,13 @@ size_t FormatGeneratedException (DWORD_PTR dataPtr,
23072307
{
23082308
char filename[MAX_LONGPATH+1] = "";
23092309
ULONG linenum = 0;
2310-
if (bLineNumbers
2311-
&& FAILED(GetLineByOffset(TO_CDADDR(ste.ip),
2312-
&linenum,
2313-
filename,
2314-
_countof(filename))))
2315-
{
2316-
bLineNumbers = FALSE;
2317-
}
2318-
2319-
if (!bLineNumbers)
2310+
if (bLineNumbers && SUCCEEDED(GetLineByOffset(TO_CDADDR(ste.ip), &linenum, filename, _countof(filename))))
23202311
{
2321-
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %s\n"), so.String());
2312+
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %s [%S @ %d]\n"), so.String(), filename, linenum);
23222313
}
23232314
else
23242315
{
2325-
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %s [%S @ %d]\n"), so.String(), filename, linenum);
2316+
swprintf_s(wszLineBuffer, _countof(wszLineBuffer), W(" %s\n"), so.String());
23262317
}
23272318

23282319
Length += _wcslen(wszLineBuffer);

0 commit comments

Comments
 (0)