llvm-project/lldb/source/Commands
Leonard Mosescu 47196a25bb Improve LLDB's handling of non-local minidumps
Normally, LLDB is creating a high-fidelity representation of a live
process, including a list of modules and sections, with the 
associated memory address ranges. In order to build the module and
section map LLDB tries to locate the local module image (object file)
and will parse it.

This does not work for postmortem debugging scenarios where the crash
dump (minidump in this case) was captured on a different machine.

Fortunately the minidump format encodes enough information about
each module's memory range to allow us to create placeholder modules.
This enables most LLDB functionality involving address-to-module
translations.

Also, we may want to completly disable the search for matching
local object files if we load minidumps unless we can prove that the
local image matches the one from the crash origin.
(not part of this change, see: llvm.org/pr35193)

Example: Identify the module from a stack frame PC:

Before:
  thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14
    frame #0: 0x00164d14
    frame #1: 0x00167c79
    frame #2: 0x00167e6d
    frame #3: 0x7510336a
    frame #4: 0x77759882
    frame #5: 0x77759855

After:
  thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14
    frame #0: 0x00164d14 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #1: 0x00167c79 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #2: 0x00167e6d C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe
    frame #3: 0x7510336a C:\Windows\SysWOW64\kernel32.dll
    frame #4: 0x77759882 C:\Windows\SysWOW64\ntdll.dll
    frame #5: 0x77759855 C:\Windows\SysWOW64\ntdll.dll

Example: target modules list

Before:
error: the target has no associated executable images

After:
[ 0] C:\Windows\System32\MSVCP120D.dll 
[ 1] C:\Windows\SysWOW64\kernel32.dll 
[ 2] C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe 
[ 3] C:\Windows\System32\MSVCR120D.dll 
[ 4] C:\Windows\SysWOW64\KERNELBASE.dll 
[ 5] C:\Windows\SysWOW64\ntdll.dll

NOTE: the minidump format also includes the debug info GUID, so we can
fill-in the module UUID from it, but this part was excluded from this change
to keep the changes simple (the LLDB UUID is hardcoded to be either 16 or
20 bytes, while the CodeView GUIDs are normally 24 bytes)

Differential Revision: https://reviews.llvm.org/D45700

llvm-svn: 330302
2018-04-18 23:10:46 +00:00
..
CMakeLists.txt [Commands] Add a (currently empty) `stats` command. 2018-03-23 21:55:48 +00:00
CommandCompletions.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectApropos.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectApropos.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectBreakpoint.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectBreakpoint.h Make breakpoint names real entities. 2017-09-14 20:22:49 +00:00
CommandObjectBreakpointCommand.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectBreakpointCommand.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectBugreport.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CommandObjectBugreport.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectCommands.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectCommands.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectDisassemble.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectDisassemble.h Move ArchSpec to the Utility module 2017-11-13 16:16:33 +00:00
CommandObjectExpression.cpp [Command] Simplify the code and make it less error prone. NFCI. 2018-04-13 18:37:14 +00:00
CommandObjectExpression.h Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CommandObjectFrame.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectFrame.h Move ArchSpec to the Utility module 2017-11-13 16:16:33 +00:00
CommandObjectGUI.cpp *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectGUI.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectHelp.cpp Modernize the Args access pattern in a few more commands. 2016-12-09 01:08:29 +00:00
CommandObjectHelp.h Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CommandObjectLanguage.cpp *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectLanguage.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectLog.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectLog.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectMemory.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectMemory.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectMultiword.cpp Remove some more uses of Args::GetArgumentAtIndex. 2016-12-09 05:46:41 +00:00
CommandObjectPlatform.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectPlatform.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectPlugin.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CommandObjectPlugin.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectProcess.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectProcess.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectQuit.cpp Don't allow direct access to StreamString's internal buffer. 2016-11-16 21:15:24 +00:00
CommandObjectQuit.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectRegister.cpp Move Args.cpp from Interpreter to Utility 2018-04-17 18:53:35 +00:00
CommandObjectRegister.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectSettings.cpp Move option parsing out of the Args class 2018-03-09 10:39:40 +00:00
CommandObjectSettings.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectSource.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectSource.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectStats.cpp [Statistics] Move GetStatDescription to an header file. 2018-04-16 18:25:57 +00:00
CommandObjectStats.h [Command] Implement `statistics` command. 2018-04-13 18:02:39 +00:00
CommandObjectTarget.cpp Improve LLDB's handling of non-local minidumps 2018-04-18 23:10:46 +00:00
CommandObjectTarget.h Move ArchSpec to the Utility module 2017-11-13 16:16:33 +00:00
CommandObjectThread.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectThread.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectType.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectType.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectVersion.cpp *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectVersion.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectWatchpoint.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CommandObjectWatchpoint.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
CommandObjectWatchpointCommand.cpp Move Args::StringTo*** functions to a new OptionArgParser class 2018-04-10 09:03:59 +00:00
CommandObjectWatchpointCommand.h *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00