[lldb-dev] How to debug a core file with lldb?
Sara Burke
Sara.Burke at mathworks.com
Thu Nov 1 10:43:45 PDT 2012
Ah, I see, I was using Xcode 4.3.3 but Xcode 4.5.1 does have the lldb version with core support document. Thanks for your help!
On Nov 1, 2012, at 1:39 PM, Sara Burke wrote:
Great, thanks Greg. I must not have the most up-to-date lldb version, for I see the following when I do the same commands:
(lldb) version
LLDB-112.2
(lldb) apropos core
No commands found pertaining to 'core'. Try 'help' to see a complete list of debugger commands.
(lldb) help target create
Create a target using the argument as the main executable.
Syntax: target create <cmd-options> <filename>
Command Options Usage:
target create [-a <arch>] [-p <platform-name>] [-v <none>] [-b <none>] [-s <filename>] <filename>
-a <arch> ( --arch <arch> )
Specify the architecture for the target.
-b ( --build )
Specify the initial SDK build number.
-p <platform-name> ( --platform <platform-name> )
Specify name of the platform to use for this target, creating the platform if necessary.
-s <filename> ( --sysroot <filename> )
Specify the SDK root directory that contains a root of all remote system files.
-v ( --version )
Specify the initial SDK version to use prior to connecting.
(lldb) target create --core /cores/core.1235
lldb: unrecognized option `--core'
error: unknown or ambiguous option
Could you tell me what vernon of lldb the core support is in? Thanks!
On Nov 1, 2012, at 1:35 PM, Greg Clayton wrote:
On Nov 1, 2012, at 8:30 AM, Sara Burke <Sara.Burke at mathworks.com<mailto:Sara.Burke at mathworks.com>> wrote:
Hi lldb-dev,
I have a question regarding debugging a core file. With gdb, one can specify -c <core_file> to debug a core file. However, I can find no documentation to do this with lldb. Is there such a way? lldb seems to think the core file is an executable, which isn't necessarily what I would like. Any suggestions?
(lldb) apropos core
The following commands may relate to 'core':
target create -- Create a target using the argument as the main executable.
(lldb) help target create
Create a target using the argument as the main executable.
Syntax: target create <cmd-options> <filename>
Command Options Usage:
target create [-a <arch>] [-p <platform-name>] [-v <none>] [-b <none>] [-s <filename>] [-c <path>] <filename>
-a <arch> ( --arch <arch> )
Specify the architecture for the target.
-b ( --build )
Specify the initial SDK build number.
-c <path> ( --core <path> )
Fullpath to a core file to use for this target.
-p <platform-name> ( --platform <platform-name> )
Specify name of the platform to use for this target, creating the platform if necessary.
-s <filename> ( --sysroot <filename> )
Specify the SDK root directory that contains a root of all remote system files.
-v ( --version )
Specify the initial SDK version to use prior to connecting.
This command takes options and arguments, if your arguments look like option specifiers you must use '--' to terminate the options before starting to give the arguments.
So there is documentation.
(lldb) target create --core /cores/core.1235
You can optionally give us the architecture and/or executable file if you know them:
(lldb) target create --core /cores/core.1235 --arch x86_64 /path/to/executable
After this commend, you can then do a:
(lldb) thread list
(lldb) thread backtrace all
Core files only work for mach-o core files right now. ELF support hasn't been done yet, but there is good sample code to follow in the following directory:
lldb/source/Plugins/Process/mach-core
-----------------------------------------------------------------
Sara M. Burke
Ext. 7476
-----------------------------------------------------------------
Sara M. Burke
Ext. 7476
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20121101/52e4481e/attachment.html>
More information about the lldb-dev
mailing list