Commit Graph

2447 Commits

Author SHA1 Message Date
Oleksandr Redko
7a05a4326f
proc,terminal: remove unused unexported functions (#3299) 2023-03-06 07:58:07 +01:00
Joseph Callen
c0b0148525
cmd/dlv: Add flag to replay for rr onprocess pid (#3281)
Add `-p` or `rr-onprocess-pid` to replay
command to pass `-p` or `--onprocess` pid
to `rr`.
2023-03-01 11:28:32 -08:00
Alessandro Arzilli
212c2002bb
proc: do not try to load a non-empty slice if the base address is 0 (#3295) 2023-03-01 11:27:06 -08:00
Oleksandr Redko
372552bf1f
Documentation: fix typo and grammar issues (#3291) 2023-02-28 14:52:52 +01:00
Oleksandr Redko
0a7b051fed
dwarf/line: enable TestGrafana on Windows (#3289) 2023-02-25 14:12:46 +01:00
Oleksandr Redko
d71b3aa6a7
dwarf/op: change generated comment header (#3288)
Change generated comment header for opcodes.go to match Go regexp:
```
^// Code generated .* DO NOT EDIT\.$
```

Fix panic in gen-opcodes.go if no args provided.
2023-02-25 14:12:12 +01:00
Alessandro Arzilli
37e44bf603
proc,proc/native: adds ability to automatically debug child processes (#3165)
Adds the ability to automatically debug child processes executed by the
target to the linux native backend.
This commit does not contain user interface or API to access this
functionality.

Updates #2551
2023-02-22 09:26:28 -08:00
Quim Muntal
3d6730d12e
Default to stop test_windows.ps1 when there is an error (#3285)
* default to stop test_windows.ps1 when there is an error

* fix script
2023-02-22 09:25:29 -08:00
Derek Parker
cac86b8791
dwarf/line: handle end_seq properly (#3277)
This patch changes how we handle end_seq in the debug_line state machine
program. Instead of always considering the state machine invalid at the
end_seq instead simply consider the *current* address invalid. This
solves a number of issues such as incorrect disassemble output for the
last few instructions in certain functions, and creating an eval scope
at an address within the last few instructions of certain functions. It
also handles the case where the end_seq address is the same as the start
address of the next adjacent function, which would previously confuse
Delve which is why we initially marked end_seq as invalid for the entire
state machine. This approach is more nuanced and still solves that
initial problem while fixing some problems introduced by that patch.
2023-02-20 10:36:09 +01:00
Alessandro Arzilli
cf65f94776
proc: remove unused parameter from resolveParametricType (#3276) 2023-02-15 11:35:37 -08:00
Oleksandr Redko
c728f90dcf
TeamCity,Documentation: use new TeamCity URL (#3275)
Change delve.beta.teamcity.com to delve.teamcity.com.
2023-02-15 11:11:42 +01:00
Gregor Noczinski
260229b979
terminal/logflags: Added SetLoggerFactory(LoggerFactory) (#3257)
* terminal/logflags: Added `SetLoggerFactory(LoggerFactory)`

This change will enable people who want to embed Delve into their applications to adjust the logging better to their needs.

* terminal/logflags: Added `SetLoggerFactory(LoggerFactory)`

Added changes from code review.

* terminal/logflags: Added `SetLoggerFactory(LoggerFactory)`

Reworked requested changes.

* terminal/logflags: Added `SetLoggerFactory(LoggerFactory)`

Reworked requested changes.
2023-02-14 09:46:35 -08:00
Alessandro Arzilli
7c835342d3
*: remove some code for Go 1.12 or earlier (#3271)
Delve no longer compiles on Go1.12 and earlier, we don't test it on
these versions and they are 4 years old and unsupported. Remove some
code related to Go 1.12 and earlier, mostly from tests.
2023-02-14 09:38:15 -08:00
Oleksandr Redko
f6e6eadd22
pkg/proc,service/test: refactor to strings.ReplaceAll (#3269)
Use strings.ReplaceAll instead of strings.Replace with -1 as the last argument.
2023-02-14 09:36:24 -08:00
Alessandro Arzilli
bc5c0d4a9b
_scripts: Update staticcheck (#3270) 2023-02-14 09:36:00 -08:00
Alessandro Arzilli
95e33edf53
proc/native: fix syscalls to SYS_PROCESS_VM_READV (and WRITEV) (#3273)
Per https://pkg.go.dev/unsafe#Pointer conversions from unsafe.Pointer
to uintptr are only safe in limited circumstances. In particular only
conversions made in the syscall call are pinned.
Additionally add a call to runtime.KeepAlive to mitigate the bug
described in: https://github.com/golang/go/issues/58351
2023-02-14 09:32:13 -08:00
jochen
19368d8ed3
dwarf: fix broken external url to arm dwarf mapping (#3272) 2023-02-14 16:34:34 +01:00
Felix Geisendörfer
e11e8858ea
Documentation: watch example for arbitrary address (#3268)
Fixes #3266
2023-02-13 06:27:14 -08:00
Oleksandr Redko
4303ae45a8
service/dap: correct typos in comments (#3264) 2023-02-02 13:46:19 +01:00
Derek Parker
98f6d0b619
cmd/dlv: fix exit status for trace subcommand (#3263)
We currently return an error when the command exits because a process
exited error is always returned. Detect this like we do in other code
paths to return a 0 exit code instead of nonzero which indicates the
command itself failed and can confuse other tools.
2023-02-02 11:11:31 +01:00
Frederic Branczyk
436fed8ec4
godwarf: Allow extracting a DWARF entry's field (#3258)
Previously it was only possible to extract a value of type `any` using
an attribute name. This poses challenges when fields are allowed to have
different classes, and it is ambiguous how to handle them.
2023-01-31 08:40:19 -08:00
Oleksandr Redko
011fe673fe
_scripts: fix log.Printf format specifier (#3260) 2023-01-31 14:30:04 +01:00
Oleksandr Redko
64a9024735
cmd/dlv, pkg/proc: use T.TempDir in tests (#3256) 2023-01-30 15:04:55 -08:00
Derek Parker
a01fe73845
pkg/proc: do not check decl line for FunctionArguments (#3254)
Fixes a bug where we cannot get locals (including arguments and return
values) from a given scope because the line number state machine ends up
in an invalid state because of this parameter being set to false.
2023-01-24 15:56:05 +01:00
Alessandro Arzilli
2be9cf1fab
terminal: use exact window size for pager (#3249)
Instead of using a fixed 100x30 window size query the operating system
for the exact size, also fixes a bug where the last line before calling
the pager is repeated twice.
2023-01-16 09:20:43 -08:00
Oleksandr Redko
58fc3931e8
proc/dwarf: Move util functions to dwarf package (#3252) 2023-01-16 09:20:20 -08:00
Oleksandr Redko
13143680f7
proc/dwarf: LEB128 encode/decode in separate pkg (#3235) 2023-01-10 12:29:58 -08:00
Derek Parker
3847b7a199
debugger,terminal: Allow setting and clearing breakpoints after process exit (#3246)
This patch allows users to set a breakpoint even when the process has
exited. It will be left in a pending state until the process is
restarted.

Fixes #3242
2023-01-06 18:37:35 +01:00
Derek Parker
8db9be977c
pkg/terminal: use default for Y/n empty response (#3248)
The typical convention with `[Y/n]` type command line questions
is that the capitalized letter represents the default if the user
simply hits "enter" instead of typing an actual response.
This patch fixes our implementation to use the implied default response.
2023-01-06 08:49:15 +01:00
Frederic Branczyk
9c44954860
godwarf: Attempt to load DW_AT_specification if present (#3247) 2023-01-05 09:45:55 -08:00
Tim Hockin
62335703d2
terminal: Add config options for tab printing (#3243)
New config "tab" allows user to set a string instead of literal tab
(e.g. "... ").

New config "source-list-tab-color" allows that string to be colored.

This builds on top of the `updateColorScheme` change
2023-01-05 14:09:03 +01:00
Aviram Hassan
4050a62c0a
pkg/proc: fix stripping DYLD_INSERT_LIBRARIES on macOS (#3245) 2023-01-04 14:14:23 -08:00
Alessandro Arzilli
4aaa184b31
cmd/dlv: match go test behavior when dlv test gets a list of .go files (#3232)
When 'dlv test' is called with a list of files it should match the
behavior of 'go test' and chdir to the directory where the go files are
(if they are all in the same directory).

Fixes #3230
2023-01-04 10:47:27 -08:00
Andrei Matei
aee401b69a
pkg/proc: populate pointer values (#3229)
* proc: add a test for dangling unsafe pointers

This new tests checks the behavior when dereferencing dangling pointers.
The behavior does not fully make sense; the test checks the current
behavior for now, which will be improved in subsequent commits.

* proc: populate pointer values

This patch changes how Value and Unreadable are populated for pointer
Variables. Before this patch, variables of kind reflect.Ptr did not have
their Value field populated. This patch populates it in
Variable.loadValue(), which seems natural and consistent with other
types of variables. The Value is the address that the pointer points to.
The Unreadable field was populated inconsistently for pointer variables:
it was never populated for an outer pointer, but it could be populated
for an inner pointer in pointer-to-pointer types. Before this patch,
in pointer whose value could not be read was not easily distinguishable
from a pointer with a value that could be read, but that cannot be
dereferenced (i.e. a dangling pointer): neither of these would be marked
as Unreadable, and both would have a child marked as Unreadable. This
patch makes it so that a pointer variable whose pointer value cannot be
read is marked as Unreadable.

Using this new distinction, this patch fixes a bug around dereferencing
dangling pointers: before, attempting such a dereference produced a
"nil pointer dereference" error. This was bogus, since the pointer was
not nil. Now, we are more discerning and generate a different error.
2023-01-04 09:07:23 -08:00
Derek Parker
9230a97210
pkg/terminal: fix handling list colors via config (#3240)
Parsing the source list color when set during a Delve debug session
resulted in unexpected errors. Additionally the changes were not reflected
in the current session, forcing the user to save the config and start a
new session. This patch fixes those issues.
2023-01-04 10:22:19 +01:00
Alessandro Arzilli
709da9a217
Documentation: document how to debug runtime with Delve (#3234)
Add FAQ entry to document how to debug the Go runtime using Delve.
Also add table of contents to FAQ.
2023-01-03 09:23:26 -08:00
Hyang-Ah Hana Kim
9f731debb1
go.mod: update github.com/google/go-dap to v0.7.0 (#3237)
* go.mod: update github.com/google/go-dap to v0.7.0

Updates https://github.com/google/go-dap/issues/66

* Run go mod tidy
2023-01-03 08:40:51 -08:00
Hyang-Ah Hana Kim
bbc22707d0
pkg/proc: apply simplifycompositelit analysis fixes (#3236)
https://pkg.go.dev/golang.org/x/tools/internal/lsp/analysis/simplifycompositelit
2023-01-03 08:13:28 -08:00
Oleksandr Redko
a6e3d14455
proc: Fix typos in the comments (#3231) 2022-12-28 12:41:13 +01:00
Andrei Matei
983624c484
service/debugger: fix comment on EvalVariableInScope (#3225) 2022-12-20 10:06:54 -08:00
Alessandro Arzilli
00df758d57
proc/native: fix FreeBSD backend (#3224)
- use PT_SUSPEND/PT_RESUME to control running threads in
  resume/stop/singleStep
- change manual stop signal from SIGTRAP to SIGSTOP to make manual stop
  handling simpler
- change (*nativeProcess).trapWaitInternal to suspend newly created
  threads when we are stepping a thread
- change (*nativeProcess).trapWaitInternal to handle some unhandled
  stop events
- remove misleading (*nativeProcess).waitFast which does not do
  anything different from the normal wait variant
- rewrite (*nativeProcess).stop to only set breakpoints for threads of
  which we have received SIGTRAP
- rewrite (*nativeThread).singleStep to actually execute a single
  instruction and to properly route signals
2022-12-20 09:54:16 -08:00
Alessandro Arzilli
32df4071d2
TeamCity: fix windows/amd64 builds (#3223)
Windows/amd64 builds are not runnning because the current settings.kts
has an implicity requirement to property teamcity.build.systemDir which
does not exist on windows/amd64 agents.
2022-12-19 08:15:00 -08:00
Philippe Blain
72c77b1c30
Documentation/faq: Correct commands in substitute-path section (#3222)
The text of the substitute-path section in the FAQ ("Can not set
breakpoints or see source listing in a complicated debugging
environment") mentions the command 'config help substitute-path', but
'help' is not a valid argument to the 'config' command.

Use 'help config' instead, which does mention 'substitute-path' and how
to set it.

Also, the command to list source files is 'sources', not 'source'. Fix
that.
2022-12-15 09:02:06 +01:00
Oleksandr Redko
9523849883
*: Change comments to match common Go standarts (#3221) 2022-12-14 08:56:07 -08:00
Russell Kennington
753cb4cc3b
Update github.com/derekparker/trie dependency (#3219) 2022-12-14 07:36:07 +01:00
Javier Honduvilla Coto
998e2f2aea
dwarf/frame: Remove expression constants (#3218)
As they are unused and wrong. pkg/dwarf/op/opcodes.go has the right
opcodes and that's what's used

Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>

Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
2022-12-13 09:09:20 -08:00
Oleksandr Redko
34b6ee869f
proc: replace os.SEEK_CUR with io.SeekCurrent (#3214)
Because os.SEEK_CUR is deprecated as stated in the documentation.
2022-12-12 19:16:49 +01:00
Alessandro Arzilli
3a91d56823
Documentation: add -test.run to test example (#3212)
Add -test.run to the example of how 'dlv test' can be used.
2022-12-12 09:59:39 -08:00
Alessandro Arzilli
8e48ad7574
*: bump to version 1.20.1 (#3213) 2022-12-12 09:21:46 -08:00
Alessandro Arzilli
a35b902ecf
gdbserial: continue if tcsetpgrp fails (#3211)
Do not stop if tcsetpgrp errors, also only do it if the target process
got its own process group.

Fixes #3210
2022-12-12 08:36:48 -08:00