This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add work around a bug in lldb on a core dump #1327
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14019,4 +14019,4 @@ Help(PDEBUG_CLIENT Client, PCSTR Args) | |
return S_OK; | ||
} | ||
|
||
#endif // !FEATURE_PAL | ||
#endif // FEATURE_PAL | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include "sosplugin.h" | ||
#include <dlfcn.h> | ||
#include <string.h> | ||
#include <string> | ||
|
||
class setclrpathCommand : public lldb::SBCommandPluginInterface | ||
{ | ||
public: | ||
setclrpathCommand() | ||
{ | ||
} | ||
|
||
virtual bool | ||
DoExecute (lldb::SBDebugger debugger, | ||
char** arguments, | ||
lldb::SBCommandReturnObject &result) | ||
{ | ||
if (arguments[0] == NULL) | ||
{ | ||
result.Printf("setclrpath error - no path\n"); | ||
return false; | ||
} | ||
|
||
if (g_coreclrDirectory != NULL) | ||
{ | ||
free(g_coreclrDirectory); | ||
} | ||
|
||
std::string path(arguments[0]); | ||
if (path[path.length() - 1] != '/') | ||
{ | ||
path.append("/"); | ||
} | ||
|
||
g_coreclrDirectory = strdup(path.c_str()); | ||
result.Printf("Set load path for sos/dac/dbi to %s\n", g_coreclrDirectory); | ||
return result.Succeeded(); | ||
} | ||
}; | ||
|
||
bool | ||
setclrpathCommandInitialize(lldb::SBDebugger debugger) | ||
{ | ||
lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter(); | ||
lldb::SBCommand command = interpreter.AddCommand("setclrpath", new setclrpathCommand(), "Set the path to load coreclr sos/dac/dbi files. setclrpath <path>"); | ||
return true; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include "sosplugin.h" | ||
#include <dlfcn.h> | ||
#include <string.h> | ||
#include <string> | ||
|
||
class setsostidCommand : public lldb::SBCommandPluginInterface | ||
{ | ||
public: | ||
setsostidCommand() | ||
{ | ||
} | ||
|
||
virtual bool | ||
DoExecute(lldb::SBDebugger debugger, | ||
char** arguments, | ||
lldb::SBCommandReturnObject &result) | ||
{ | ||
if (arguments[0] == NULL) | ||
{ | ||
result.Printf("Clearing sos thread os id/index\n"); | ||
g_currentThreadIndex = -1; | ||
g_currentThreadSystemId = -1; | ||
} | ||
else if (arguments[1] == NULL) | ||
{ | ||
result.Printf("Need thread index parameter that maps to the os id\n"); | ||
} | ||
else | ||
{ | ||
ULONG tid = strtoul(arguments[0], NULL, 16); | ||
g_currentThreadSystemId = tid; | ||
|
||
ULONG index = strtoul(arguments[1], NULL, 16); | ||
g_currentThreadIndex = index; | ||
|
||
result.Printf("Set sos thread os id to 0x%x which maps to lldb thread index %d\n", tid, index); | ||
} | ||
return result.Succeeded(); | ||
} | ||
}; | ||
|
||
bool | ||
setsostidCommandInitialize(lldb::SBDebugger debugger) | ||
{ | ||
lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter(); | ||
lldb::SBCommand command = interpreter.AddCommand("setsostid", new setsostidCommand(), "Set the current os tid/thread index instead of using the one lldb provides. setsostid <tid> <index>"); | ||
return true; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily something to address in this PR, but it looks like there's some hairy
#ifdef
nesting going on in this file. It took me a while to find the matching#ifndef FEATURE_PAL
(I think it's the one at line 12660).The other issue with it is that there is some inconsistency with what the comments next to the endif's say when they're closing an
#ifndef
. If there's#ifndef FOO
, sometimes the endif is#endif // FOO
and elsewhere it's#endif // !FOO
. This makes those comments almost useless since you end up having to scroll up to figure out what's going on anyway.Again, this doesn't need to be fixed in this PR, but I think it would be good to standardize that and also detangle some of the nesting in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is a big mess. I’ll try to clean this up in the future.
From: Aditya Mandaleeka [mailto:notifications@github.com]
Sent: Monday, August 3, 2015 12:15 PM
To: dotnet/coreclr coreclr@noreply.github.com
Cc: Mike McLaughlin mikem@microsoft.com
Subject: Re: [coreclr] Add work around a bug in lldb on a core dump (#1327)
In src/ToolBox/SOS/Strike/strike.cpphttps://github.com//pull/1327#discussion_r36120010:
Not necessarily something to address in this PR, but it looks like there's some hairy #ifdef nesting going on in this file. It took me a while to find the matching #ifndef FEATURE_PAL (I think it's the one at line 12660).
The other issue with it is that there is some inconsistency with what the comments next to the endif's say when they're closing an #ifndef. If there's #ifndef FOO, sometimes the endif is #endif // FOO and elsewhere it's #endif // !FOO. This makes those comments almost useless since you end up having to scroll up to figure out what's going on anyway.
Again, this doesn't need to be fixed in this PR, but I think it would be good to standardize that and also detangle some of the nesting in this file.
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/1327/files#r36120010.