[lldb-dev] Debugging a Go application with LLDB on Windows
Salahuddin Khan via lldb-dev
lldb-dev at lists.llvm.org
Mon Jul 2 22:15:04 PDT 2018
Hi All,
I've searched the archive but couldn't find anything related to this topic.
We use Go at work and I often have to debug different portions of our product, for which I currently use the Delve debugger.
While well suited to debugging Go applications, the Delve debugger has the following issues:
1. While it supports remote debugging, if the client disconnects or has a problem, the debug server dies too.
2. Occasionally while debugging, the Delve debug console stops responding and the only way to recover is to kill the debugger, killing the target process too.
3. It uses a different syntax from what I'm used to (since I have a C/C++ background) and mostly debug with LLDB or cdb/WinDbg/kd.
I would prefer to use LLDB to debug Go applications and have seen references to this being possible, however I'm not certain how to accomplish this on Windows.
I have built LLDB from the sources and, as far as I can tell, it should have the Go related portions too.
The following is the output when attempting to debug a Go application (built with Go 1.10.3):
C:\Users\salah\Enlistments\test>go build --gcflags=all="-N -l" main.go
C:\Users\salah\Enlistments\test>..\build\Debug\bin\lldb.exe -- main.exe
(lldb) target create "main.exe"
Current executable set to 'main.exe' (x86_64).
(lldb) breakpoint set -M main
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint set -M main.main
Breakpoint 2: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb)
I suspect that either I did not include the Go support, or LLDB was looking for PDB information on Windows, while Go applications use DWARF regardless of the target executable file format (ELF/PE etc.).
This is the source code for my test application:
package main
import "fmt"
func main() {
fmt.Printf("Testing...\n")
}
I also tried using cv2pdb to create a PDB from the Go executable file, but LLDB still could not locate any breakpoints.
Has someone attempted this, or know what may be happening and how to make this work?
Further information: I have Python 3.7 installed and the CMake build was able to locate the necessary binaries (it also located the Go binaries).
Thanks for taking the time to look at this.
Kind regards,
Salah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180703/ce20c314/attachment.html>
More information about the lldb-dev
mailing list