Go 1.19 is broken on linux/386 with some C compilers, this is a
workaround for our build script. See:
https://github.com/golang/go/issues/52919
Also fix TestBuild if the first message reported by delve is not the
message that indicates the server is listening.
This changes adds the support to replace relative paths sources with "" as rapresenting current directory.
For example:
Rule like '{from: "", to: "/my/project"}' will map path "src/my/code.go" into "/my/project/src/my/code.go"
Rule like '{from: "/my/project", to: ""}' will map path "/my/project/src/my/code.go" into "src/my/code.go"
Fixes#3082
We allowed integer and pointer type casts everywhere but type casts to
string, []byte and []rune only at toplevel.
Fuse evalToplevelTypeCast and evalTypeCast and allow both kinds
everywhere. There are multiple other ways to create variables than
don't reference user memory anyway (which wasn't the case back when
evalToplevelTypeCast was implemented).
Fixes#1423
Change service/debugger.(*Debugger).state and collectBreakpointInfo
methods so that they work with TargetGroup.
Updates #2551
when running custom builds
abstraction
on '5660f9a4'.
As we parse this informatin in the loop we must take care to assemble
things correctly. In this situation when we encounter a file name,
the dir index is -1, then subsequently we get the correct dir index
for that file and can put them together. Previously we were adding the
file and then the directory location to the file list instead of
correctly concatenating them, resulting in an incorrect file list making
indexing into the list return incorrect results later on.
This patch improves the output of the trace subcommand by
adding better line breaks, adding goroutine info to the
return statement, and removing unnecessary output.
This patch removes the old error-prone way of tracking
whether the tracepoint is for a function entry or
return. Instead of trying to guess, let the data structure
simply tell us directly.
service/dap: fix indexing bug for maps
There was a bug that cut off the second half of a map, because the
number of variables was not accurately reported to the client.
Fixesgolang/vscode-go#2351
* terminal/command: 'goroutines' command add new flags '-exec command'
Support run command on every goroutine.
Fixes#3043
* terminal/command: 'goroutines' command add new flags '-exec command'
Support run command on every goroutine.
Fixes#3043
* terminal/command: add -per-g-hitcount option to condition command
Support use per goroutine hitcount as hintcond operand.
Fixes#3050
Co-authored-by: roketyyang <roketyyang@tencent.com>
In order to support substituting a single file within
a larger package, and not substituting a directory wholesale,
this commit introduces the ability for SubstitutePath
to replace individual file paths if there is an exact match.
This behavior is backwards-compatible with the previous
configuration.
Fixes#3074
The ebpf implementations uses cgo, but only to access some C struct
definitions. Instead of using cgo simply duplicate the defintion of
those two structs in Go and add a test to check that the duplicate
definitions remain synchronized.
Fixes#2827
1. return an error when SetUProbe fails, while creating ebpf tracepoints
2. if no tracepoint can be set for 'dlv trace' exit early
3. never leave the traced program running
4. fix typo in description of --ebpf flag
Fixes#3006
Due to dyanmically loaded libraries there could be aribitrarily large
gaps in the address space, between functions. Limit the memory size we
are willing to disassemble.
Fixes#3040
Introduces a new TargetGroup abstraction that can be used to manage
multiple related targets.
No actual management of child processes is implemented here, this is
just a refactoring to make it possible to do that in the future.
Updates #2551
Adds ability to show current position as disassembly instead of source
listing every time execution stops. Change default to show disassembly
after step-instruction and source listing in every other case.
Fixes#2878
The version of mingw was pinned to 10.2.0 because mingw 11 started
using DWARFv5, which wasn't supported by Go 1.17. We are now testing
only 1.18 and 1.19 and both support DWARFv5 correctly.
In commit eee6f9f82 Go changed the order that crosscall2 uses to save
its registers, update arm64SwitchStack to use the new order when the
binary was compiled by go 1.19.
Fixes#2993
We don't do anything with the personality function so there is no point
in complaining that we don't fully support the pointer encoding flags
used to describe it.
This matches the current level of support of pointer encodings in gdb
(they are discarded when reading the personality function and not
supported for FDEs because gcc doesn't generate them).
Fixes#3015
In non-headless instances Ctrl-C should pause the process, not
terminate it. To make this work on Windows we have to pass the
syscall.CREATE_NEW_PROCESS_GROUP flag to os.StartProcess.
When doing a map lookup with a string literal we should load as much of
the keys to at least match the length of the string literal, so that
the lookup doesn't fail with the "string too long" error.
Fixes#3034
Go 1.19 also formats doc comments according to the new godoc syntax.
Some of our comments, especially unexported symbols did not conform to
the godoc syntax and therefore are mangled by 'go fmt'.
This PR runs 'go fmt' from go1.19 on everything and manually fixes the
problems.
See also:
https://github.com/golang/proposal/blob/master/design/51082-godocfmt.md
When we send an interrupt request to debugserver we, sometimes, get one
extra spurious stop packet back.
This stop packet gets interpreted as a response to a qThreadStopInfo request
we make causing the protocol to become desynchronized for a while, until
eventually some kind of error appears.
Here's an example of this problem, distilled from issue #3013:
1 <- $vCont;c#a8
2 <- interrupt
3 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
4 <- $qThreadStopInfo12efb8e#28
5 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
6 <- $qThreadStopInfo12efb8f#29
7 -> $T00thread:12efb8e;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
8 <- $qThreadStopInfo12efb90#f4
9 -> $T00thread:12efb8f;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
10 <- $qThreadStopInfo12efb91#f5
11 -> $T00thread:12efb90;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
12 <- $qThreadStopInfo12efb47#f6
13 -> $T00thread:12efb91;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
14 <- $qThreadStopInfo12efb8d#27
15 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
16 <- $p0;thread:12efb8e;#f5
17 -> $T00thread:12efb8d;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
response (3) is interpreted as the response to the vCont request at (1). We
then make a qThreadStopInfo request (4) and receive a stop packet in
response (5). Packet (5) is interpreted as the response to (4) but it
actually isn't, note how the thread ID is different, packet (5) is actually
a spurious stop packet sent by debug server. From response (5) onward the
protocol is desynchronized, none of the response we process are actually the
response to the preceding request.
This eventually causes a failure at packet (17) which debugserver sent as
the response to request (14) but we interpret as the response to (16).
Fixes#3013
Moves variable evaluation tests to pkg/proc which is where most of the
code they test exists, this also allows the removal of a bunch of
duplicate support code.
Fix pretty printing for CPU register components (created with the
XMM0.uintN syntax) while using format strings
Also fixes printing large literal constants with format strings.
Fixes#3020
* pkg/proc: convert freebsd ptrace code to cgo
There is little point in having cgo call a custom C function, when the same
can be done directly from cgo (with less code and effort). Split the amd64
specific code into ptrace_freebsd_amd64.go. Also avoid mixing C.ptrace()
with syscall.SYS_PTRACE.
This will make further changes easier - no functional change intended.
* pkg/proc: check return values of ptrace calls on freebsd
The return values of the PT_GETNUMLWPS and PT_GETLWPLIST ptrace calls were
previously unchecked. While these should not fail, panic instead of using
-1 with slice allocation/handling.
* pkg/proc: return *amd64util.AMD64Xstate from freebsd ptraceGetRegset
Return a pointer to a struct, rather than a struct - this simplifies the
code in both the caller and the ptraceGetRegset function, while also avoiding
struct copying.
* pkg/proc: fix floating point register setting on freebsd
The original code could never work - PT_SETREGS on freebsd does not
take an iovec, nor does it set FP registers. Furthermore, the xsave
bytes were not stored in the amd64util.AMD64Xstate struct.
Updates #3001
* pkg/proc: re-enable function call injection on freebsd
Floating point registers can now be set and restored correctly.
This is a partial revert of 51090f003bace1f8cc37b8480ffdb6f6cc91fa5a.
Fixes#3001
* pkg/proc: deduplicate register setting code on freebsd
Adds a LogicalBreakpoint type to represent logical breakpoints
explicitly. Until now logical breakpoints were constructed implicitly
by grouping physical breakpoints together by their LogicalID.
Having logical breakpoints represented explicitly allows for a simpler
implementation of disabled breakpoints, as well as allowing a simple
implementation of delayed breakpoints (#1653, #2551) and in general of
breakpoints spanning multiple processes if we implement debugging
process trees (#2551).
Updates #1653
Updates #2551
* pkg/terminal: fix typo in loadConfig comment
* pkg/terminal: add auto-complete for local variables
Fixes#2944
* pkg/terminal: use an empty config to load local vars
* pkg/terminal: cache loaded local vars until next command
* pkg/terminal: lazy loading of local vars trie
debugCallV2 for amd64 has a bug where it corrupts the flags registers
every time it is called, this commit works around that problem by
restoring flags one extra time to its original value after stepping out
of debugCallV2.
Fixes#2985
* Upgrade FreeBSD version
* proc: fixes concerning call injection on freebsd and rr
On FreeBSD it seems we have problems restoring and setting floating
point registers, since at least restoring is necessary for call
injection to function properly fully disable call injection on FreeBSD.
On rr the same problem exists, however due to the fact that we are
acting on a recording and ending a diversion will restore register
values anyway simply disable the floatsum test.
See also: https://github.com/rr-debugger/rr/issues/3208
Updates #3001