Commit Graph

215 Commits

Author SHA1 Message Date
Alessandro Arzilli
b192d84670
service: use name w/o parameters for breakpoints on generic funcs (#2774)
When printing breakpoints on generic functions use the function name
without parameters instead of using the name of the first instantiation
that appears on the list.
2021-12-13 11:41:28 -08:00
Alessandro Arzilli
617d934d3e
proc/gdbserial: allow rewind to work after process exit with rr (#2815)
* service/debugger: fix bug internal err with Restart on recorded target

If Restart is called after a Continue and Rewind on a recorded target
that has already terminated it will return an internal error.

* proc/gdbserial: allow rewind to work after process exit with rr

It is sometimes useful to set breakpoints and rewind a terminated
process when using rr, for example if interested in the last execution
of some function.
RR will not allow a backward continue after the process exit packet has
been  sent, however rr will also generate a synthetic SIGKILL right
before process exit.
Treat this packet as a process exit and change some things so both
continuing backwards and setting breakpoints can be done, on recorded
targets, after process exit has been reported.
2021-12-13 11:39:20 -08:00
Alessandro Arzilli
01b01423ae
proc/*: minor miscellaneous code cleanups (#2790)
* made Pid a method of Target instead of a method of Process
* changed argument of NewTarget to ProcessInternal, since that's the
  interface that backends have to implement
* removed warnings about ProcessInternal since there is no way for
  users of pkg/proc to access those methods anyway
* made RecordingManipulation an optional interface for backends, Target
  supplies its own dummy implementation when the backend doesn't
* inlined small interfaces that only existed to be inlined in
  proc.Process anyway
* removed unused function findExecutable in the Windows and no-native
  darwin backends
* removed (*EvalScope).EvalVariable, an old synonym for EvalExpression
2021-11-26 08:06:23 -08:00
Alessandro Arzilli
c207db792a
proc,locspec: support setting breakpoints by func name on generic funcs (#2745)
* proc,locspec: support setting breakpoints by func name on generic funcs

Changes proc.Function to parse function names correctly when they
contain instantiation lists and locspec to match generic functions.

* vendor: update golang.org/x/tools

The old version of golang.org/x/tools is incompatible with the new
iexport format.
2021-10-30 11:52:26 -07:00
Derek Parker
689e08260b
eBPF tracing backend return value parsing (#2704)
Add return value parsing for eBPF tracing backend.
2021-10-25 12:37:36 -07:00
Alessandro Arzilli
a97da22762
proc: do not assign temporary breakpoint IDs (#2650)
Internal breakpoints do not need IDs and assigning them from a counter
separate from the user ID counter can be a cause of confusion.
If a user breakpoint is overlayed on top of a pre-existing internal
breakpoint the temporary ID will be surfaced as if it was a user ID,
possibly conflicting with another user ID.
If a temporary breakpoint is overlayed on top of a pre-existing user
breakpoint and the user breakpoint is first deleted and then
re-created, the user ID will be resurrected along with the breakpoint,
instead of allocating a fresh one.

This change removes internal breakpoint IDs entirely, only user
breakpoints receive an ID.
2021-09-29 12:01:37 +02:00
Alessandro Arzilli
29eae8f617
*: clean up staticcheck problems (#2723)
Fix problems that can be fixed, ignore the ones that don't make sense
2021-09-28 12:07:42 -07:00
polinasok
efc4483175
pkg/goversion: visibly warn the user with --check-go-version=false (#2684)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-09-25 17:41:00 +02:00
Suzy Mueller
4b30ba4228
service/dap: add basic log points (#2634)
Log points are special kinds of breakpoints that do not 'break' but instead log a message and then continue. This change implements basic log points that simply log the provided message, without any interpolation.

In order to resume execution after hitting a breakpoint, I added a new lock resumeMu and tracked the running state within the DAP server. resumeMu must be held in order to issue a debugger request that would start execution. This means it can be used to make sure that another goroutine does not resume execution while you are holding the lock.

Most of the synchronization logic is taken from PR #2530

Updates golang/vscode-go#123
2021-09-24 15:22:32 -07:00
Suzy Mueller
e00670b901
service/debugger: return correct exit status on manual halt (#2674)
* service/dap: add test for nonzero exit status
2021-09-24 15:18:28 -07:00
Derek Parker
1b2f7f0051
pkg/proc: Parse Goroutine ID in eBPF tracer (#2654)
This patch enables the eBPF tracer backend to parse the ID of the
Goroutine which hit the uprobe. This implementation is specific to AMD64
and will have to be generalized further in order to be used on other
architectures.
2021-08-24 14:53:27 +02:00
Alessandro Arzilli
4264bf00f2
proc,terminal,service: support stack watchpoints (#2521)
* terminal,service: add way to see internal breakpoints

Now that Delve has internal breakpoints that survive for long periods
of time it will be useful to have an option to display them.

* proc,terminal,service: support stack watchpoints

Adds support for watchpoints on stack allocated variables.

When a stack variable is watched, in addition to the normal watchpoint
some support breakpoints are created:

- one breakpoint inside runtime.copystack, used to adjust the address
  of the watchpoint when the stack is resized
- one or more breakpoints used to detect when the stack variable goes
  out of scope, those are similar to the breakpoints set by StepOut.

Implements #279
2021-08-09 10:41:25 -07:00
Alessandro Arzilli
f3e76238e3
proc: move breakpoint condition evaluation out of backends (#2628)
* proc: move breakpoint condition evaluation out of backends

Moves breakpoint condition evaluation from the point where breakpoints
are set, inside ContinueOnce, to (*Target).Continue.

This accomplishes three things:

1. the breakpoint evaluation method needs not be exported anymore
2. breakpoint condition evaluation can be done with a full scope,
   containing a Target object, something that wasn't possible before
   because ContinueOnce doesn't have access to the Target object.
3. moves breakpoint condition evaluation out of the critical section
   where some of the threads of the target process might be still
   running.

* proc/native: handle process death during stop() on Windows

It is possible that the thread dies while we are inside the stop()
function. This results in an Access is denied error being returned by
SuspendThread being called on threads that no longer exist.

Delay the reporting the error from SuspendThread until the end of
stop() and only report it if the thread still exists at that point.

Fixes flakyness with TestIssue1101 that was exacerbated by moving
breakpoint condition evaluation outside of the backends.
2021-08-09 10:16:24 -07:00
Derek Parker
7caa534d76
service/debugger: Remove target lock on GetBufferedTracepoints (#2645)
There is already a lock on the actual buffered tracepoints collection
within proc, and this method call doesn't do anything to mutate Target
otherwise so we shouldn't be opening ourselves up for a race condition
error or any other kind of parallelism problem.

Additionally, with this lock we essentially can never get the data until
the process has exited becuase `continue` will lock the target. This
change allows us to get the buffered tracepoint information immediately
and display it as the program is running.
2021-08-05 13:53:09 +02:00
Derek Parker
10406f96d5
*: Initial eBPF tracing support (#2625) 2021-07-31 17:16:26 +02:00
Alessandro Arzilli
658d36cb19
proc: allow multiple overlapping internal breakpoints (#2519)
Changes Breakpoint to allow multiple overlapping internal breakpoints
on the same instruction address.
This is done by changing the Breakpoint structure to contain a list of
"breaklets", each breaklet has a BreakpointKind and a condition
expression, independent of the other.
A breakpoint is considered active if any of its breaklets are active.
A breakpoint is removed when all its breaklets are removed.
We also change the terminology "internal breakpoint" to "stepping
breakpoint":

HasInternalBreakpoints -> HasSteppingBreakpoints
IsInternal -> IsStepping
etc...

The motivation for this change is implementing watchpoints on stack
variables.
Watching a stack variable requires also setting a special breakpoint to
find out when the variable goes out of scope. These breakpoints can not
be UserBreakpoints because only one user breakpoint is allowed on the
same instruction and they can not be internal breakpoints because they
should not be cleared when a next operation is completed (they should
be cleared when the variable watch is cleared).

Updates #279
2021-07-21 08:24:19 -07:00
Alessandro Arzilli
f0a32c8e1b
Go 1.17 support branch (#2451)
* proc: support new Go 1.17 panic/defer mechanism

Go 1.17 will create wrappers for deferred calls that take arguments.
Change defer reading code so that wrappers are automatically unwrapped.

Also the deferred function is called directly by runtime.gopanic, without going through runtime.callN which means that sometimes when a panic happens the stack is either:

0. deferred function call
1. deferred call wrapper
2. runtime.gopanic

or:

0. deferred function call
1. runtime.gopanic

instead of always being:

0. deferred function call
1. runtime.callN
2. runtime.gopanic

the isPanicCall check is changed accordingly.

* test: miscellaneous minor test fixes for Go 1.17

* proc: resolve inlined calls when stepping out of runtime.breakpoint

Calls to runtime.Breakpoint are inlined in Go 1.17 when inlining is
enabled, resolve inlined calls in stepInstructionOut.

* proc: add support for debugCallV2 with regabi

This change adds support for the new debug call protocol which had to
change for the new register ABI introduced in Go 1.17.

Summary of changes:
- Abstracts over the debug call version depending on the Go version
  found in the binary.
- Uses R12 instead of RAX as the debug protocol register when the binary
  is from Go 1.17 or later.
- Creates a variable directly from the DWARF entry for function
  arguments to support passing arguments however the ABI expects.
- Computes a very conservative stack frame size for the call when
  injecting a call into a Go process whose version is >=1.17.

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
Co-authored-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>

* TeamCity: enable tests on go-tip

* goversion: version compatibility bump

* TeamCity: fix go-tip builds on macOS/arm64

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
2021-07-08 08:47:53 -07:00
Alessandro Arzilli
1b0c4310c4
proc: give unique addresses to registerized variables (#2527)
We told clients that further loading of variables can be done by
specifying a type cast using the address of a variable that we
returned.
This does not work for registerized variables (or, in general,
variables that have a complex location expression) because we don't
give them unique addresses and we throw away the compositeMemory object
we made to read them.

This commit changes proc so that:

1. variables with location expression divided in pieces do get a unique
   memory address
2. the compositeMemory object is saved somewhere
3. when an integer is cast back into a pointer type we look through our
   saved compositeMemory objects to see if there is one that covers the
   specified address and use it.

The unique memory addresses we generate have the MSB set to 1, as
specified by the Intel 86x64 manual addresses in this form are reserved
for kernel memory (which we can not read anyway) so we are guaranteed
to never generate a fake memory address that overlaps a real memory
address of the application.

The unfortunate side effect of this is that it will break clients that
do not deserialize the address to a 64bit integer. This practice is
contrary to how we defined our types and contrary to the specification
of the JSON format, as of json.org, however it is also fairly common,
due to javascript itself having only 53bit integers.

We could come up with a new mechanism but then even more old clients
would have to be changed.
2021-07-02 18:37:55 +02:00
Alessandro Arzilli
7c82164264
terminal,service: Add filtering and grouping to goroutines command (#2504)
Adds filtering and grouping to the goroutines command.

The current implementation of the goroutines command is modeled after
the threads command of gdb. It works well for programs that have up to
a couple dozen goroutines but becomes unusable quickly after that.

This commit adds the ability to filter and group goroutines by several
different properties, allowing a better debugging experience on
programs that have hundreds or thousands of goroutines.
2021-07-01 11:25:33 -07:00
Derek Parker
96b379b5a2
service/debugger: improve CreateBreakpoint docs (#2553)
The existing documentation was a little light on details. This patch
gives more insight into how the argument to this function is used and
interpreted.

* service/rpc2,service/debugger: more doc updates

Combine debugger.CreateBreakpoint documentation with the documentation
that already existed for the rpc2 server CreateBreakpoint method.

Also adds more contextual information for both the server and client
with links to debugger.CreateBreakpoint documentation.
2021-06-29 15:14:24 +02:00
Suzy Mueller
1ebfc5c37b
service/dap: add throw reason to exception info (#2524)
We can get the throw reason by looking at the argument "s" in runtime.throw. This is not currently working in Go 1.16 or Go 1.17 (see golang/go#46425), but does work in Go 1.15 and Go 1.14
2021-06-28 08:39:34 -07:00
Derek Parker
42ecbd4413
proc,terminal: Ensure correct exit status (#2543)
Ensure that any command executed after the process we are trying to
debug prints a correct and consistent exit status.

Previously the exit code was being lost after the first time we printed
that a process has exited. Additionally, certain commands would print
the PID of the process and other would not. This change makes everything
more correct and consistent.
2021-06-22 13:35:13 +02:00
Suzy Mueller
30b3cc2c6f
service/dap: implement array, slice, and map paging (#2512)
If the client supports paging, we allow them to fetch array and slice items in chunks that we assume will be of a reasonable size. For example, VS Code requests indexed variables in chunks of 100.

Fixes golang/vscode-go#1518
2021-06-10 09:34:20 -07:00
Suzy Mueller
b2afb7cd20
pkg/proc: add support for hit count condition breakpoints (#2490)
* pkg/proc: implement support for hit count breakpoints

* update comment

* udpate hitcount comment

* update HitCond description

* add test for hit condition error

* respond to review

* service/dap: add support for hit count breakpoints

* use amendbps to preserve hit counts

* update test health doc

* fix failing test

* simplify hit conditions

* REmove RequestString, use name instead

* update backend_test_health.md

* document hit count cond

* fix tests
2021-05-28 11:21:53 -07:00
Alessandro Arzilli
4f11320e4c
terminal,service: add API and commands for watchpoints (#2488)
Adds API calls and terminal commands to set watchpoints.
2021-05-20 10:04:02 -07:00
Suzy Mueller
745a513179
service/dap: implement function breakpoints (#2450)
* service/dap: implement setFunctionBreakpoints request

* Fix the errors that would not allow func set

* use find locations instead of FindFunctionLocation

* add function breakpoint tests

* return after sending error response

* revert changes to debugger

* exclude regexp function names

* remove switch statement with one case

* remove ReadFile ambiguous test

* Remove TODO for multiple locs

* remove unnecessary setting of bp.Verified on error

* tighten condition for breakpoint name to match function breakpoint

* add tests for different loc types, add FindLocationSpec

* add test using base name of file

* make functionBreakpoint name a constant

* update stop reason to function breakpoint

* remove comment about optimizing onSetFunctionBreakpoints

* respond to review

* add comments to test

* change functionBpPrefix to const

* handle relative paths

* fix capabilites check

* update function breakpoint tests to check for failure

* use negative line number to determine which are errors
2021-05-18 10:25:16 -07:00
Suzy Mueller
30cdedae69
service/dap: implement exception info (#2444)
* service/dap: implement exception info

* remove adding additional thread

* Fix tests

* add exceptionInfo tests

* update comments

* map paths to client paths

* remove launch.json

* remove change to ConvertEvalScope

* correct name of supportsExceptionInfoRequest

* Add TODO for deleting output event

* Print Stack header to buffer

* Try to move resolving exception info to onExceptionInfoRequest

* save the error and return if it is the current thread

* rename thread to g

* findgoroutine returns goroutine

* clean up findgoroutine

* log errors

* remove output event

* fix grammar
2021-05-17 09:25:41 -07:00
Suzy Mueller
1e9c5c3b07
service/dap: warn users of debugging optimized functions (#2475)
* service/dap: warn users of debugging optimized functions

* Add test for optimized scopes

* service/dap: warn users of debugging optimized functions

* rename functionscope

* update warning message
2021-05-17 09:21:15 -07:00
polinasok
03f1ec1dfc
service/dap: support running requests asynchronously (#2423)
* service/dap: refine teardown logic

* Address review comments + add missing lock/unlock

* Narrow lock scope

* Update comments only

* Remove redundan temp var from stopNoDebugProcess

* Clarify comment

* service/dap: support running requests asynchronously

* Respond to review comments

* Remove debugging printf

* Refine locking. Add call TODO. Use -1 for running thread id.

* Fix TestAttachStopOnEntry: it can terminate on halt

* Respond to review comments

* Recover panics in async requests handling

* defer releasing asyncSetupDone, so it happens on panic

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-05-04 12:49:52 -07:00
Alessandro Arzilli
35d4f05c4e
proc: remove duplicate Registers.Get implementations (#2415)
Moves the implementation of Registers.Get out of the backends and into
proc where it can be implemented only once per architecture.
2021-04-28 10:00:26 -07:00
Alessandro Arzilli
6a85f34966
debugger: report error when switching goroutine is impossible (#2424)
Due to variable shadowing the SwitchGoroutine command never failed.
2021-04-21 13:39:19 -07:00
Alessandro Arzilli
3c69f7435e
*: Never use pointer to proc.ErrProcessExited (#2431)
We have some places where we use proc.ErrProcessExited and some places
that use &proc.ErrProcessExited, resulting in checks for process exited
errors occasionally failing on some architectures.
Uniform use of ErrProcessExited to the non-pointer version.

Fixes intermittent failure of TestStepOutPreservesGoroutine.
2021-04-13 08:52:29 +02:00
Alessandro Arzilli
781ad72d62
service: fix breakpoint IDs after Restart with disabled breakpoints (#2425)
When restarting we must take care of setting breakpoint IDs correctly
so that enabled breakpoints do not end up having the same ID as a
disabled breakpoint, also we must make sure that breakpoints created
after restart will not get an ID already used by a disabled breakpoint.
2021-04-12 14:59:43 -07:00
Alessandro Arzilli
f3d7b25fdf
*: remove unused code, variables and constants (#2426) 2021-04-12 14:57:39 -07:00
Álex Sáez
f5d2e132bc
*: Adds toggle command (#2208)
* Adds toggle command

Also adds two rpc2 tests for testing the new functionality

* Removes Debuggers' ToggleBreakpoint method

rpc2's ToggleBreakpoint now calls AmendBreakpoint
Refactors the ClearBreakpoint to avoid a lock.
2021-03-19 11:02:23 -07:00
Alessandro Arzilli
fe904c14d1
service: serialize calls to Command API (#2370)
* service: serialize calls to Command API

Wait until the target process has resumed before accepting new calls to
Command. Before this if a 'continue' was immediately followed by a
'halt' the 'halt' could be processed before the 'continue'.

Fixes #1608
Fixes #2216

* service/rpccommon: fix DeepSource issues
2021-03-08 10:05:10 -08:00
polinasok
2e80b32c41
service/dap: avoid double removal of temp built binary (#2335)
* Avoid double removal of temp binary

* Add back accidentally removed empty line

* Simplify regex

* Use unique build output directories in test cases

* Recover TestLaunchDebugRequest hidden logging and refine error check

* Special case access-denied error on Windows

* Remove special case for access denied on Windows

* Increase remove delay on Win

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-02-24 08:19:07 -08:00
Alessandro Arzilli
2c1a822632
terminal,service,proc/*: adds dump command (gcore equivalent) (#2173)
* proc/core: off-by-one error reading ELF core files

core.(*splicedMemory).ReadMemory checked the entry interval
erroneously when dealing with contiguous entries.

* terminal,service,proc/*: adds dump command (gcore equivalent)

Adds the `dump` command that creates a core file from the target process.

Backends will need to implement a new, optional, method `MemoryMap` that
returns a list of mapped memory regions.
Additionally the method `DumpProcessNotes` can be implemented to write out
to the core file notes describing the target process and its threads. If
DumpProcessNotes is not implemented `proc.Dump` will write a description of
the process and its threads in a OS/arch-independent format (that only Delve
understands).

Currently only linux/amd64 implements `DumpProcessNotes`.

Core files are only written in ELF, there is no minidump or macho-o writers.

# Conflicts:
#	pkg/proc/proc_test.go
2021-01-29 13:39:33 -08:00
Alessandro Arzilli
d61bf018f0
debugger: check that target is valid when detaching (#2263)
Do not call detach if the target is no longer valid.

Fixes #2259

Co-authored-by: a <a@kra>
2020-12-15 08:13:13 -08:00
Alessandro Arzilli
807664b34b
proc: add flag to distinguish ReturnValues (#2230)
Adds a flag that distinguishes the return values of an injected
function call from the return values of a function call executed by the
target program.
2020-12-10 08:57:50 -08:00
aarzilli
db93049813 service,terminal: apply substitute path to trace/break argument
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements #2203
2020-11-17 16:41:35 +01:00
polinasok
c94db60d27
service/dap: support evaluate requests with expressions and calls (#2185)
* Support evaluate request

* Fix failing tests

* Call support

* Remove debugger.CurrentThread() that got accidentally reintroduced during merge

* Address review comments

* Function to stringify stop reason

* Add resetHandlesForStop

* Handle stop inside call

* More tests

* Address review comments

* Check all threads to determine if call completed

* Fix test

* Fix test

* Fix test

* Address review comments

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-11-12 15:24:31 -08:00
Alessandro Arzilli
0843376018
proc/*: remove proc.Thread.Blocked, refactor memory access (#2206)
On linux we can not read memory if the thread we use to do it is
occupied doing certain system calls. The exact conditions when this
happens have never been clear.

This problem was worked around by using the Blocked method which
recognized the most common circumstances where this would happen.

However this is a hack: Blocked returning true doesn't mean that the
problem will manifest and Blocked returning false doesn't necessarily
mean the problem will not manifest. A side effect of this is issue
#2151 where sometimes we can't read the memory of a thread and find its
associated goroutine.

This commit fixes this problem by always reading memory using a thread
we know to be good for this, specifically the one returned by
ContinueOnce. In particular the changes are as follows:

1. Remove (ProcessInternal).CurrentThread and
(ProcessInternal).SetCurrentThread, the "current thread" becomes a
field of Target, CurrentThread becomes a (*Target) method and
(*Target).SwitchThread basically just sets a field Target.

2. The backends keep track of their own internal idea of what the
current thread is, to use it to read memory, this is the thread they
return from ContinueOnce as trapthread

3. The current thread in the backend and the current thread in Target
only ever get synchronized in two places: when the backend creates a
Target object the currentThread field of Target is initialized with the
backend's current thread and when (*Target).Restart gets called (when a
recording is rewound the currentThread used by Target might not exist
anymore).

4. We remove the MemoryReadWriter interface embedded in Thread and
instead add a Memory method to Process that returns a MemoryReadWriter.
The  backends will return something here that will read memory using
the current thread saved by the backend.

5. The Thread.Blocked method is removed

One possible problem with this change is processes that have threads
with different memory maps. As far as I can determine this could happen
on old versions of linux but this option was removed in linux 2.5.

Fixes #2151
2020-11-09 11:28:40 -08:00
Alessandro Arzilli
9a3c9ebad1
proc/*: add launch option to disable ASLR (#2202)
Fixes #1847
2020-10-21 12:50:52 -07:00
Suzy Mueller
5632cf92be
service/dap: add "panic" and "fatal error" as stopped reasons (#2186)
* service/dap: add "panic" and "fatal error" as stopped reasons

The unrecovered panic and fatal throw breakpoints are not set by the
user. We now check for these special breakpoints and send appropriate
stopped reasons to the client.

* Add getter for StopReason

* Set threadID and stop reason correctly

If there is no selected goroutine, no goroutine ID should be set in
the stopped event.

The stopped reason can be better determined using the process
StopReason.

* Update panic breakpoint on next test to work with Go 1.13 runtime

When running panic.go with Go1.13, the next line that is stepped to
after panic('boom') is the defer function in the runtime package. The
unrecovered panic breakpoint is not hit until after several steps.

The test now steps until the breakpoint is hit, or the program terminates
without hitting the unrecovered panic breakpoint, in which case it fails.

* Skip breakpoint on next test in < Go 1.14
2020-10-07 08:24:40 -07:00
Alessandro Arzilli
310a124dba
service/*: remove threadID argument of (*Debugger).PackageVariables (#2182)
* Travis-CI: add ignorechecksum option to chocolatey command

Looks like a configuration problem on chocolatey's end.

* service/*: remove threadID argument of (*Debugger).PackageVariables

Which thread is used doesn't make any difference to the list of package
variables that is returned and this option was only ever used by an old
v1 API call.
2020-09-24 08:02:29 -07:00
polinasok
4980fff8ce
service/dap: Add support for package globals to scopes/variables requests (#2160)
* Support global variables

* Respond to review comments

* Clarify comment

* Add more details to test error messages

* Remove flaky main..inittask checks

* Rename globals flag to match vscode-go

* Normalize filepath with slash separator

* Improve handling for unknown package

* Tweak error message

* More refactoring, normalization and error details to deal with Win test failures

* Clean up optional launch args processing

* Add CurrentPackage to debugger and use instead of ListPackagesBuildInfo

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-09-15 13:14:55 -07:00
aarzilli
6ef7aa8743 service: move some type conversions from service/debugger to rpc pkgs
Move the conversion of some 'proc' types from service/debugger into
service/rpc1 and service/rpc2. The methods of
service/debugger.(*Debugger) are also used by service/dap which
requires these types to be converted differently and converting them
twice is inefficent and doesn't make much sense.

Updates #2161
2020-09-10 16:19:04 +02:00
Alessandro Arzilli
12009e9833
proc/*,service: replace uses of uintptr with uint64 (#2163)
Since proc is supposed to work independently from the target
architecture it shouldn't use architecture-dependent types, like
uintptr. For example when reading a 64bit core file on a 32bit
architecture, uintptr will be 32bit but the addresses proc needs to
represent will be 64bit.
2020-09-09 10:36:15 -07:00
aarzilli
7555d1c063 cmd,proc,terminal,debugger: Support default file descriptor redirects
Adds features to support default file descriptor redirects for the
target process:

1. A new command line flag '--redirect' and '-r' are added to specify
   file redirects for the target process
2. New syntax is added to the 'restart' command to specify file
   redirects.
3. Interactive instances will check if stdin/stdout and stderr are
   terminals and print a helpful error message if they aren't.
2020-09-01 21:50:27 +02:00