diff --git a/.deepsource.toml b/.deepsource.toml index 5f2b68ef2..5211dbe05 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -9,5 +9,5 @@ name = "go" enabled = true [analyzers.meta] - import_path = "github.com/go-delve/delve" + import_path = "github.com/undoio/delve" dependencies_vendored = true diff --git a/Documentation/KnownBugs.md b/Documentation/KnownBugs.md index 3b0545dbd..6024dbce9 100644 --- a/Documentation/KnownBugs.md +++ b/Documentation/KnownBugs.md @@ -1,5 +1,5 @@ # Known Bugs -- When Delve is compiled with versions of go prior to 1.7.0 it is not possible to set a breakpoint on a function in a remote package using the `Receiver.MethodName` syntax. See [Issue #528](https://github.com/go-delve/delve/issues/528). +- When Delve is compiled with versions of go prior to 1.7.0 it is not possible to set a breakpoint on a function in a remote package using the `Receiver.MethodName` syntax. See [Issue #528](https://github.com/undoio/delve/issues/528). - When running Delve on binaries compiled with a version of go prior to 1.9.0 `locals` will print all local variables, including ones that are out of scope, the shadowed flag will be applied arbitrarily. If there are multiple variables defined with the same name in the current function `print` will not be able to select the correct one for the current line. - `reverse step` will not reverse step into functions called by deferred calls. diff --git a/Documentation/api/ClientHowto.md b/Documentation/api/ClientHowto.md index 34807c13d..a4025e323 100644 --- a/Documentation/api/ClientHowto.md +++ b/Documentation/api/ClientHowto.md @@ -27,7 +27,7 @@ Command line arguments that should be handed to the inferior process should be s dlv exec --headless ./somebinary -- these arguments are for the inferior process ``` -Specifying a static port number, like in the [README](//github.com/go-delve/Delve/tree/master/Documentation/README.md) example, can be done using `--listen=127.0.0.1:portnumber`. +Specifying a static port number, like in the [README](//github.com/undoio/Delve/tree/master/Documentation/README.md) example, can be done using `--listen=127.0.0.1:portnumber`. This will, however, cause problems if you actually spawn multiple instances of the debugger. @@ -39,11 +39,11 @@ The `--log-dest` option can be used to redirect the "API server listening at:" m Once you have a running headless instance you can connect to it and start sending commands. Delve's protocol is built on top of the [JSON-RPC 1.0 specification](https://www.jsonrpc.org/specification_v1). -The methods of a `service/rpc2.RPCServer` are exposed through this connection, to find out which requests you can send see the documentation of RPCServer on [godoc](https://godoc.org/github.com/go-delve/Delve/service/rpc2#RPCServer). +The methods of a `service/rpc2.RPCServer` are exposed through this connection, to find out which requests you can send see the documentation of RPCServer on [godoc](https://godoc.org/github.com/undoio/Delve/service/rpc2#RPCServer). ### Example -Let's say you are trying to create a breakpoint. By looking at [godoc](https://godoc.org/github.com/go-delve/Delve/service/rpc2#RPCServer) you'll find that there is a `CreateBreakpoint` method in `RPCServer`. +Let's say you are trying to create a breakpoint. By looking at [godoc](https://godoc.org/github.com/undoio/Delve/service/rpc2#RPCServer) you'll find that there is a `CreateBreakpoint` method in `RPCServer`. This method, like all other methods of RPCServer that you can call through the API, has two arguments: `args` and `out`: `args` contains all the input arguments of `CreateBreakpoint`, while `out` is what `CreateBreakpoint` will return to you. @@ -190,7 +190,7 @@ If you want to let your users specify a breakpoint on a function selected from a list of all functions you should specify the name of the function in the FunctionName field of Breakpoint. -If you want to support the [same language as dlv's break and trace commands](//github.com/go-delve/Delve/tree/master/Documentation/cli/locspec.md) +If you want to support the [same language as dlv's break and trace commands](//github.com/undoio/Delve/tree/master/Documentation/cli/locspec.md) you should call RPCServer.FindLocation and then use the returned slice of Location objects to create Breakpoints to pass to CreateBreakpoint: just fill each Breakpoint.Addr with the @@ -244,7 +244,7 @@ are interested in the topmost stack frame of the current goroutine (or thread) use: `EvalScope{ GoroutineID: -1, Frame: 0 }`. More information on the expression language interpreted by RPCServer.Eval -can be found [here](//github.com/go-delve/Delve/tree/master/Documentation/cli/expr.md). +can be found [here](//github.com/undoio/Delve/tree/master/Documentation/cli/expr.md). ### Variable shadowing diff --git a/Documentation/api/dap/README.md b/Documentation/api/dap/README.md index a67b1d528..7a674c8a9 100644 --- a/Documentation/api/dap/README.md +++ b/Documentation/api/dap/README.md @@ -17,7 +17,7 @@ detailed [debugging documentation](https://github.com/golang/vscode-go/blob/mast [DAP](https://microsoft.github.io/debug-adapter-protocol/specification) is a general debugging protocol supported by many [tools](https://microsoft.github.io/debug-adapter-protocol/implementors/tools/) and [programming languages](https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/). We tailored it to Go specifics, such as mapping [threads request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads) to communicate goroutines and [exceptionInfo request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ExceptionInfo) to support panics and fatal errors. -See [dap.Server.handleRequest](https://github.com/go-delve/delve/search?q=handleRequest) and capabilities set in [dap.Server.onInitializeRequest](https://github.com/go-delve/delve/search?q=onInitializeRequest) for an up-to-date list of supported requests and options. +See [dap.Server.handleRequest](https://github.com/undoio/delve/search?q=handleRequest) and capabilities set in [dap.Server.onInitializeRequest](https://github.com/undoio/delve/search?q=onInitializeRequest) for an up-to-date list of supported requests and options. ## Launch and Attach Configurations @@ -25,7 +25,7 @@ In addition to the general [DAP spec](https://microsoft.github.io/debug-adapter- - -
requestmoderequiredoptional
launch
godoc +
launch
godoc
debugprogram dlvCwdenvbackendargscwdbuildFlagsoutputnoDebug substitutePath
@@ -44,13 +44,12 @@ In addition to the general [DAP spec](https://microsoft.github.io/debug-adapter-
coreprogram
corefilePath
dlvCwdenv
replaytraceDirPath dlvCwdenv
attach
godoc +
attach
godoc
localprocessId backend
remote
- Not all of the configurations are supported by each of the two available DAP servers: @@ -143,4 +142,4 @@ one must first update the [go-dap](https://github.com/google/go-dap) dependency. \ No newline at end of file +---> diff --git a/Documentation/api/json-rpc/README.md b/Documentation/api/json-rpc/README.md index 4c1fb2ea8..db20369e7 100644 --- a/Documentation/api/json-rpc/README.md +++ b/Documentation/api/json-rpc/README.md @@ -7,11 +7,11 @@ Note that this JSON-RPC interface is served over a streaming socket, *not* over # API versions Delve currently supports two versions of its API. By default a headless instance of `dlv` will serve APIv1 for backward compatibility with old clients, however new clients should use APIv2 as new features will only be made available through version 2. To select APIv2 use `--api-version=2` command line argument. -Clients can also select APIv2 by sending a [SetApiVersion](https://godoc.org/github.com/go-delve/delve/service/rpccommon#RPCServer.SetApiVersion) request specifying `APIVersion = 2` after connecting to the headless instance. +Clients can also select APIv2 by sending a [SetApiVersion](https://godoc.org/github.com/undoio/delve/service/rpccommon#RPCServer.SetApiVersion) request specifying `APIVersion = 2` after connecting to the headless instance. # API version 2 documentation -All the methods of the type `service/rpc2.RPCServer` can be called using JSON-RPC, the documentation for these calls is [available on godoc](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer). +All the methods of the type `service/rpc2.RPCServer` can be called using JSON-RPC, the documentation for these calls is [available on godoc](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer). Note that all exposed methods take one single input parameter (usually called `args`) of a struct type and also return a result of a struct type. Also note that the method name should be prefixed with `RPCServer.` in JSON-RPC. diff --git a/Documentation/cli/README.md b/Documentation/cli/README.md index 62649c138..e554c3fcb 100644 --- a/Documentation/cli/README.md +++ b/Documentation/cli/README.md @@ -107,7 +107,7 @@ Sets a breakpoint. break [name] [locspec] -See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line. +See [Documentation/cli/locspec.md](//github.com/undoio/delve/tree/master/Documentation/cli/locspec.md) for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line. See also: "help on", "help cond" and "help clear" @@ -568,7 +568,7 @@ Executes a file containing a list of delve commands source -If path ends with the .star extension it will be interpreted as a starlark script. See [Documentation/cli/starlark.md](//github.com/go-delve/delve/tree/master/Documentation/cli/starlark.md) for the syntax. +If path ends with the .star extension it will be interpreted as a starlark script. See [Documentation/cli/starlark.md](//github.com/undoio/delve/tree/master/Documentation/cli/starlark.md) for the syntax. If path is a single '-' character an interactive starlark interpreter will start instead. Type 'exit' to exit. @@ -636,7 +636,7 @@ Set tracepoint. trace [name] [locspec] -A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line. +A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See [Documentation/cli/locspec.md](//github.com/undoio/delve/tree/master/Documentation/cli/locspec.md) for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line. See also: "help on", "help cond" and "help clear" diff --git a/Documentation/cli/expr.md b/Documentation/cli/expr.md index 3cb67d7ad..4a4619c7a 100644 --- a/Documentation/cli/expr.md +++ b/Documentation/cli/expr.md @@ -63,7 +63,7 @@ To see more values use the slice operator: For this purpose delve allows use of the slice operator on maps, `m[64:]` will return the key/value pairs of map `m` that follow the first 64 key/value pairs (note that delve iterates over maps using a fixed ordering). -These limits can be configured with `max-string-len` and `max-array-values`. See [config](https://github.com/go-delve/delve/tree/master/Documentation/cli#config) for usage. +These limits can be configured with `max-string-len` and `max-array-values`. See [config](https://github.com/undoio/delve/tree/master/Documentation/cli#config) for usage. # Interfaces diff --git a/Documentation/cli/starlark.md b/Documentation/cli/starlark.md index ffe722446..9682402fd 100644 --- a/Documentation/cli/starlark.md +++ b/Documentation/cli/starlark.md @@ -17,52 +17,52 @@ Global functions with a name that begins with a capital letter will be available Function | API Call ---------|--------- -amend_breakpoint(Breakpoint) | Equivalent to API call [AmendBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.AmendBreakpoint) -ancestors(GoroutineID, NumAncestors, Depth) | Equivalent to API call [Ancestors](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Ancestors) -attached_to_existing_process() | Equivalent to API call [AttachedToExistingProcess](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.AttachedToExistingProcess) -build_id() | Equivalent to API call [BuildID](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.BuildID) -cancel_next() | Equivalent to API call [CancelNext](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CancelNext) -checkpoint(Where) | Equivalent to API call [Checkpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Checkpoint) -clear_breakpoint(Id, Name) | Equivalent to API call [ClearBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ClearBreakpoint) -clear_checkpoint(ID) | Equivalent to API call [ClearCheckpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ClearCheckpoint) -raw_command(Name, ThreadID, GoroutineID, ReturnInfoLoadConfig, Expr, UnsafeCall) | Equivalent to API call [Command](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Command) -create_breakpoint(Breakpoint) | Equivalent to API call [CreateBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateBreakpoint) -create_ebpf_tracepoint(FunctionName) | Equivalent to API call [CreateEBPFTracepoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateEBPFTracepoint) -create_watchpoint(Scope, Expr, Type) | Equivalent to API call [CreateWatchpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateWatchpoint) -detach(Kill) | Equivalent to API call [Detach](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Detach) -disassemble(Scope, StartPC, EndPC, Flavour) | Equivalent to API call [Disassemble](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Disassemble) -dump_cancel() | Equivalent to API call [DumpCancel](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpCancel) -dump_start(Destination) | Equivalent to API call [DumpStart](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpStart) -dump_wait(Wait) | Equivalent to API call [DumpWait](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpWait) -eval(Scope, Expr, Cfg) | Equivalent to API call [Eval](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Eval) -examine_memory(Address, Length) | Equivalent to API call [ExamineMemory](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ExamineMemory) -find_location(Scope, Loc, IncludeNonExecutableLines, SubstitutePathRules) | Equivalent to API call [FindLocation](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.FindLocation) -function_return_locations(FnName) | Equivalent to API call [FunctionReturnLocations](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.FunctionReturnLocations) -get_breakpoint(Id, Name) | Equivalent to API call [GetBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetBreakpoint) -get_buffered_tracepoints() | Equivalent to API call [GetBufferedTracepoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetBufferedTracepoints) -get_thread(Id) | Equivalent to API call [GetThread](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetThread) -is_multiclient() | Equivalent to API call [IsMulticlient](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.IsMulticlient) -last_modified() | Equivalent to API call [LastModified](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.LastModified) -breakpoints(All) | Equivalent to API call [ListBreakpoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListBreakpoints) -checkpoints() | Equivalent to API call [ListCheckpoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListCheckpoints) -dynamic_libraries() | Equivalent to API call [ListDynamicLibraries](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListDynamicLibraries) -function_args(Scope, Cfg) | Equivalent to API call [ListFunctionArgs](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListFunctionArgs) -functions(Filter) | Equivalent to API call [ListFunctions](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListFunctions) -goroutines(Start, Count, Filters, GoroutineGroupingOptions) | Equivalent to API call [ListGoroutines](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListGoroutines) -local_vars(Scope, Cfg) | Equivalent to API call [ListLocalVars](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListLocalVars) -package_vars(Filter, Cfg) | Equivalent to API call [ListPackageVars](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListPackageVars) -packages_build_info(IncludeFiles) | Equivalent to API call [ListPackagesBuildInfo](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListPackagesBuildInfo) -registers(ThreadID, IncludeFp, Scope) | Equivalent to API call [ListRegisters](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListRegisters) -sources(Filter) | Equivalent to API call [ListSources](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListSources) -threads() | Equivalent to API call [ListThreads](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListThreads) -types(Filter) | Equivalent to API call [ListTypes](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListTypes) -process_pid() | Equivalent to API call [ProcessPid](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ProcessPid) -recorded() | Equivalent to API call [Recorded](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Recorded) -restart(Position, ResetArgs, NewArgs, Rerecord, Rebuild, NewRedirects) | Equivalent to API call [Restart](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Restart) -set_expr(Scope, Symbol, Value) | Equivalent to API call [Set](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Set) -stacktrace(Id, Depth, Full, Defers, Opts, Cfg) | Equivalent to API call [Stacktrace](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Stacktrace) -state(NonBlocking) | Equivalent to API call [State](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.State) -toggle_breakpoint(Id, Name) | Equivalent to API call [ToggleBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ToggleBreakpoint) +amend_breakpoint(Breakpoint) | Equivalent to API call [AmendBreakpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.AmendBreakpoint) +ancestors(GoroutineID, NumAncestors, Depth) | Equivalent to API call [Ancestors](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Ancestors) +attached_to_existing_process() | Equivalent to API call [AttachedToExistingProcess](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.AttachedToExistingProcess) +build_id() | Equivalent to API call [BuildID](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.BuildID) +cancel_next() | Equivalent to API call [CancelNext](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.CancelNext) +checkpoint(Where) | Equivalent to API call [Checkpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Checkpoint) +clear_breakpoint(Id, Name) | Equivalent to API call [ClearBreakpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ClearBreakpoint) +clear_checkpoint(ID) | Equivalent to API call [ClearCheckpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ClearCheckpoint) +raw_command(Name, ThreadID, GoroutineID, ReturnInfoLoadConfig, Expr, UnsafeCall) | Equivalent to API call [Command](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Command) +create_breakpoint(Breakpoint) | Equivalent to API call [CreateBreakpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.CreateBreakpoint) +create_ebpf_tracepoint(FunctionName) | Equivalent to API call [CreateEBPFTracepoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.CreateEBPFTracepoint) +create_watchpoint(Scope, Expr, Type) | Equivalent to API call [CreateWatchpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.CreateWatchpoint) +detach(Kill) | Equivalent to API call [Detach](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Detach) +disassemble(Scope, StartPC, EndPC, Flavour) | Equivalent to API call [Disassemble](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Disassemble) +dump_cancel() | Equivalent to API call [DumpCancel](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.DumpCancel) +dump_start(Destination) | Equivalent to API call [DumpStart](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.DumpStart) +dump_wait(Wait) | Equivalent to API call [DumpWait](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.DumpWait) +eval(Scope, Expr, Cfg) | Equivalent to API call [Eval](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Eval) +examine_memory(Address, Length) | Equivalent to API call [ExamineMemory](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ExamineMemory) +find_location(Scope, Loc, IncludeNonExecutableLines, SubstitutePathRules) | Equivalent to API call [FindLocation](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.FindLocation) +function_return_locations(FnName) | Equivalent to API call [FunctionReturnLocations](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.FunctionReturnLocations) +get_breakpoint(Id, Name) | Equivalent to API call [GetBreakpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.GetBreakpoint) +get_buffered_tracepoints() | Equivalent to API call [GetBufferedTracepoints](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.GetBufferedTracepoints) +get_thread(Id) | Equivalent to API call [GetThread](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.GetThread) +is_multiclient() | Equivalent to API call [IsMulticlient](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.IsMulticlient) +last_modified() | Equivalent to API call [LastModified](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.LastModified) +breakpoints(All) | Equivalent to API call [ListBreakpoints](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListBreakpoints) +checkpoints() | Equivalent to API call [ListCheckpoints](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListCheckpoints) +dynamic_libraries() | Equivalent to API call [ListDynamicLibraries](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListDynamicLibraries) +function_args(Scope, Cfg) | Equivalent to API call [ListFunctionArgs](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListFunctionArgs) +functions(Filter) | Equivalent to API call [ListFunctions](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListFunctions) +goroutines(Start, Count, Filters, GoroutineGroupingOptions) | Equivalent to API call [ListGoroutines](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListGoroutines) +local_vars(Scope, Cfg) | Equivalent to API call [ListLocalVars](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListLocalVars) +package_vars(Filter, Cfg) | Equivalent to API call [ListPackageVars](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListPackageVars) +packages_build_info(IncludeFiles) | Equivalent to API call [ListPackagesBuildInfo](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListPackagesBuildInfo) +registers(ThreadID, IncludeFp, Scope) | Equivalent to API call [ListRegisters](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListRegisters) +sources(Filter) | Equivalent to API call [ListSources](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListSources) +threads() | Equivalent to API call [ListThreads](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListThreads) +types(Filter) | Equivalent to API call [ListTypes](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ListTypes) +process_pid() | Equivalent to API call [ProcessPid](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ProcessPid) +recorded() | Equivalent to API call [Recorded](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Recorded) +restart(Position, ResetArgs, NewArgs, Rerecord, Rebuild, NewRedirects) | Equivalent to API call [Restart](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Restart) +set_expr(Scope, Symbol, Value) | Equivalent to API call [Set](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Set) +stacktrace(Id, Depth, Full, Defers, Opts, Cfg) | Equivalent to API call [Stacktrace](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.Stacktrace) +state(NonBlocking) | Equivalent to API call [State](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.State) +toggle_breakpoint(Id, Name) | Equivalent to API call [ToggleBreakpoint](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.ToggleBreakpoint) dlv_command(command) | Executes the specified command as if typed at the dlv_prompt read_file(path) | Reads the file as a string write_file(path, contents) | Writes string to a file @@ -93,7 +93,7 @@ If the command function has a doc string it will be used as a help message. # Working with variables -Variables of the target program can be accessed using `local_vars`, `function_args` or the `eval` functions. Each variable will be returned as a [Variable](https://godoc.org/github.com/go-delve/delve/service/api#Variable) struct, with one special field: `Value`. +Variables of the target program can be accessed using `local_vars`, `function_args` or the `eval` functions. Each variable will be returned as a [Variable](https://godoc.org/github.com/undoio/delve/service/api#Variable) struct, with one special field: `Value`. ## Variable.Value diff --git a/Documentation/installation/README.md b/Documentation/installation/README.md index d0204fa63..b16c89a97 100644 --- a/Documentation/installation/README.md +++ b/Documentation/installation/README.md @@ -4,23 +4,23 @@ The following instructions are known to work on Linux, macOS, Windows and FreeBS Clone the git repository and build: ``` -$ git clone https://github.com/go-delve/delve +$ git clone https://github.com/undoio/delve $ cd delve -$ go install github.com/go-delve/delve/cmd/dlv +$ go install github.com/undoio/delve/cmd/dlv ``` Alternatively, on Go version 1.16 or later: ``` # Install the latest release: -$ go install github.com/go-delve/delve/cmd/dlv@latest +$ go install github.com/undoio/delve/cmd/dlv@latest # Install at tree head: -$ go install github.com/go-delve/delve/cmd/dlv@master +$ go install github.com/undoio/delve/cmd/dlv@master # Install at a specific version or pseudo-version: -$ go install github.com/go-delve/delve/cmd/dlv@v1.7.3 -$ go install github.com/go-delve/delve/cmd/dlv@v1.7.4-0.20211208103735-2f13672765fe +$ go install github.com/undoio/delve/cmd/dlv@v1.7.3 +$ go install github.com/undoio/delve/cmd/dlv@v1.7.4-0.20211208103735-2f13672765fe ``` See [Versions](https://go.dev/ref/mod#versions) and [Pseudo-versions](https://go.dev/ref/mod#pseudo-versions) for how to format the version suffixes. @@ -29,7 +29,7 @@ See `go help install` for details on where the `dlv` executable is saved. If during the install step you receive an error similar to this: ``` -found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /home/pi/go/src/github.com/go-delve/delve/pkg/proc/native +found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /home/pi/go/src/github.com/undoio/delve/pkg/proc/native ``` It means that your combination of operating system and CPU architecture is not supported, check the output of `go version`. @@ -56,11 +56,11 @@ sudo dscl . append /Groups/_developer GroupMembership $(whoami) ## Compiling macOS native backend -You do not need the macOS native backend and it [has known problems](https://github.com/go-delve/delve/issues/1112). If you still want to build it: +You do not need the macOS native backend and it [has known problems](https://github.com/undoio/delve/issues/1112). If you still want to build it: 1. Run `xcode-select --install` 2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` -3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve` +3. Clone the repo into `$GOPATH/src/github.com/undoio/delve` 4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate) The makefile will take care of creating and installing a self-signed certificate automatically. diff --git a/Documentation/usage/dlv.md b/Documentation/usage/dlv.md index 5e75d2a3e..8d32a0fbd 100644 --- a/Documentation/usage/dlv.md +++ b/Documentation/usage/dlv.md @@ -45,7 +45,7 @@ Pass flags to the program you are debugging using `--`, for example: * [dlv dap](dlv_dap.md) - Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). * [dlv debug](dlv_debug.md) - Compile and begin debugging main package in current directory, or the package specified. * [dlv exec](dlv_exec.md) - Execute a precompiled binary, and begin a debug session. -* [dlv replay](dlv_replay.md) - Replays a rr trace. +* [dlv replay](dlv_replay.md) - Replays a rr trace or LiveRecorder recording. * [dlv run](dlv_run.md) - Deprecated command. Use 'debug' instead. * [dlv test](dlv_test.md) - Compile test binary and begin debugging program. * [dlv trace](dlv_trace.md) - Compile and begin tracing program. diff --git a/Documentation/usage/dlv_replay.md b/Documentation/usage/dlv_replay.md index fcc995b86..6afb59183 100644 --- a/Documentation/usage/dlv_replay.md +++ b/Documentation/usage/dlv_replay.md @@ -1,17 +1,19 @@ ## dlv replay -Replays a rr trace. +Replays a rr trace or a LiveRecorder recording. ### Synopsis -Replays a rr trace. +Replays a rr trace or a LiveRecorder recording. -The replay command will open a trace generated by mozilla rr. Mozilla rr must be installed: -https://github.com/mozilla/rr +The replay command will open a trace generated by Mozilla rr or a LiveRecorder +recording. Mozilla rr must be installed to open an rr trace: +https://github.com/mozilla/rr; and UDB must be installed to open a LiveRecorder +recording. ``` -dlv replay [trace directory] [flags] +dlv replay [trace directory or LiveRecorder recording] [flags] ``` ### Options diff --git a/README.md b/README.md index a607a13a2..828537bf8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ ![Delve](https://raw.githubusercontent.com/go-delve/delve/master/assets/delve_horizontal.png) [![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/go-delve/delve/master/LICENSE) -[![GoDoc](https://godoc.org/github.com/go-delve/delve?status.svg)](https://godoc.org/github.com/go-delve/delve) -[![Build Status](https://delve.beta.teamcity.com/app/rest/builds/buildType:(id:Delve_AggregatorBuild)/statusIcon.svg)](https://delve.beta.teamcity.com/viewType.html?buildTypeId=Delve_AggregatorBuild&guest=1) +[![GoDoc](https://godoc.org/github.com/undoio/delve?status.svg)](https://godoc.org/github.com/undoio/delve) The GitHub issue tracker is for **bugs** only. Please use the [developer mailing list](https://groups.google.com/forum/#!forum/delve-dev) for any feature proposals and discussions. diff --git a/_fixtures/consts.go b/_fixtures/consts.go index e343bdcf4..ae40a09ed 100644 --- a/_fixtures/consts.go +++ b/_fixtures/consts.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/go-delve/delve/_fixtures/internal/dir0/pkg" + "github.com/undoio/delve/_fixtures/internal/dir0/pkg" "runtime" ) diff --git a/_fixtures/dotpackagesiface.go b/_fixtures/dotpackagesiface.go index 2f3ddb682..67af771ee 100644 --- a/_fixtures/dotpackagesiface.go +++ b/_fixtures/dotpackagesiface.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/go-delve/delve/_fixtures/internal/dir.io" - "github.com/go-delve/delve/_fixtures/internal/dir.io/io.io" + "github.com/undoio/delve/_fixtures/internal/dir.io" + "github.com/undoio/delve/_fixtures/internal/dir.io/io.io" "runtime" ) diff --git a/_fixtures/pkgrenames.go b/_fixtures/pkgrenames.go index 2f31d3054..18f8e3742 100644 --- a/_fixtures/pkgrenames.go +++ b/_fixtures/pkgrenames.go @@ -8,10 +8,10 @@ import ( pkg1 "go/ast" pkg2 "net/http" - "github.com/go-delve/delve/_fixtures/internal/dir.io" - "github.com/go-delve/delve/_fixtures/internal/dir0/pkg" - "github.com/go-delve/delve/_fixtures/internal/dir0/renamedpackage" - dir1pkg "github.com/go-delve/delve/_fixtures/internal/dir1/pkg" + "github.com/undoio/delve/_fixtures/internal/dir.io" + "github.com/undoio/delve/_fixtures/internal/dir0/pkg" + "github.com/undoio/delve/_fixtures/internal/dir0/renamedpackage" + dir1pkg "github.com/undoio/delve/_fixtures/internal/dir1/pkg" ) func main() { diff --git a/_fixtures/plugin2/plugin2.go b/_fixtures/plugin2/plugin2.go index d195c1cac..ff30c8655 100644 --- a/_fixtures/plugin2/plugin2.go +++ b/_fixtures/plugin2/plugin2.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/go-delve/delve/_fixtures/internal/pluginsupport" + "github.com/undoio/delve/_fixtures/internal/pluginsupport" ) func Fn2() string { diff --git a/_fixtures/plugintest2.go b/_fixtures/plugintest2.go index 6a81b99fb..781911dea 100644 --- a/_fixtures/plugintest2.go +++ b/_fixtures/plugintest2.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/go-delve/delve/_fixtures/internal/pluginsupport" + "github.com/undoio/delve/_fixtures/internal/pluginsupport" "os" "plugin" ) diff --git a/_scripts/gen-cli-docs.go b/_scripts/gen-cli-docs.go index 63b00c000..46a8f6542 100644 --- a/_scripts/gen-cli-docs.go +++ b/_scripts/gen-cli-docs.go @@ -8,7 +8,7 @@ import ( "log" "os" - "github.com/go-delve/delve/pkg/terminal" + "github.com/undoio/delve/pkg/terminal" ) func main() { diff --git a/_scripts/gen-starlark-bindings.go b/_scripts/gen-starlark-bindings.go index 25d4c8d55..7b30c0bb8 100644 --- a/_scripts/gen-starlark-bindings.go +++ b/_scripts/gen-starlark-bindings.go @@ -158,7 +158,7 @@ func genMapping(bindings []binding) []byte { fmt.Fprintf(buf, "// DO NOT EDIT: auto-generated using _scripts/gen-starlark-bindings.go\n\n") fmt.Fprintf(buf, "package starbind\n\n") - fmt.Fprintf(buf, "import ( \"go.starlark.net/starlark\" \n \"github.com/go-delve/delve/service/api\" \n \"github.com/go-delve/delve/service/rpc2\" \n \"fmt\" )\n\n") + fmt.Fprintf(buf, "import ( \"go.starlark.net/starlark\" \n \"github.com/undoio/delve/service/api\" \n \"github.com/undoio/delve/service/rpc2\" \n \"fmt\" )\n\n") fmt.Fprintf(buf, "func (env *Env) starlarkPredeclare() starlark.StringDict {\n") fmt.Fprintf(buf, "r := starlark.StringDict{}\n\n") @@ -173,15 +173,15 @@ func genMapping(bindings []binding) []byte { fmt.Fprintf(buf, "if len(args) > %d && args[%d] != starlark.None { err := unmarshalStarlarkValue(args[%d], &rpcArgs.%s, %q); if err != nil { return starlark.None, decorateError(thread, err) } }", i, i, i, binding.argNames[i], binding.argNames[i]) switch binding.argTypes[i] { - case "*github.com/go-delve/delve/service/api.LoadConfig": + case "*github.com/undoio/delve/service/api.LoadConfig": if binding.fn.Name() != "Stacktrace" { fmt.Fprintf(buf, "else { cfg := env.ctx.LoadConfig(); rpcArgs.%s = &cfg }", binding.argNames[i]) } - case "github.com/go-delve/delve/service/api.LoadConfig": + case "github.com/undoio/delve/service/api.LoadConfig": fmt.Fprintf(buf, "else { rpcArgs.%s = env.ctx.LoadConfig() }", binding.argNames[i]) - case "*github.com/go-delve/delve/service/api.EvalScope": + case "*github.com/undoio/delve/service/api.EvalScope": fmt.Fprintf(buf, "else { scope := env.ctx.Scope(); rpcArgs.%s = &scope }", binding.argNames[i]) - case "github.com/go-delve/delve/service/api.EvalScope": + case "github.com/undoio/delve/service/api.EvalScope": fmt.Fprintf(buf, "else { rpcArgs.%s = env.ctx.Scope() }", binding.argNames[i]) } @@ -225,7 +225,7 @@ func genDocs(bindings []binding) []byte { for _, binding := range bindings { argNames := strings.Join(binding.argNames, ", ") - fmt.Fprintf(&buf, "%s(%s) | Equivalent to API call [%s](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.%s)\n", binding.name, argNames, binding.fn.Name(), binding.fn.Name()) + fmt.Fprintf(&buf, "%s(%s) | Equivalent to API call [%s](https://godoc.org/github.com/undoio/delve/service/rpc2#RPCServer.%s)\n", binding.name, argNames, binding.fn.Name(), binding.fn.Name()) } fmt.Fprintf(&buf, "dlv_command(command) | Executes the specified command as if typed at the dlv_prompt\n") @@ -295,14 +295,14 @@ func main() { Mode: packages.LoadSyntax, Fset: fset, } - pkgs, err := packages.Load(cfg, "github.com/go-delve/delve/service/rpc2") + pkgs, err := packages.Load(cfg, "github.com/undoio/delve/service/rpc2") if err != nil { log.Fatalf("could not load packages: %v", err) } var serverMethods []*types.Func packages.Visit(pkgs, func(pkg *packages.Package) bool { - if pkg.PkgPath == "github.com/go-delve/delve/service/rpc2" { + if pkg.PkgPath == "github.com/undoio/delve/service/rpc2" { serverMethods = getSuitableMethods(pkg.Types, "RPCServer") } return true diff --git a/_scripts/gen-travis.go b/_scripts/gen-travis.go index a6028c92e..7d10bd2b3 100644 --- a/_scripts/gen-travis.go +++ b/_scripts/gen-travis.go @@ -9,7 +9,7 @@ import ( "os" "text/template" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/goversion" ) type arguments struct { diff --git a/_scripts/gen-usage-docs.go b/_scripts/gen-usage-docs.go index 02c9b4a9d..6543150a8 100644 --- a/_scripts/gen-usage-docs.go +++ b/_scripts/gen-usage-docs.go @@ -9,7 +9,7 @@ import ( "os" "path/filepath" - "github.com/go-delve/delve/cmd/dlv/cmds" + "github.com/undoio/delve/cmd/dlv/cmds" "github.com/spf13/cobra/doc" ) diff --git a/_scripts/make.go b/_scripts/make.go index 80b043008..f32adf02b 100644 --- a/_scripts/make.go +++ b/_scripts/make.go @@ -11,11 +11,11 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/goversion" "github.com/spf13/cobra" ) -const DelveMainPackagePath = "github.com/go-delve/delve/cmd/dlv" +const DelveMainPackagePath = "github.com/undoio/delve/cmd/dlv" var Verbose bool var NOTimeout bool @@ -108,7 +108,7 @@ Use the flags -s, -r and -b to specify which tests to run. Specifying nothing wi test.PersistentFlags().StringVarP(&TestSet, "test-set", "s", "", `Select the set of tests to run, one of either: all tests all packages basic tests proc, integration and terminal - integration tests github.com/go-delve/delve/service/test + integration tests github.com/undoio/delve/service/test package-name test the specified package only `) test.PersistentFlags().StringVarP(&TestRegex, "test-run", "r", "", `Only runs the tests matching the specified regex. This option can only be specified if testset is a single package`) @@ -384,6 +384,10 @@ func testStandard() { fmt.Println("\nTesting RR backend") testCmdIntl("basic", "", "rr", "normal") } + if inpath("udb") { + fmt.Println("\nTesting Undo backend") + testCmdIntl("basic", "", "undo", "normal") + } if TestIncludePIE { dopie := false switch runtime.GOOS { @@ -413,6 +417,10 @@ func testStandard() { fmt.Println("\nTesting PIE buildmode, RR backend") testCmdIntl("basic", "", "rr", "pie") } + if runtime.GOOS == "linux" && inpath("udb") { + fmt.Println("\nTesting PIE buildmode, Undo backend") + testCmdIntl("basic", "", "undo", "pie") + } } func testCmdIntl(testSet, testRegex, testBackend, testBuildMode string) { @@ -461,10 +469,10 @@ func testSetToPackages(testSet string) []string { return allPackages() case "basic": - return []string{"github.com/go-delve/delve/pkg/proc", "github.com/go-delve/delve/service/test", "github.com/go-delve/delve/pkg/terminal"} + return []string{"github.com/undoio/delve/pkg/proc", "github.com/undoio/delve/service/test", "github.com/undoio/delve/pkg/terminal"} case "integration": - return []string{"github.com/go-delve/delve/service/test"} + return []string{"github.com/undoio/delve/service/test"} default: for _, pkg := range allPackages() { diff --git a/_scripts/rtype.go b/_scripts/rtype.go index 88f38ce08..da7413adc 100644 --- a/_scripts/rtype.go +++ b/_scripts/rtype.go @@ -160,7 +160,7 @@ func main() { // setup parses the proc package, extracting all +rtype comments and // converting them into rules. func setup() { - pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax, Fset: fset}, "github.com/go-delve/delve/pkg/proc") + pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax, Fset: fset}, "github.com/undoio/delve/pkg/proc") if err != nil { log.Fatalf("could not load proc package: %v", err) } @@ -309,7 +309,7 @@ func isProcVariableDecl(stmt ast.Stmt, tinfo *types.Info) *ast.Ident { if typ == nil { return nil } - if typ == nil || typ.String() != "*github.com/go-delve/delve/pkg/proc.Variable" { + if typ == nil || typ.String() != "*github.com/undoio/delve/pkg/proc.Variable" { return nil } return ident diff --git a/cmd/dlv/cmds/commands.go b/cmd/dlv/cmds/commands.go index 4fef8d511..b2057216e 100644 --- a/cmd/dlv/cmds/commands.go +++ b/cmd/dlv/cmds/commands.go @@ -15,18 +15,19 @@ import ( "strings" "syscall" - "github.com/go-delve/delve/pkg/config" - "github.com/go-delve/delve/pkg/gobuild" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/terminal" - "github.com/go-delve/delve/pkg/version" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/dap" - "github.com/go-delve/delve/service/debugger" - "github.com/go-delve/delve/service/rpc2" - "github.com/go-delve/delve/service/rpccommon" + "github.com/undoio/delve/pkg/config" + "github.com/undoio/delve/pkg/gobuild" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc/gdbserial" + "github.com/undoio/delve/pkg/terminal" + "github.com/undoio/delve/pkg/version" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/dap" + "github.com/undoio/delve/service/debugger" + "github.com/undoio/delve/service/rpc2" + "github.com/undoio/delve/service/rpccommon" "github.com/mattn/go-isatty" "github.com/spf13/cobra" ) @@ -344,23 +345,39 @@ Currently supports linux/amd64 and linux/arm64 core files, windows/amd64 minidum versionCommand.Flags().BoolVarP(&versionVerbose, "verbose", "v", false, "print verbose version info") rootCommand.AddCommand(versionCommand) - if path, _ := exec.LookPath("rr"); path != "" || docCall { + // Check for existence of replay tools + path, _ := exec.LookPath("rr") + rrAvailable := path != "" + undoAvailable := gdbserial.UndoIsAvailable() == nil + + if docCall { + // Display replay documentation regardless of availability + rrAvailable = true + undoAvailable = true + } + + if rrAvailable || undoAvailable { replayCommand := &cobra.Command{ - Use: "replay [trace directory]", - Short: "Replays a rr trace.", - Long: `Replays a rr trace. + Use: "replay [trace directory or LiveRecorder recording]", + Short: "Replays a rr trace or LiveRecorder recording.", + Long: `Replays a rr trace or LiveRecorder recording. + +The replay command will open a trace generated by Mozilla rr or a LiveRecorder recording. +Either Mozilla rr (https://github.com/mozilla/rr) or UDB (https://undo.io) must be installed. -The replay command will open a trace generated by mozilla rr. Mozilla rr must be installed: -https://github.com/mozilla/rr `, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { - return errors.New("you must provide a path to a binary") + return errors.New("you must provide a path to a recording") } return nil }, Run: func(cmd *cobra.Command, args []string) { - backend = "rr" + if isUndo, _ := gdbserial.UndoIsRecording(args[0]); isUndo { + backend = "undo" + } else { + backend = "rr" + } os.Exit(execute(0, []string{}, conf, args[0], debugger.ExecutingOther, args, buildFlags)) }, } diff --git a/cmd/dlv/dlv_test.go b/cmd/dlv/dlv_test.go index 6f337d8f5..34189fe80 100644 --- a/cmd/dlv/dlv_test.go +++ b/cmd/dlv/dlv_test.go @@ -21,14 +21,14 @@ import ( "testing" "time" - "github.com/go-delve/delve/pkg/goversion" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/pkg/terminal" - "github.com/go-delve/delve/service/dap" - "github.com/go-delve/delve/service/dap/daptest" - "github.com/go-delve/delve/service/debugger" - "github.com/go-delve/delve/service/rpc2" godap "github.com/google/go-dap" + "github.com/undoio/delve/pkg/goversion" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/terminal" + "github.com/undoio/delve/service/dap" + "github.com/undoio/delve/service/dap/daptest" + "github.com/undoio/delve/service/debugger" + "github.com/undoio/delve/service/rpc2" "golang.org/x/tools/go/packages" ) @@ -220,11 +220,11 @@ func getDlvBinInternal(t *testing.T, goflags ...string) (string, string) { dlvbin := filepath.Join(tmpdir, "dlv.exe") args := append([]string{"build", "-o", dlvbin}, goflags...) - args = append(args, "github.com/go-delve/delve/cmd/dlv") + args = append(args, "github.com/undoio/delve/cmd/dlv") out, err := exec.Command("go", args...).CombinedOutput() if err != nil { - t.Fatalf("go build -o %v github.com/go-delve/delve/cmd/dlv: %v\n%s", dlvbin, err, string(out)) + t.Fatalf("go build -o %v github.com/undoio/delve/cmd/dlv: %v\n%s", dlvbin, err, string(out)) } return dlvbin, tmpdir @@ -552,7 +552,7 @@ func TestTypecheckRPC(t *testing.T) { Mode: packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedName | packages.NeedCompiledGoFiles | packages.NeedTypes, Fset: fset, } - pkgs, err := packages.Load(cfg, "github.com/go-delve/delve/service/rpc2") + pkgs, err := packages.Load(cfg, "github.com/undoio/delve/service/rpc2") if err != nil { t.Fatal(err) } @@ -560,7 +560,7 @@ func TestTypecheckRPC(t *testing.T) { var serverMethods map[string]*types.Func var info *types.Info packages.Visit(pkgs, func(pkg *packages.Package) bool { - if pkg.PkgPath != "github.com/go-delve/delve/service/rpc2" { + if pkg.PkgPath != "github.com/undoio/delve/service/rpc2" { return true } t.Logf("package found: %v", pkg.PkgPath) @@ -1174,7 +1174,7 @@ func TestVersion(t *testing.T) { if err != nil { t.Fatalf("error executing `dlv version`: %v\n%s\n", err, got) } - want1 := []byte("mod\tgithub.com/go-delve/delve") + want1 := []byte("mod\tgithub.com/undoio/delve") want2 := []byte("dep\tgithub.com/google/go-dap") if !bytes.Contains(got, want1) || !bytes.Contains(got, want2) { t.Errorf("got %s\nwant %v and %v in the output", got, want1, want2) @@ -1191,7 +1191,7 @@ func TestStaticcheck(t *testing.T) { t.Skip("staticcheck not installed") } // default checks minus SA1019 which complains about deprecated identifiers, which change between versions of Go. - args := []string{"-tests=false", "-checks=all,-SA1019,-ST1000,-ST1003,-ST1016,-S1021,-ST1023", "github.com/go-delve/delve/..."} + args := []string{"-tests=false", "-checks=all,-SA1019,-ST1000,-ST1003,-ST1016,-S1021,-ST1023", "github.com/undoio/delve/..."} // * SA1019 is disabled because new deprecations get added on every version // of Go making the output of staticcheck inconsistent depending on the // version of Go used to run it. diff --git a/cmd/dlv/main.go b/cmd/dlv/main.go index 34df91db4..30df6d5c6 100644 --- a/cmd/dlv/main.go +++ b/cmd/dlv/main.go @@ -1,10 +1,12 @@ package main import ( + "fmt" "os" + "strings" - "github.com/go-delve/delve/cmd/dlv/cmds" - "github.com/go-delve/delve/pkg/version" + "github.com/undoio/delve/cmd/dlv/cmds" + "github.com/undoio/delve/pkg/version" "github.com/sirupsen/logrus" ) @@ -21,5 +23,50 @@ func main() { } else { logrus.WithFields(logrus.Fields{"layer": "dlv"}).Warnln("CGO_CFLAGS already set, Cgo code could be optimized.") } + + // XXX: There is currently no way to enforce the record/replay backend + // from within GoLand. Until this is resolved, introduce an environment + // variable to override the backend. + newArgs := make([]string, len(os.Args)) + dlvBackend := os.Getenv("DLV_RECORD_REPLAY_BACKEND") + if dlvBackend != "" { + if dlvBackend != "rr" && dlvBackend != "undo" { + fmt.Fprintf(os.Stderr, "Unknown dlv record/replay backend: %s\n", + dlvBackend) + os.Exit(1) + } + + replaceOptArg := false + for i, arg := range os.Args { + if replaceOptArg { + if strings.Compare(arg, "rr") == 0 || + strings.Compare(arg, "undo") == 0 { + newArgs[i] = dlvBackend + } else { + newArgs[i] = os.Args[i] + } + replaceOptArg = false + continue + } + + /* Handle --option XXX case */ + if strings.Compare(arg, "--backend") == 0 { + newArgs[i] = arg + replaceOptArg = true + continue + } + + /* Handle --option=XXX case */ + if strings.Compare(arg, "--backend=rr") == 0 || + strings.Compare(arg, "--backend=undo") == 0 { + newArgs[i] = "--backend=" + dlvBackend + continue + } + + newArgs[i] = os.Args[i] + } + os.Args = newArgs + } + cmds.New(false).Execute() } diff --git a/go.mod b/go.mod index 2280975f0..60cb58fdf 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/go-delve/delve +module github.com/undoio/delve go 1.16 diff --git a/pkg/dwarf/dwarfbuilder/info.go b/pkg/dwarf/dwarfbuilder/info.go index 95b0f05d3..1345e8663 100644 --- a/pkg/dwarf/dwarfbuilder/info.go +++ b/pkg/dwarf/dwarfbuilder/info.go @@ -5,8 +5,8 @@ import ( "debug/dwarf" "encoding/binary" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/util" ) // Form represents a DWARF form kind (see Figure 20, page 160 and following, diff --git a/pkg/dwarf/dwarfbuilder/loc.go b/pkg/dwarf/dwarfbuilder/loc.go index 357be789d..eba35ca48 100644 --- a/pkg/dwarf/dwarfbuilder/loc.go +++ b/pkg/dwarf/dwarfbuilder/loc.go @@ -3,8 +3,8 @@ package dwarfbuilder import ( "bytes" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/util" ) // LocEntry represents one entry of debug_loc. diff --git a/pkg/dwarf/frame/parser.go b/pkg/dwarf/frame/parser.go index 147ca34f1..697c80942 100644 --- a/pkg/dwarf/frame/parser.go +++ b/pkg/dwarf/frame/parser.go @@ -9,7 +9,7 @@ import ( "fmt" "io" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) type parsefunc func(*parseContext) parsefunc diff --git a/pkg/dwarf/frame/table.go b/pkg/dwarf/frame/table.go index a0f3f1e30..3f6f0dac3 100644 --- a/pkg/dwarf/frame/table.go +++ b/pkg/dwarf/frame/table.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "fmt" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) // DWRule wrapper of rule defined for register values. diff --git a/pkg/dwarf/godwarf/addr.go b/pkg/dwarf/godwarf/addr.go index f2c55cd46..45a548b3c 100644 --- a/pkg/dwarf/godwarf/addr.go +++ b/pkg/dwarf/godwarf/addr.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "errors" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) // DebugAddrSection represents the debug_addr section of DWARFv5. diff --git a/pkg/dwarf/godwarf/type.go b/pkg/dwarf/godwarf/type.go index af0e17f5d..767e861cd 100644 --- a/pkg/dwarf/godwarf/type.go +++ b/pkg/dwarf/godwarf/type.go @@ -16,8 +16,8 @@ import ( "reflect" "strconv" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/util" ) const ( diff --git a/pkg/dwarf/line/line_parser.go b/pkg/dwarf/line/line_parser.go index a9a0aed94..b9ee9fa21 100644 --- a/pkg/dwarf/line/line_parser.go +++ b/pkg/dwarf/line/line_parser.go @@ -6,7 +6,7 @@ import ( "path" "strings" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) // DebugLinePrologue prologue of .debug_line data. diff --git a/pkg/dwarf/line/line_parser_test.go b/pkg/dwarf/line/line_parser_test.go index 043a16bfe..a0d1c8ef8 100644 --- a/pkg/dwarf/line/line_parser_test.go +++ b/pkg/dwarf/line/line_parser_test.go @@ -17,8 +17,8 @@ import ( "time" "unsafe" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/goversion" ) var userTestFile string diff --git a/pkg/dwarf/line/parse_util.go b/pkg/dwarf/line/parse_util.go index 867d9b7b3..e98958e62 100644 --- a/pkg/dwarf/line/parse_util.go +++ b/pkg/dwarf/line/parse_util.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "errors" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) const ( diff --git a/pkg/dwarf/line/state_machine.go b/pkg/dwarf/line/state_machine.go index d2e3afa77..6b7762cd4 100644 --- a/pkg/dwarf/line/state_machine.go +++ b/pkg/dwarf/line/state_machine.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) type Location struct { diff --git a/pkg/dwarf/line/state_machine_test.go b/pkg/dwarf/line/state_machine_test.go index b72811512..1e387f469 100644 --- a/pkg/dwarf/line/state_machine_test.go +++ b/pkg/dwarf/line/state_machine_test.go @@ -13,7 +13,7 @@ import ( "runtime" "testing" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) func slurpGzip(path string) ([]byte, error) { diff --git a/pkg/dwarf/loclist/dwarf2_loclist.go b/pkg/dwarf/loclist/dwarf2_loclist.go index e9859cd7f..40df07957 100644 --- a/pkg/dwarf/loclist/dwarf2_loclist.go +++ b/pkg/dwarf/loclist/dwarf2_loclist.go @@ -3,7 +3,7 @@ package loclist import ( "encoding/binary" - "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/godwarf" ) // Reader represents a loclist reader. diff --git a/pkg/dwarf/loclist/dwarf5_loclist.go b/pkg/dwarf/loclist/dwarf5_loclist.go index b0e371d1d..8f9d96a6a 100644 --- a/pkg/dwarf/loclist/dwarf5_loclist.go +++ b/pkg/dwarf/loclist/dwarf5_loclist.go @@ -5,8 +5,8 @@ import ( "encoding/binary" "fmt" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/util" ) // Dwarf5Reader parses and presents DWARF loclist information for DWARF version 5 and later. diff --git a/pkg/dwarf/loclist/loclist5_test.go b/pkg/dwarf/loclist/loclist5_test.go index f041d2951..5b94ad620 100644 --- a/pkg/dwarf/loclist/loclist5_test.go +++ b/pkg/dwarf/loclist/loclist5_test.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "testing" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) func TestLoclist5(t *testing.T) { diff --git a/pkg/dwarf/op/op.go b/pkg/dwarf/op/op.go index ee37b162b..d2a29905b 100644 --- a/pkg/dwarf/op/op.go +++ b/pkg/dwarf/op/op.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/go-delve/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/dwarf/util" ) // Opcode represent a DWARF stack program instruction. diff --git a/pkg/dwarf/reader/reader.go b/pkg/dwarf/reader/reader.go index d0a869117..5e7fffb67 100644 --- a/pkg/dwarf/reader/reader.go +++ b/pkg/dwarf/reader/reader.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" ) type Reader struct { diff --git a/pkg/dwarf/reader/variables.go b/pkg/dwarf/reader/variables.go index d39f9d68a..c9e507d5f 100644 --- a/pkg/dwarf/reader/variables.go +++ b/pkg/dwarf/reader/variables.go @@ -3,7 +3,7 @@ package reader import ( "debug/dwarf" - "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/godwarf" ) type Variable struct { diff --git a/pkg/gobuild/gobuild.go b/pkg/gobuild/gobuild.go index c42318e89..b054ef108 100644 --- a/pkg/gobuild/gobuild.go +++ b/pkg/gobuild/gobuild.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/go-delve/delve/pkg/config" + "github.com/undoio/delve/pkg/config" ) // Remove the file at path and issue a warning to stderr if this fails. diff --git a/pkg/goversion/compat.go b/pkg/goversion/compat.go index 6427c722a..c065b601c 100644 --- a/pkg/goversion/compat.go +++ b/pkg/goversion/compat.go @@ -3,7 +3,7 @@ package goversion import ( "fmt" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/logflags" ) var ( diff --git a/pkg/locspec/locations.go b/pkg/locspec/locations.go index 0ca6c19f4..7cf341fd1 100644 --- a/pkg/locspec/locations.go +++ b/pkg/locspec/locations.go @@ -11,8 +11,8 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/service/api" ) const maxFindLocationCandidates = 5 diff --git a/pkg/locspec/locations_test.go b/pkg/locspec/locations_test.go index 5be02f5b1..24f8ef816 100644 --- a/pkg/locspec/locations_test.go +++ b/pkg/locspec/locations_test.go @@ -57,12 +57,12 @@ func TestFunctionLocationParsing(t *testing.T) { assertNormalLocationSpec(t, "Continue:10", NormalLocationSpec{"Continue", &FuncLocationSpec{BaseName: "Continue"}, 10}) // Function locations, package paths, no line offsets - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.(*Process).Continue", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.(*Process).Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, -1}) - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.Process.Continue", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.Process.Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, -1}) - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.Continue", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", BaseName: "Continue"}, -1}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.(*Process).Continue", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.(*Process).Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, -1}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.Process.Continue", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.Process.Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, -1}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.Continue", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", BaseName: "Continue"}, -1}) // Function locations, package paths, line offsets - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.(*Process).Continue:10", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.(*Process).Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, 10}) - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.Process.Continue:10", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.Process.Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, 10}) - assertNormalLocationSpec(t, "github.com/go-delve/delve/pkg/proc.Continue:10", NormalLocationSpec{"github.com/go-delve/delve/pkg/proc.Continue", &FuncLocationSpec{PackageName: "github.com/go-delve/delve/pkg/proc", BaseName: "Continue"}, 10}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.(*Process).Continue:10", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.(*Process).Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, 10}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.Process.Continue:10", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.Process.Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", ReceiverName: "Process", BaseName: "Continue"}, 10}) + assertNormalLocationSpec(t, "github.com/undoio/delve/pkg/proc.Continue:10", NormalLocationSpec{"github.com/undoio/delve/pkg/proc.Continue", &FuncLocationSpec{PackageName: "github.com/undoio/delve/pkg/proc", BaseName: "Continue"}, 10}) } diff --git a/pkg/proc/amd64_arch.go b/pkg/proc/amd64_arch.go index 050c776fe..8a073aab0 100644 --- a/pkg/proc/amd64_arch.go +++ b/pkg/proc/amd64_arch.go @@ -8,9 +8,9 @@ import ( "math" "strings" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" ) var amd64BreakInstruction = []byte{0xCC} diff --git a/pkg/proc/amd64_disasm.go b/pkg/proc/amd64_disasm.go index be855e19c..b52d984ba 100644 --- a/pkg/proc/amd64_disasm.go +++ b/pkg/proc/amd64_disasm.go @@ -5,8 +5,8 @@ package proc import ( - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" "golang.org/x/arch/x86/x86asm" ) diff --git a/pkg/proc/amd64util/xsave.go b/pkg/proc/amd64util/xsave.go index 16e621fd7..566164eac 100644 --- a/pkg/proc/amd64util/xsave.go +++ b/pkg/proc/amd64util/xsave.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "fmt" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) // AMD64Xstate represents amd64 XSAVE area. See Section 13.1 (and diff --git a/pkg/proc/arch.go b/pkg/proc/arch.go index 0f1392f7c..099e2c1d3 100644 --- a/pkg/proc/arch.go +++ b/pkg/proc/arch.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" ) // Arch represents a CPU architecture. diff --git a/pkg/proc/arm64_arch.go b/pkg/proc/arm64_arch.go index e56a0d6ea..feaa6222f 100644 --- a/pkg/proc/arm64_arch.go +++ b/pkg/proc/arm64_arch.go @@ -6,10 +6,10 @@ import ( "fmt" "strings" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/goversion" ) var arm64BreakInstruction = []byte{0x0, 0x0, 0x20, 0xd4} diff --git a/pkg/proc/arm64_disasm.go b/pkg/proc/arm64_disasm.go index bd918f4a9..5faeac218 100644 --- a/pkg/proc/arm64_disasm.go +++ b/pkg/proc/arm64_disasm.go @@ -5,8 +5,8 @@ package proc import ( - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" "golang.org/x/arch/arm64/arm64asm" ) diff --git a/pkg/proc/bininfo.go b/pkg/proc/bininfo.go index d1eff8dbe..b396bbd7c 100644 --- a/pkg/proc/bininfo.go +++ b/pkg/proc/bininfo.go @@ -21,16 +21,16 @@ import ( "sync" "time" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/line" - "github.com/go-delve/delve/pkg/dwarf/loclist" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/reader" - "github.com/go-delve/delve/pkg/dwarf/util" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc/debuginfod" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/line" + "github.com/undoio/delve/pkg/dwarf/loclist" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/dwarf/util" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc/debuginfod" "github.com/hashicorp/golang-lru/simplelru" "github.com/sirupsen/logrus" ) @@ -78,7 +78,7 @@ type BinaryInfo struct { // PackageMap maps package names to package paths, needed to lookup types inside DWARF info. // On Go1.12 this mapping is determined by using the last element of a package path, for example: - // github.com/go-delve/delve + // github.com/undoio/delve // will map to 'delve' because it ends in '/delve'. // Starting with Go1.13 debug_info will contain a special attribute // (godwarf.AttrGoPackageName) containing the canonical package name for diff --git a/pkg/proc/breakpoints.go b/pkg/proc/breakpoints.go index 50581cd94..0aed200e5 100644 --- a/pkg/proc/breakpoints.go +++ b/pkg/proc/breakpoints.go @@ -10,11 +10,11 @@ import ( "go/token" "reflect" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/reader" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/proc/internal/ebpf" ) const ( diff --git a/pkg/proc/core/core.go b/pkg/proc/core/core.go index 62a1fdebb..7800640c3 100644 --- a/pkg/proc/core/core.go +++ b/pkg/proc/core/core.go @@ -5,10 +5,10 @@ import ( "fmt" "io" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" ) // ErrNoThreads core file did not contain any threads. diff --git a/pkg/proc/core/core_test.go b/pkg/proc/core/core_test.go index 3a2bfd234..739ff1417 100644 --- a/pkg/proc/core/core_test.go +++ b/pkg/proc/core/core_test.go @@ -15,9 +15,9 @@ import ( "strings" "testing" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/test" ) var buildMode string diff --git a/pkg/proc/core/delve_core.go b/pkg/proc/core/delve_core.go index 9a8d146cf..4e6cd7541 100644 --- a/pkg/proc/core/delve_core.go +++ b/pkg/proc/core/delve_core.go @@ -7,9 +7,9 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc" ) func platformFromNotes(notes []*note) (goos, goarch string, err error) { diff --git a/pkg/proc/core/linux_core.go b/pkg/proc/core/linux_core.go index 25ebbbfa8..3d4c3105e 100644 --- a/pkg/proc/core/linux_core.go +++ b/pkg/proc/core/linux_core.go @@ -9,10 +9,10 @@ import ( "os" "strings" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/linutil" ) // Copied from golang.org/x/sys/unix.Timeval since it's not available on all diff --git a/pkg/proc/core/minidump/minidump.go b/pkg/proc/core/minidump/minidump.go index c9d5852ec..697e32772 100644 --- a/pkg/proc/core/minidump/minidump.go +++ b/pkg/proc/core/minidump/minidump.go @@ -24,7 +24,7 @@ import ( "unicode/utf16" "unsafe" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/proc/winutil" ) type minidumpBuf struct { diff --git a/pkg/proc/core/windows_amd64_minidump.go b/pkg/proc/core/windows_amd64_minidump.go index aeadd11aa..ef95ae532 100644 --- a/pkg/proc/core/windows_amd64_minidump.go +++ b/pkg/proc/core/windows_amd64_minidump.go @@ -1,10 +1,10 @@ package core import ( - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/core/minidump" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/core/minidump" + "github.com/undoio/delve/pkg/proc/winutil" ) func readAMD64Minidump(minidumpPath, exePath string) (*process, proc.Thread, error) { diff --git a/pkg/proc/disasm.go b/pkg/proc/disasm.go index 161f81b75..a4421a16b 100644 --- a/pkg/proc/disasm.go +++ b/pkg/proc/disasm.go @@ -3,7 +3,7 @@ package proc import ( "fmt" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" ) // AsmInstruction represents one assembly instruction. diff --git a/pkg/proc/dump.go b/pkg/proc/dump.go index ee693d619..6907d4c6a 100644 --- a/pkg/proc/dump.go +++ b/pkg/proc/dump.go @@ -9,8 +9,8 @@ import ( "runtime" "sync" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/version" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/version" ) var ( diff --git a/pkg/proc/dwarf_export_test.go b/pkg/proc/dwarf_export_test.go index 191fde56d..07277ee95 100644 --- a/pkg/proc/dwarf_export_test.go +++ b/pkg/proc/dwarf_export_test.go @@ -1,7 +1,7 @@ package proc import ( - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" "golang.org/x/arch/x86/x86asm" ) diff --git a/pkg/proc/dwarf_expr_test.go b/pkg/proc/dwarf_expr_test.go index 439bb578f..bc9c35339 100644 --- a/pkg/proc/dwarf_expr_test.go +++ b/pkg/proc/dwarf_expr_test.go @@ -13,11 +13,11 @@ import ( "testing" "unsafe" - "github.com/go-delve/delve/pkg/dwarf/dwarfbuilder" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/dwarf/dwarfbuilder" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/linutil" ) func ptrSizeByRuntimeArch() int { diff --git a/pkg/proc/eval.go b/pkg/proc/eval.go index 611093527..da2a73b68 100644 --- a/pkg/proc/eval.go +++ b/pkg/proc/eval.go @@ -16,11 +16,11 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/reader" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" ) var errOperationOnSpecialFloat = errors.New("operations on non-finite floats not implemented") diff --git a/pkg/proc/fbsdutil/regs.go b/pkg/proc/fbsdutil/regs.go index 0ca24b1ec..a50b8bb83 100644 --- a/pkg/proc/fbsdutil/regs.go +++ b/pkg/proc/fbsdutil/regs.go @@ -3,10 +3,10 @@ package fbsdutil import ( "fmt" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) // AMD64Registers implements the proc.Registers interface for the native/freebsd diff --git a/pkg/proc/fncall.go b/pkg/proc/fncall.go index 7fdb65f2c..2352e96cc 100644 --- a/pkg/proc/fncall.go +++ b/pkg/proc/fncall.go @@ -13,12 +13,12 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/reader" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" ) // This file implements the function call injection introduced in go1.11. diff --git a/pkg/proc/gdbserial/gdbserver.go b/pkg/proc/gdbserial/gdbserver.go index 38be0be8d..b58e5678e 100644 --- a/pkg/proc/gdbserial/gdbserver.go +++ b/pkg/proc/gdbserial/gdbserver.go @@ -23,6 +23,8 @@ // macOS. // * mozilla rr: a stub that records the full execution of a program // and can then play it back. +// * undo: a stub that records the full execution of a program +// and can then play it back. // // Implementations of the protocol vary wildly between stubs, while there is // a command to query the stub about supported features (qSupported) this @@ -62,7 +64,6 @@ package gdbserial import ( - "bytes" "debug/macho" "encoding/binary" "errors" @@ -77,14 +78,14 @@ import ( "sync" "time" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" - "github.com/go-delve/delve/pkg/proc/linutil" - "github.com/go-delve/delve/pkg/proc/macutil" isatty "github.com/mattn/go-isatty" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/proc/macutil" ) const ( @@ -159,14 +160,15 @@ type gdbProcess struct { threadStopInfo bool // true if the stub supports qThreadStopInfo tracedir string // if attached to rr the path to the trace directory - loadGInstrAddr uint64 // address of the g loading instruction, zero if we couldn't allocate it - breakpointKind int // breakpoint kind to pass to 'z' and 'Z' when creating software breakpoints process *os.Process waitChan chan *os.ProcessState onDetach func() // called after a successful detach + + localCheckpointLastId int + localCheckpoints map[int]proc.Checkpoint } var _ proc.RecordingManipulationInternal = &gdbProcess{} @@ -233,13 +235,15 @@ func newProcess(process *os.Process) *gdbProcess { goarch: runtime.GOARCH, goos: runtime.GOOS, }, - threads: make(map[int]*gdbThread), - bi: proc.NewBinaryInfo(runtime.GOOS, runtime.GOARCH), - regnames: new(gdbRegnames), - breakpoints: proc.NewBreakpointMap(), - gcmdok: true, - threadStopInfo: true, - process: process, + threads: make(map[int]*gdbThread), + bi: proc.NewBinaryInfo(runtime.GOOS, runtime.GOARCH), + regnames: new(gdbRegnames), + breakpoints: proc.NewBreakpointMap(), + gcmdok: true, + threadStopInfo: true, + process: process, + localCheckpointLastId: 1, + localCheckpoints: make(map[int]proc.Checkpoint), } switch p.bi.Arch.Name { @@ -350,22 +354,6 @@ func (p *gdbProcess) Connect(conn net.Conn, path string, pid int, debugInfoDirs return nil, err } - if p.bi.Arch.Name != "arm64" { - // None of the stubs we support returns the value of fs_base or gs_base - // along with the registers, therefore we have to resort to executing a MOV - // instruction on the inferior to find out where the G struct of a given - // thread is located. - // Here we try to allocate some memory on the inferior which we will use to - // store the MOV instruction. - // If the stub doesn't support memory allocation reloadRegisters will - // overwrite some existing memory to store the MOV. - if addr, err := p.conn.allocMemory(256); err == nil { - if _, err := p.conn.writeMemory(addr, p.loadGInstr()); err == nil { - p.loadGInstrAddr = addr - } - } - } - return tgt, nil } @@ -1056,6 +1044,16 @@ func (p *gdbProcess) Restart(cctx *proc.ContinueOnceContext, pos string) (proc.T return nil, proc.ErrNotRecorded } + // Is this a checkpoint on a server using local checkpoints? + if len(pos) > 1 && pos[:1] == "c" && p.conn.isUndoServer { + cpid, _ := strconv.Atoi(pos[1:]) + checkpoint, exists := p.localCheckpoints[cpid] + if !exists { + return nil, errors.New("Checkpoint not found") + } + pos = checkpoint.When + } + p.exited = false p.almostExited = false @@ -1072,9 +1070,11 @@ func (p *gdbProcess) Restart(cctx *proc.ContinueOnceContext, pos string) (proc.T // for some reason we have to send a vCont;c after a vRun to make rr behave // properly, because that's what gdb does. - _, err = p.conn.resume(cctx, nil, nil) - if err != nil { - return nil, err + if !p.conn.isUndoServer { + _, err = p.conn.resume(cctx, nil, nil) + if err != nil { + return nil, err + } } err = p.updateThreadList(&threadUpdater{p: p}) @@ -1091,17 +1091,27 @@ func (p *gdbProcess) Restart(cctx *proc.ContinueOnceContext, pos string) (proc.T return p.currentThread, p.setCurrentBreakpoints() } -// When executes the 'when' command for the Mozilla RR backend. +// When executes the 'when' command for the Mozilla RR/Undo backends. // This command will return rr's internal event number. func (p *gdbProcess) When() (string, error) { if p.tracedir == "" { return "", proc.ErrNotRecorded } - event, err := p.conn.qRRCmd("when") - if err != nil { - return "", err + result := "" + if p.conn.isUndoServer { + extent, err := p.conn.undoCmd("get_time") + if err != nil { + return "", err + } + result = extent + } else { + event, err := p.conn.qRRCmd("when") + if err != nil { + return "", err + } + result = strings.TrimSpace(event) } - return strings.TrimSpace(event), nil + return result, nil } const ( @@ -1113,6 +1123,19 @@ func (p *gdbProcess) Checkpoint(where string) (int, error) { if p.tracedir == "" { return -1, proc.ErrNotRecorded } + + // Handle locally managed checkpoints first + if p.conn.isUndoServer { + cpid := p.localCheckpointLastId + p.localCheckpointLastId++ + when, err := p.conn.undoCmd("get_time") + if err != nil { + return -1, err + } + p.localCheckpoints[cpid] = proc.Checkpoint{ID: cpid, When: when, Where: where} + return cpid, nil + } + resp, err := p.conn.qRRCmd("checkpoint", where) if err != nil { return -1, err @@ -1141,6 +1164,16 @@ func (p *gdbProcess) Checkpoints() ([]proc.Checkpoint, error) { if p.tracedir == "" { return nil, proc.ErrNotRecorded } + + // Handle locally managed checkpoints first + if p.conn.isUndoServer { + r := make([]proc.Checkpoint, 0, len(p.localCheckpoints)) + for _, cp := range p.localCheckpoints { + r = append(r, cp) + } + return r, nil + } + resp, err := p.conn.qRRCmd("info checkpoints") if err != nil { return nil, err @@ -1171,6 +1204,14 @@ func (p *gdbProcess) ClearCheckpoint(id int) error { if p.tracedir == "" { return proc.ErrNotRecorded } + + // Handle locally managed checkpoints first + if p.conn.isUndoServer { + delete(p.localCheckpoints, id) + // We don't care if it didn't exist + return nil + } + resp, err := p.conn.qRRCmd("delete checkpoint", strconv.Itoa(id)) if err != nil { return err @@ -1214,6 +1255,16 @@ func (p *gdbProcess) StartCallInjection() (func(), error) { return nil, ErrStartCallInjectionBackwards } + if p.conn.isUndoServer { + _, err := p.conn.undoCmd("set_debuggee_volatile", "1") + if err != nil { + return nil, err + } + return func() { + _, _ = p.conn.undoCmd("set_debuggee_volatile", "0") + }, nil + } + // Normally it's impossible to inject function calls in a recorded target // because the sequence of instructions that the target will execute is // predetermined. @@ -1546,27 +1597,6 @@ func (t *gdbThread) Blocked() bool { } } -// loadGInstr returns the correct MOV instruction for the current -// OS/architecture that can be executed to load the address of G from an -// inferior's thread. -func (p *gdbProcess) loadGInstr() []byte { - var op []byte - switch p.bi.GOOS { - case "windows", "darwin", "freebsd": - // mov rcx, QWORD PTR gs:{uint32(off)} - op = []byte{0x65, 0x48, 0x8b, 0x0c, 0x25} - case "linux": - // mov rcx,QWORD PTR fs:{uint32(off)} - op = []byte{0x64, 0x48, 0x8B, 0x0C, 0x25} - default: - panic("unsupported operating system attempting to find Goroutine on Thread") - } - buf := &bytes.Buffer{} - buf.Write(op) - binary.Write(buf, binary.LittleEndian, uint32(p.bi.GStructOffset())) - return buf.Bytes() -} - func (p *gdbProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { r := []proc.MemoryMapEntry{} addr := uint64(0) @@ -1647,15 +1677,6 @@ func (t *gdbThread) reloadRegisters() error { } } - if t.p.bi.GOOS == "linux" { - if reg, hasFsBase := t.regs.regs[t.p.regnames.FsBase]; hasFsBase { - t.regs.gaddr = 0 - t.regs.tls = binary.LittleEndian.Uint64(reg.value) - t.regs.hasgaddr = false - return nil - } - } - if t.p.bi.Arch.Name == "arm64" { // no need to play around with the GInstr on ARM64 because // the G addr is stored in a register @@ -1664,10 +1685,7 @@ func (t *gdbThread) reloadRegisters() error { t.regs.hasgaddr = true t.regs.tls = 0 } else { - if t.p.loadGInstrAddr > 0 { - return t.reloadGAlloc() - } - return t.reloadGAtPC() + return t.readG() } return nil @@ -1719,140 +1737,6 @@ func (t *gdbThread) readSomeRegisters(regNames ...string) error { return nil } -// reloadGAtPC overwrites the instruction that the thread is stopped at with -// the MOV instruction used to load current G, executes this single -// instruction and then puts everything back the way it was. -func (t *gdbThread) reloadGAtPC() error { - movinstr := t.p.loadGInstr() - - if t.Blocked() { - t.regs.tls = 0 - t.regs.gaddr = 0 - t.regs.hasgaddr = true - return nil - } - - cx := t.regs.CX() - pc := t.regs.PC() - - // We are partially replicating the code of GdbserverThread.stepInstruction - // here. - // The reason is that lldb-server has a bug with writing to memory and - // setting/clearing breakpoints to that same memory which we must work - // around by clearing and re-setting the breakpoint in a specific sequence - // with the memory writes. - // Additionally all breakpoints in [pc, pc+len(movinstr)] need to be removed - for addr, bp := range t.p.breakpoints.M { - if bp.WatchType != 0 { - continue - } - if addr >= pc && addr <= pc+uint64(len(movinstr)) { - err := t.p.conn.clearBreakpoint(addr, swBreakpoint, t.p.breakpointKind) - if err != nil { - return err - } - defer t.p.conn.setBreakpoint(addr, swBreakpoint, t.p.breakpointKind) - } - } - - savedcode := make([]byte, len(movinstr)) - _, err := t.p.ReadMemory(savedcode, pc) - if err != nil { - return err - } - - _, err = t.p.WriteMemory(pc, movinstr) - if err != nil { - return err - } - - defer func() { - _, err0 := t.p.WriteMemory(pc, savedcode) - if err == nil { - err = err0 - } - t.regs.setPC(pc) - t.regs.setCX(cx) - err1 := t.writeSomeRegisters(t.p.regnames.PC, t.p.regnames.CX) - if err == nil { - err = err1 - } - }() - - err = t.p.conn.step(t, nil, true) - if err != nil { - if err == errThreadBlocked { - t.regs.tls = 0 - t.regs.gaddr = 0 - t.regs.hasgaddr = true - return nil - } - return err - } - - if err := t.readSomeRegisters(t.p.regnames.PC, t.p.regnames.CX); err != nil { - return err - } - - t.regs.gaddr = t.regs.CX() - t.regs.hasgaddr = true - - return err -} - -// reloadGAlloc makes the specified thread execute one instruction stored at -// t.p.loadGInstrAddr then restores the value of the thread's registers. -// t.p.loadGInstrAddr must point to valid memory on the inferior, containing -// a MOV instruction that loads the address of the current G in the RCX -// register. -func (t *gdbThread) reloadGAlloc() error { - if t.Blocked() { - t.regs.tls = 0 - t.regs.gaddr = 0 - t.regs.hasgaddr = true - return nil - } - - cx := t.regs.CX() - pc := t.regs.PC() - - t.regs.setPC(t.p.loadGInstrAddr) - if err := t.writeSomeRegisters(t.p.regnames.PC); err != nil { - return err - } - - var err error - - defer func() { - t.regs.setPC(pc) - t.regs.setCX(cx) - err1 := t.writeSomeRegisters(t.p.regnames.PC, t.p.regnames.CX) - if err == nil { - err = err1 - } - }() - - err = t.p.conn.step(t, nil, true) - if err != nil { - if err == errThreadBlocked { - t.regs.tls = 0 - t.regs.gaddr = 0 - t.regs.hasgaddr = true - return nil - } - return err - } - - if err := t.readSomeRegisters(t.p.regnames.CX); err != nil { - return err - } - - t.regs.gaddr = t.regs.CX() - t.regs.hasgaddr = true - - return err -} - func (t *gdbThread) clearBreakpointState() { t.setbp = false t.CurrentBreakpoint.Clear() @@ -2110,3 +1994,47 @@ func machTargetExcToError(sig uint8) error { } return nil } + +// readG reads the G pointer on x86 by peeking the word before the TLS pointer. +func (t *gdbThread) readG() error { + var regnum int + + switch t.p.bi.GOOS { + case "windows": + case "darwin": + regnum = 59 // gs_base + case "linux": + regnum = 58 // fs_base + default: + panic("unsupported operating system attempting to find Goroutine on Thread") + } + + wordSize := t.p.bi.Arch.PtrSize() + tls := make([]byte, wordSize) + err := t.p.conn.readRegister(t.strID, regnum, tls) + if err != nil { + return err + } + + data := make([]byte, wordSize) + tlsaddr := binary.LittleEndian.Uint64(tls) + if tlsaddr == 0 { + t.regs.tls = 0 + t.regs.gaddr = 0 + t.regs.hasgaddr = true + return nil + } + + len, err := t.p.ReadMemory(data, tlsaddr-uint64(wordSize)) + if err != nil { + return err + } + if len != wordSize { + return fmt.Errorf("too little data: only %d bytes", len) + } + + t.regs.tls = tlsaddr + t.regs.gaddr = binary.LittleEndian.Uint64(data) + t.regs.hasgaddr = true + return nil +} diff --git a/pkg/proc/gdbserial/gdbserver_conn.go b/pkg/proc/gdbserial/gdbserver_conn.go index 664898576..10d39779a 100644 --- a/pkg/proc/gdbserial/gdbserver_conn.go +++ b/pkg/proc/gdbserial/gdbserver_conn.go @@ -13,11 +13,12 @@ import ( "os" "strconv" "strings" + "syscall" "time" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" "github.com/sirupsen/logrus" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" ) type gdbConn struct { @@ -49,6 +50,8 @@ type gdbConn struct { useXcmd bool // forces writeMemory to use the 'X' command + isUndoServer bool // true if using an Undo backend + log *logrus.Entry } @@ -805,6 +808,10 @@ func (conn *gdbConn) parseStopPacket(resp []byte, threadID string, tu *threadUpd } } + if syscall.Signal(sig) == syscall.SIGCHLD { + // FIXME get exit code + return false, stopPacket{}, proc.ErrProcessExited{Pid: conn.pid, Status: 0} + } return false, sp, nil case 'W', 'X': @@ -1133,10 +1140,33 @@ func (conn *gdbConn) threadStopInfo(threadID string) (sp stopPacket, err error) // restart executes a 'vRun' command. func (conn *gdbConn) restart(pos string) error { conn.outbuf.Reset() - fmt.Fprint(&conn.outbuf, "$vRun;") - if pos != "" { - fmt.Fprint(&conn.outbuf, ";") - writeAsciiBytes(&conn.outbuf, []byte(pos)) + + if conn.isUndoServer { + if pos != "" { + fmt.Fprintf(&conn.outbuf, "$vUDB;goto_time;%s", pos) + } else { + // Find the actual min BB count. + // TODO: is defaulting to zero if we can't get it correct? + minBbCount := "0" + + extent, err := conn.undoCmd("get_log_extent") + if err != nil { + return err + } + index := strings.Index(extent, ",") + if index > 0 { + minBbCount = extent[:index] + } + + conn.outbuf.Reset() + fmt.Fprintf(&conn.outbuf, "$vUDB;goto_time;%s;0", minBbCount) + } + } else { + fmt.Fprint(&conn.outbuf, "$vRun;") + if pos != "" { + fmt.Fprint(&conn.outbuf, ";") + writeAsciiBytes(&conn.outbuf, []byte(pos)) + } } _, err := conn.exec(conn.outbuf.Bytes(), "restart") return err @@ -1165,6 +1195,23 @@ func (conn *gdbConn) qRRCmd(args ...string) (string, error) { return string(data), nil } +// undoCmd executes a vUDB command +func (conn *gdbConn) undoCmd(args ...string) (string, error) { + if len(args) == 0 { + panic("must specify at least one argument for undoCmd") + } + conn.outbuf.Reset() + fmt.Fprint(&conn.outbuf, "$vUDB") + for _, arg := range args { + fmt.Fprint(&conn.outbuf, ";", arg) + } + resp, err := conn.exec(conn.outbuf.Bytes(), "undoCmd") + if err != nil { + return "", err + } + return string(resp), nil +} + type imageList struct { Images []imageDescription `json:"images"` } diff --git a/pkg/proc/gdbserial/rr.go b/pkg/proc/gdbserial/rr.go index e133b12bd..8e0f49390 100644 --- a/pkg/proc/gdbserial/rr.go +++ b/pkg/proc/gdbserial/rr.go @@ -12,8 +12,8 @@ import ( "strings" "syscall" - "github.com/go-delve/delve/pkg/config" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/config" + "github.com/undoio/delve/pkg/proc" ) // RecordAsync configures rr to record the execution of the specified diff --git a/pkg/proc/gdbserial/rr_test.go b/pkg/proc/gdbserial/rr_test.go index 7b4a53f6c..5a394e434 100644 --- a/pkg/proc/gdbserial/rr_test.go +++ b/pkg/proc/gdbserial/rr_test.go @@ -9,10 +9,10 @@ import ( "runtime" "testing" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/gdbserial" - protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/gdbserial" + protest "github.com/undoio/delve/pkg/proc/test" ) func TestMain(m *testing.M) { diff --git a/pkg/proc/gdbserial/undo.go b/pkg/proc/gdbserial/undo.go new file mode 100644 index 000000000..9f0ba9ebf --- /dev/null +++ b/pkg/proc/gdbserial/undo.go @@ -0,0 +1,159 @@ +package gdbserial + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "os/exec" + "runtime" + + "github.com/undoio/delve/pkg/proc" +) + +func serverFile() (string, error) { + switch runtime.GOARCH { + case "amd64": + return "udbserver_x64", nil + case "arm64": + return "udbserver_arm64", nil + case "386": + return "udbserver_x32", nil + default: + return "", &ErrBackendUnavailable{} + } +} + +func UndoIsAvailable() error { + server, err := serverFile() + if err != nil { + return err + } + + cmds := []string{server, "live-record"} + + for _, cmd := range cmds { + if _, err := exec.LookPath(cmd); err != nil { + return &ErrBackendUnavailable{} + } + } + return nil +} + +func UndoRecord(cmd []string, wd string, quiet bool, redirects [3]string) (recording string, err error) { + if err := UndoIsAvailable(); err != nil { + return "", err + } + + file, err := ioutil.TempFile("/tmp", "undo") + if err != nil { + return "", err + } + + recording = file.Name() + args := make([]string, 0) + args = append(args, "-o", recording) + args = append(args, cmd...) + lrcmd := exec.Command("live-record", args...) + var closefn func() + // FIXME: pass quiet to openRedirects(), not false. + lrcmd.Stdin, lrcmd.Stdout, lrcmd.Stderr, closefn, err = openRedirects(redirects, false) + if err != nil { + return "", err + } + if wd != "" { + lrcmd.Dir = wd + } + lrcmd.Env = os.Environ() + + // Ignore failures from Run - it could be the target failing + _ = lrcmd.Run() + closefn() + + if isRecording, err := UndoIsRecording(recording); !isRecording { + // Recording apparently failed to put anything in the file + os.Remove(recording) + if err == nil { + err = fmt.Errorf("Recording failed") + } + return "", err + } + + return recording, err +} + +func UndoReplay(recording string, path string, quiet bool, debugInfoDirs []string) (tgt *proc.Target, err error) { + if err := UndoIsAvailable(); err != nil { + return nil, err + } + + if isRecording, err := UndoIsRecording(recording); !isRecording || err != nil { + if err == nil { + err = fmt.Errorf("%s is not a LiveRecorder recording", recording) + } + return nil, err + } + + port := unusedPort() + + args := make([]string, 0) + args = append(args, "--load-file", recording, "--connect-port", port[1:]) + server, err := serverFile() + if err != nil { + return nil, err + } + servercmd := exec.Command(server, args...) + + if !quiet { + servercmd.Env = os.Environ() + // servercmd.Env = append(servercmd.Env, "UNDO_debug_filename=/dev/stderr") + // servercmd.Env = append(servercmd.Env, "UNDO_debug_level=1") + servercmd.Stdout = os.Stdout + servercmd.Stderr = os.Stderr + } + + if err := servercmd.Start(); err != nil { + return nil, err + } + + p := newProcess(servercmd.Process) + p.tracedir = recording + tgt, err = p.Dial(port, path, 0, debugInfoDirs, proc.StopAttached) + if err != nil { + servercmd.Process.Kill() + return nil, err + } + + // set to cause gdbserver.go to treat incoming signal numbers according to the GDB + // mapping, not the Linux mapping (see signal2native and native2signal in gdbserial.cpp) + p.conn.isUndoServer = true + return tgt, nil +} + +// RecordAndReplay acts like calling Record and then Replay. +func UndoRecordAndReplay(cmd []string, wd string, quiet bool, debugInfoDirs []string, redirects [3]string) (tgt *proc.Target, recording string, err error) { + recording, err = UndoRecord(cmd, wd, quiet, redirects) + if err != nil || recording == "" { + return nil, "", err + } + tgt, err = UndoReplay(recording, cmd[0], quiet, debugInfoDirs) + return tgt, recording, err +} + +func UndoIsRecording(recordingFile string) (result bool, err error) { + marker := []byte("HD\x10\x00\x00\x00UndoDB recording") + + f, err := os.Open(recordingFile) + if err != nil { + return false, err + } + defer f.Close() + + data := make([]byte, len(marker)) + c, err := f.Read(data) + if err != nil || c != len(marker) { + return false, err + } + + return bytes.Equal(marker, data), nil +} diff --git a/pkg/proc/gdbserial/undo_test.go b/pkg/proc/gdbserial/undo_test.go new file mode 100644 index 000000000..e7cdd3cc8 --- /dev/null +++ b/pkg/proc/gdbserial/undo_test.go @@ -0,0 +1,230 @@ +package gdbserial_test + +import ( + "fmt" + "os" + "testing" + + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/gdbserial" + protest "github.com/undoio/delve/pkg/proc/test" +) + +func withUndoRecording(name string, t testing.TB, fn func(p *proc.Target, fixture protest.Fixture)) { + fixture := protest.BuildFixture(name, 0) + protest.MustHaveRecordingAllowed(t) + if err := gdbserial.UndoIsAvailable(); err != nil { + t.Skip("test skipped, Undo tools not found") + } + t.Log("recording") + p, recording, err := gdbserial.UndoRecordAndReplay([]string{fixture.Path}, ".", true, []string{}, [3]string{}) + if err != nil { + t.Fatal("Launch():", err) + } + t.Logf("replaying %q", recording) + + defer func() { + p.Detach(true) + if recording != "" { + os.Remove(recording) + } + }() + + fn(p, fixture) +} + +func TestUndoRestartAfterExit(t *testing.T) { + protest.AllowRecording(t) + withUndoRecording("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue") + loc, err := p.CurrentThread().Location() + assertNoError(err, t, "CurrentThread().Location()") + err = p.Continue() + if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited { + t.Fatalf("program did not exit: %v", err) + } + + assertNoError(p.Restart(""), t, "Restart") + + assertNoError(p.Continue(), t, "Continue (after restart)") + loc2, err := p.CurrentThread().Location() + assertNoError(err, t, "CurrentThread().Location() (after restart)") + if loc2.Line != loc.Line { + t.Fatalf("stopped at %d (expected %d)", loc2.Line, loc.Line) + } + err = p.Continue() + if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited { + t.Fatalf("program did not exit (after exit): %v", err) + } + }) +} + +func TestUndoRestartDuringStop(t *testing.T) { + protest.AllowRecording(t) + withUndoRecording("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue") + loc, err := p.CurrentThread().Location() + assertNoError(err, t, "CurrentThread().Location()") + + assertNoError(p.Restart(""), t, "Restart") + + assertNoError(p.Continue(), t, "Continue (after restart)") + loc2, err := p.CurrentThread().Location() + assertNoError(err, t, "CurrentThread().Location() (after restart)") + if loc2.Line != loc.Line { + t.Fatalf("stopped at %d (expected %d)", loc2.Line, loc.Line) + } + err = p.Continue() + if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited { + t.Fatalf("program did not exit (after exit): %v", err) + } + }) +} + +func TestUndoReverseBreakpointCounts(t *testing.T) { + protest.AllowRecording(t) + withUndoRecording("bpcountstest", t, func(p *proc.Target, fixture protest.Fixture) { + endbp := setFileBreakpoint(p, t, fixture, 28) + assertNoError(p.Continue(), t, "Continue()") + loc, _ := p.CurrentThread().Location() + if loc.PC != endbp.Addr { + t.Fatalf("did not reach end of main.main function: %s:%d (%#x)", loc.File, loc.Line, loc.PC) + } + + p.ClearBreakpoint(endbp.Addr) + assertNoError(p.ChangeDirection(proc.Backward), t, "Switching to backward direction") + bp := setFileBreakpoint(p, t, fixture, 12) + startbp := setFileBreakpoint(p, t, fixture, 20) + + countLoop: + for { + assertNoError(p.Continue(), t, "Continue()") + loc, _ := p.CurrentThread().Location() + switch loc.PC { + case startbp.Addr: + break countLoop + case bp.Addr: + // ok + default: + t.Fatalf("unexpected stop location %s:%d %#x", loc.File, loc.Line, loc.PC) + } + } + + t.Logf("TotalHitCount: %d", bp.Logical.TotalHitCount) + if bp.Logical.TotalHitCount != 200 { + t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.Logical.TotalHitCount) + } + + if len(bp.Logical.HitCount) != 2 { + t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.Logical.HitCount)) + } + + for _, v := range bp.Logical.HitCount { + if v != 100 { + t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.Logical.HitCount) + } + } + }) +} + +func TestUndoCheckpoints(t *testing.T) { + protest.AllowRecording(t) + withUndoRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) { + // Continues until start of main.main, record output of 'when' + bp := setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue") + when0, loc0 := getPosition(p, t) + t.Logf("when0: %q (%#x) %x", when0, loc0.PC, p.CurrentThread().ThreadID()) + + // Create a checkpoint and check that the list of checkpoints reflects this + cpid, err := p.Checkpoint("checkpoint1") + if cpid != 1 { + t.Errorf("unexpected checkpoint id %d", cpid) + } + assertNoError(err, t, "Checkpoint") + checkpoints, err := p.Checkpoints() + assertNoError(err, t, "Checkpoints") + if len(checkpoints) != 1 { + t.Fatalf("wrong number of checkpoints %v (one expected)", checkpoints) + } + + // Move forward with next, check that the output of 'when' changes + assertNoError(p.Next(), t, "First Next") + assertNoError(p.Next(), t, "Second Next") + when1, loc1 := getPosition(p, t) + t.Logf("when1: %q (%#x) %x", when1, loc1.PC, p.CurrentThread().ThreadID()) + if loc0.PC == loc1.PC { + t.Fatalf("next did not move process %#x", loc0.PC) + } + if when0 == when1 { + t.Fatalf("output of when did not change after next: %q", when0) + } + + // Move back to checkpoint, check that the output of 'when' is the same as + // what it was when we set the breakpoint + p.Restart(fmt.Sprintf("c%d", cpid)) + g, _ := proc.FindGoroutine(p, 1) + p.SwitchGoroutine(g) + when2, loc2 := getPosition(p, t) + t.Logf("when2: %q (%#x) %x", when2, loc2.PC, p.CurrentThread().ThreadID()) + if loc2.PC != loc0.PC { + t.Fatalf("PC address mismatch %#x != %#x", loc0.PC, loc2.PC) + } + if when0 != when2 { + t.Fatalf("output of when mismatched %q != %q", when0, when2) + } + + // Move forward with next again, check that the output of 'when' matches + assertNoError(p.Next(), t, "First Next") + assertNoError(p.Next(), t, "Second Next") + when3, loc3 := getPosition(p, t) + t.Logf("when3: %q (%#x)", when3, loc3.PC) + if loc3.PC != loc1.PC { + t.Fatalf("PC address mismatch %#x != %#x", loc1.PC, loc3.PC) + } + if when3 != when1 { + t.Fatalf("when output mismatch %q != %q", when1, when3) + } + + // Delete breakpoint, move back to checkpoint then next twice and check + // output of 'when' again + err = p.ClearBreakpoint(bp.Addr) + assertNoError(err, t, "ClearBreakpoint") + p.Restart(fmt.Sprintf("c%d", cpid)) + g, _ = proc.FindGoroutine(p, 1) + p.SwitchGoroutine(g) + assertNoError(p.Next(), t, "First Next") + assertNoError(p.Next(), t, "Second Next") + when4, loc4 := getPosition(p, t) + t.Logf("when4: %q (%#x)", when4, loc4.PC) + if loc4.PC != loc1.PC { + t.Fatalf("PC address mismatch %#x != %#x", loc1.PC, loc4.PC) + } + if when4 != when1 { + t.Fatalf("when output mismatch %q != %q", when1, when4) + } + + // Delete checkpoint, check that the list of checkpoints is updated + assertNoError(p.ClearCheckpoint(cpid), t, "ClearCheckpoint") + checkpoints, err = p.Checkpoints() + assertNoError(err, t, "Checkpoints") + if len(checkpoints) != 0 { + t.Fatalf("wrong number of checkpoints %v (zero expected)", checkpoints) + } + }) +} + +func TestUndoIssue1376(t *testing.T) { + // Backward Continue should terminate when it encounters the start of the process. + protest.AllowRecording(t) + withUndoRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue (forward)") + err := p.ClearBreakpoint(bp.Addr) + assertNoError(err, t, "ClearBreakpoint") + assertNoError(p.ChangeDirection(proc.Backward), t, "Switching to backward direction") + assertNoError(p.Continue(), t, "Continue (backward)") + }) +} diff --git a/pkg/proc/i386_arch.go b/pkg/proc/i386_arch.go index 6e0d485cf..e5f306090 100644 --- a/pkg/proc/i386_arch.go +++ b/pkg/proc/i386_arch.go @@ -5,9 +5,9 @@ import ( "fmt" "strings" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" ) var i386BreakInstruction = []byte{0xCC} diff --git a/pkg/proc/i386_disasm.go b/pkg/proc/i386_disasm.go index b17622784..6bf1b0faf 100644 --- a/pkg/proc/i386_disasm.go +++ b/pkg/proc/i386_disasm.go @@ -5,8 +5,8 @@ package proc import ( - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" "golang.org/x/arch/x86/x86asm" ) diff --git a/pkg/proc/interface.go b/pkg/proc/interface.go index ef9e8a609..d59c37cb1 100644 --- a/pkg/proc/interface.go +++ b/pkg/proc/interface.go @@ -3,8 +3,8 @@ package proc import ( "sync" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc/internal/ebpf" ) // Process represents the target of the debugger. This diff --git a/pkg/proc/internal/ebpf/context.go b/pkg/proc/internal/ebpf/context.go index 695b8105c..dbfb63084 100644 --- a/pkg/proc/internal/ebpf/context.go +++ b/pkg/proc/internal/ebpf/context.go @@ -3,8 +3,8 @@ package ebpf import ( "reflect" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" ) type UProbeArgMap struct { diff --git a/pkg/proc/internal/ebpf/dummy.go b/pkg/proc/internal/ebpf/dummy.go index 9ef6e6d3f..77436b1b9 100644 --- a/pkg/proc/internal/ebpf/dummy.go +++ b/pkg/proc/internal/ebpf/dummy.go @@ -9,6 +9,6 @@ package ebpf import ( - _ "github.com/go-delve/delve/pkg/proc/internal/ebpf/bpf" - _ "github.com/go-delve/delve/pkg/proc/internal/ebpf/bpf/include" + _ "github.com/undoio/delve/pkg/proc/internal/ebpf/bpf" + _ "github.com/undoio/delve/pkg/proc/internal/ebpf/bpf/include" ) diff --git a/pkg/proc/internal/ebpf/helpers.go b/pkg/proc/internal/ebpf/helpers.go index faf371799..7f2f8c8e4 100644 --- a/pkg/proc/internal/ebpf/helpers.go +++ b/pkg/proc/internal/ebpf/helpers.go @@ -14,8 +14,8 @@ import ( "sync" "unsafe" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" diff --git a/pkg/proc/linutil/dynamic.go b/pkg/proc/linutil/dynamic.go index 2e02a7741..476f08f30 100644 --- a/pkg/proc/linutil/dynamic.go +++ b/pkg/proc/linutil/dynamic.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) const ( diff --git a/pkg/proc/linutil/regs_amd64_arch.go b/pkg/proc/linutil/regs_amd64_arch.go index a15e56512..746d0c5d7 100644 --- a/pkg/proc/linutil/regs_amd64_arch.go +++ b/pkg/proc/linutil/regs_amd64_arch.go @@ -3,10 +3,10 @@ package linutil import ( "fmt" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) // AMD64Registers implements the proc.Registers interface for the native/linux diff --git a/pkg/proc/linutil/regs_arm64_arch.go b/pkg/proc/linutil/regs_arm64_arch.go index 5e9243a9c..426f73348 100644 --- a/pkg/proc/linutil/regs_arm64_arch.go +++ b/pkg/proc/linutil/regs_arm64_arch.go @@ -3,9 +3,9 @@ package linutil import ( "fmt" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" ) // ARM64Registers is a wrapper for sys.PtraceRegs. diff --git a/pkg/proc/linutil/regs_i386_arch.go b/pkg/proc/linutil/regs_i386_arch.go index dac34b3dc..26c2fc98d 100644 --- a/pkg/proc/linutil/regs_i386_arch.go +++ b/pkg/proc/linutil/regs_i386_arch.go @@ -1,8 +1,8 @@ package linutil import ( - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) // I386Registers implements the proc.Registers interface for the native/linux diff --git a/pkg/proc/mem.go b/pkg/proc/mem.go index cb2a35f67..beba65441 100644 --- a/pkg/proc/mem.go +++ b/pkg/proc/mem.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" ) const cacheEnabled = true diff --git a/pkg/proc/native/dump_linux.go b/pkg/proc/native/dump_linux.go index bbf57acbf..17725e3eb 100644 --- a/pkg/proc/native/dump_linux.go +++ b/pkg/proc/native/dump_linux.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { diff --git a/pkg/proc/native/dump_linux_amd64.go b/pkg/proc/native/dump_linux_amd64.go index 0e36b3b48..7ba392e2b 100644 --- a/pkg/proc/native/dump_linux_amd64.go +++ b/pkg/proc/native/dump_linux_amd64.go @@ -8,8 +8,8 @@ import ( "io/ioutil" "path/filepath" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc/linutil" "golang.org/x/sys/unix" ) diff --git a/pkg/proc/native/dump_linux_other.go b/pkg/proc/native/dump_linux_other.go index d74491af8..67175137e 100644 --- a/pkg/proc/native/dump_linux_other.go +++ b/pkg/proc/native/dump_linux_other.go @@ -4,7 +4,7 @@ package native import ( - "github.com/go-delve/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/elfwriter" ) func (p *nativeProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { diff --git a/pkg/proc/native/dump_other.go b/pkg/proc/native/dump_other.go index 0c4ce14a0..3fa32bc96 100644 --- a/pkg/proc/native/dump_other.go +++ b/pkg/proc/native/dump_other.go @@ -4,8 +4,8 @@ package native import ( - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc" ) func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { diff --git a/pkg/proc/native/dump_windows_amd64.go b/pkg/proc/native/dump_windows_amd64.go index 084de02fe..5ddaa52df 100644 --- a/pkg/proc/native/dump_windows_amd64.go +++ b/pkg/proc/native/dump_windows_amd64.go @@ -5,8 +5,8 @@ import ( "fmt" "unsafe" - "github.com/go-delve/delve/pkg/elfwriter" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/elfwriter" + "github.com/undoio/delve/pkg/proc" ) func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { diff --git a/pkg/proc/native/hwbreak_amd64.go b/pkg/proc/native/hwbreak_amd64.go index e15652a36..9abe5ec6e 100644 --- a/pkg/proc/native/hwbreak_amd64.go +++ b/pkg/proc/native/hwbreak_amd64.go @@ -1,8 +1,8 @@ package native import ( - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) func (t *nativeThread) writeHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { diff --git a/pkg/proc/native/hwbreak_other.go b/pkg/proc/native/hwbreak_other.go index 548f3336d..6c10da49e 100644 --- a/pkg/proc/native/hwbreak_other.go +++ b/pkg/proc/native/hwbreak_other.go @@ -6,7 +6,7 @@ package native import ( "errors" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) func (t *nativeThread) findHardwareBreakpoint() (*proc.Breakpoint, error) { diff --git a/pkg/proc/native/nonative_darwin.go b/pkg/proc/native/nonative_darwin.go index 3aae7e468..312e52320 100644 --- a/pkg/proc/native/nonative_darwin.go +++ b/pkg/proc/native/nonative_darwin.go @@ -7,10 +7,10 @@ import ( "errors" "sync" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/internal/ebpf" ) var ErrNativeBackendDisabled = errors.New("native backend disabled during compilation") diff --git a/pkg/proc/native/proc.go b/pkg/proc/native/proc.go index 500fc46a1..a724af84c 100644 --- a/pkg/proc/native/proc.go +++ b/pkg/proc/native/proc.go @@ -4,7 +4,7 @@ import ( "os" "runtime" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) // Process represents all of the information the debugger diff --git a/pkg/proc/native/proc_darwin.go b/pkg/proc/native/proc_darwin.go index fa0f75589..8fd233aa1 100644 --- a/pkg/proc/native/proc_darwin.go +++ b/pkg/proc/native/proc_darwin.go @@ -18,9 +18,9 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" - "github.com/go-delve/delve/pkg/proc/macutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/proc/macutil" ) // osProcessDetails holds Darwin specific information. diff --git a/pkg/proc/native/proc_freebsd.go b/pkg/proc/native/proc_freebsd.go index 78de961e7..2a3c7943a 100644 --- a/pkg/proc/native/proc_freebsd.go +++ b/pkg/proc/native/proc_freebsd.go @@ -14,8 +14,8 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" isatty "github.com/mattn/go-isatty" ) diff --git a/pkg/proc/native/proc_linux.go b/pkg/proc/native/proc_linux.go index a7f0dd632..7d722fb08 100644 --- a/pkg/proc/native/proc_linux.go +++ b/pkg/proc/native/proc_linux.go @@ -19,9 +19,9 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/proc/linutil" isatty "github.com/mattn/go-isatty" ) diff --git a/pkg/proc/native/proc_windows.go b/pkg/proc/native/proc_windows.go index 38863fef1..55cc878db 100644 --- a/pkg/proc/native/proc_windows.go +++ b/pkg/proc/native/proc_windows.go @@ -9,9 +9,9 @@ import ( sys "golang.org/x/sys/windows" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/proc/winutil" ) // osProcessDetails holds Windows specific information. diff --git a/pkg/proc/native/ptrace_freebsd_amd64.go b/pkg/proc/native/ptrace_freebsd_amd64.go index 462d9aebd..435de3849 100644 --- a/pkg/proc/native/ptrace_freebsd_amd64.go +++ b/pkg/proc/native/ptrace_freebsd_amd64.go @@ -10,7 +10,7 @@ import ( "fmt" "unsafe" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/amd64util" ) var ( diff --git a/pkg/proc/native/ptrace_linux_386.go b/pkg/proc/native/ptrace_linux_386.go index 1c1039b5c..215d8befe 100644 --- a/pkg/proc/native/ptrace_linux_386.go +++ b/pkg/proc/native/ptrace_linux_386.go @@ -9,7 +9,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/amd64util" ) // ptraceGetRegset returns floating point registers of the specified thread diff --git a/pkg/proc/native/ptrace_linux_amd64.go b/pkg/proc/native/ptrace_linux_amd64.go index b60c09c00..933d2ba86 100644 --- a/pkg/proc/native/ptrace_linux_amd64.go +++ b/pkg/proc/native/ptrace_linux_amd64.go @@ -6,7 +6,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/amd64util" ) // ptraceGetRegset returns floating point registers of the specified thread diff --git a/pkg/proc/native/register_linux_386.go b/pkg/proc/native/register_linux_386.go index 906b34fc7..b359b9a78 100644 --- a/pkg/proc/native/register_linux_386.go +++ b/pkg/proc/native/register_linux_386.go @@ -5,11 +5,11 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/linutil" ) // setPC sets EIP to the value specified by 'pc'. diff --git a/pkg/proc/native/registers_darwin_amd64.go b/pkg/proc/native/registers_darwin_amd64.go index c8246d7f7..e026675c5 100644 --- a/pkg/proc/native/registers_darwin_amd64.go +++ b/pkg/proc/native/registers_darwin_amd64.go @@ -11,9 +11,9 @@ import ( "golang.org/x/arch/x86/x86asm" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" ) // Regs represents CPU registers on an AMD64 processor. diff --git a/pkg/proc/native/registers_freebsd_amd64.go b/pkg/proc/native/registers_freebsd_amd64.go index 2e7449b5b..c82bc5cd3 100644 --- a/pkg/proc/native/registers_freebsd_amd64.go +++ b/pkg/proc/native/registers_freebsd_amd64.go @@ -5,10 +5,10 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/fbsdutil" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/fbsdutil" ) // SetPC sets RIP to the value specified by 'pc'. diff --git a/pkg/proc/native/registers_linux_amd64.go b/pkg/proc/native/registers_linux_amd64.go index 676d89649..ab2aeb1b0 100644 --- a/pkg/proc/native/registers_linux_amd64.go +++ b/pkg/proc/native/registers_linux_amd64.go @@ -7,10 +7,10 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/linutil" ) // SetPC sets RIP to the value specified by 'pc'. diff --git a/pkg/proc/native/registers_linux_arm64.go b/pkg/proc/native/registers_linux_arm64.go index 0b797cc03..80127a042 100644 --- a/pkg/proc/native/registers_linux_arm64.go +++ b/pkg/proc/native/registers_linux_arm64.go @@ -7,9 +7,9 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/linutil" ) const ( diff --git a/pkg/proc/native/registers_windows_amd64.go b/pkg/proc/native/registers_windows_amd64.go index 1ab12c3ab..78e5c2181 100644 --- a/pkg/proc/native/registers_windows_amd64.go +++ b/pkg/proc/native/registers_windows_amd64.go @@ -4,10 +4,10 @@ import ( "fmt" "unsafe" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/winutil" ) // SetPC sets the RIP register to the value specified by `pc`. diff --git a/pkg/proc/native/syscall_windows.go b/pkg/proc/native/syscall_windows.go index 0cb622b33..65bc54996 100644 --- a/pkg/proc/native/syscall_windows.go +++ b/pkg/proc/native/syscall_windows.go @@ -5,7 +5,7 @@ package native import ( "syscall" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/proc/winutil" ) type _NTSTATUS int32 diff --git a/pkg/proc/native/threads.go b/pkg/proc/native/threads.go index 3088545e2..b70b007dd 100644 --- a/pkg/proc/native/threads.go +++ b/pkg/proc/native/threads.go @@ -3,7 +3,7 @@ package native import ( "fmt" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) // Thread represents a single thread in the traced process diff --git a/pkg/proc/native/threads_darwin.go b/pkg/proc/native/threads_darwin.go index d4df60395..381af3b78 100644 --- a/pkg/proc/native/threads_darwin.go +++ b/pkg/proc/native/threads_darwin.go @@ -13,8 +13,8 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) // waitStatus is a synonym for the platform-specific WaitStatus diff --git a/pkg/proc/native/threads_freebsd.go b/pkg/proc/native/threads_freebsd.go index f9163014b..3d47f9e29 100644 --- a/pkg/proc/native/threads_freebsd.go +++ b/pkg/proc/native/threads_freebsd.go @@ -5,12 +5,12 @@ import "C" import ( "fmt" - "github.com/go-delve/delve/pkg/proc/fbsdutil" + "github.com/undoio/delve/pkg/proc/fbsdutil" sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" ) type waitStatus sys.WaitStatus diff --git a/pkg/proc/native/threads_linux.go b/pkg/proc/native/threads_linux.go index 1b9f707e9..ff4f85674 100644 --- a/pkg/proc/native/threads_linux.go +++ b/pkg/proc/native/threads_linux.go @@ -5,7 +5,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) type waitStatus sys.WaitStatus diff --git a/pkg/proc/native/threads_linux_386.go b/pkg/proc/native/threads_linux_386.go index 338a166ba..c457201b3 100644 --- a/pkg/proc/native/threads_linux_386.go +++ b/pkg/proc/native/threads_linux_386.go @@ -2,7 +2,7 @@ package native import ( "fmt" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { diff --git a/pkg/proc/native/threads_linux_amd64.go b/pkg/proc/native/threads_linux_amd64.go index 95147e47b..c1b3eb886 100644 --- a/pkg/proc/native/threads_linux_amd64.go +++ b/pkg/proc/native/threads_linux_amd64.go @@ -6,9 +6,9 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/linutil" ) func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { diff --git a/pkg/proc/native/threads_linux_arm64.go b/pkg/proc/native/threads_linux_arm64.go index 151cbe0c9..325372ab4 100644 --- a/pkg/proc/native/threads_linux_arm64.go +++ b/pkg/proc/native/threads_linux_arm64.go @@ -9,8 +9,8 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/linutil" ) func (thread *nativeThread) fpRegisters() ([]proc.Register, []byte, error) { diff --git a/pkg/proc/native/threads_windows.go b/pkg/proc/native/threads_windows.go index 7d731e69e..8b0c56aca 100644 --- a/pkg/proc/native/threads_windows.go +++ b/pkg/proc/native/threads_windows.go @@ -6,9 +6,9 @@ import ( sys "golang.org/x/sys/windows" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/amd64util" - "github.com/go-delve/delve/pkg/proc/winutil" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/amd64util" + "github.com/undoio/delve/pkg/proc/winutil" ) const enableHardwareBreakpoints = false // see https://github.com/go-delve/delve/issues/2768 diff --git a/pkg/proc/proc_general_test.go b/pkg/proc/proc_general_test.go index 870efc8c0..80e3c406c 100644 --- a/pkg/proc/proc_general_test.go +++ b/pkg/proc/proc_general_test.go @@ -7,7 +7,7 @@ import ( "testing" "unsafe" - protest "github.com/go-delve/delve/pkg/proc/test" + protest "github.com/undoio/delve/pkg/proc/test" ) func ptrSizeByRuntimeArch() int { @@ -137,20 +137,20 @@ func TestGenericFunctionParser(t *testing.T) { // Normal parsing var testCases = []struct{ name, pkg, rcv, base string }{ - {"github.com/go-delve/delve.afunc", "github.com/go-delve/delve", "", "afunc"}, - {"github.com/go-delve/delve..afunc", "github.com/go-delve/delve", "", "afunc"}, // malformed - {"github.com/go-delve/delve.afunc[some/[thing].el se]", "github.com/go-delve/delve", "", "afunc[some/[thing].el se]"}, - {"github.com/go-delve/delve.Receiver.afunc", "github.com/go-delve/delve", "Receiver", "afunc"}, - {"github.com/go-delve/delve.(*Receiver).afunc", "github.com/go-delve/delve", "(*Receiver)", "afunc"}, - {"github.com/go-delve/delve.Receiver.afunc[some/[thing].el se]", "github.com/go-delve/delve", "Receiver", "afunc[some/[thing].el se]"}, // malformed - {"github.com/go-delve/delve.(*Receiver).afunc[some/[thing].el se]", "github.com/go-delve/delve", "(*Receiver)", "afunc[some/[thing].el se]"}, // malformed - {"github.com/go-delve/delve.Receiver[some/[thing].el se].afunc", "github.com/go-delve/delve", "Receiver[some/[thing].el se]", "afunc"}, - {"github.com/go-delve/delve.(*Receiver[some/[thing].el se]).afunc", "github.com/go-delve/delve", "(*Receiver[some/[thing].el se])", "afunc"}, - - {"github.com/go-delve/delve.afunc[.some/[thing].el se]", "github.com/go-delve/delve", "", "afunc[.some/[thing].el se]"}, - {"github.com/go-delve/delve.Receiver.afunc[.some/[thing].el se]", "github.com/go-delve/delve", "Receiver", "afunc[.some/[thing].el se]"}, // malformed - {"github.com/go-delve/delve.Receiver[.some/[thing].el se].afunc", "github.com/go-delve/delve", "Receiver[.some/[thing].el se]", "afunc"}, - {"github.com/go-delve/delve.(*Receiver[.some/[thing].el se]).afunc", "github.com/go-delve/delve", "(*Receiver[.some/[thing].el se])", "afunc"}, + {"github.com/undoio/delve.afunc", "github.com/undoio/delve", "", "afunc"}, + {"github.com/undoio/delve..afunc", "github.com/undoio/delve", "", "afunc"}, // malformed + {"github.com/undoio/delve.afunc[some/[thing].el se]", "github.com/undoio/delve", "", "afunc[some/[thing].el se]"}, + {"github.com/undoio/delve.Receiver.afunc", "github.com/undoio/delve", "Receiver", "afunc"}, + {"github.com/undoio/delve.(*Receiver).afunc", "github.com/undoio/delve", "(*Receiver)", "afunc"}, + {"github.com/undoio/delve.Receiver.afunc[some/[thing].el se]", "github.com/undoio/delve", "Receiver", "afunc[some/[thing].el se]"}, // malformed + {"github.com/undoio/delve.(*Receiver).afunc[some/[thing].el se]", "github.com/undoio/delve", "(*Receiver)", "afunc[some/[thing].el se]"}, // malformed + {"github.com/undoio/delve.Receiver[some/[thing].el se].afunc", "github.com/undoio/delve", "Receiver[some/[thing].el se]", "afunc"}, + {"github.com/undoio/delve.(*Receiver[some/[thing].el se]).afunc", "github.com/undoio/delve", "(*Receiver[some/[thing].el se])", "afunc"}, + + {"github.com/undoio/delve.afunc[.some/[thing].el se]", "github.com/undoio/delve", "", "afunc[.some/[thing].el se]"}, + {"github.com/undoio/delve.Receiver.afunc[.some/[thing].el se]", "github.com/undoio/delve", "Receiver", "afunc[.some/[thing].el se]"}, // malformed + {"github.com/undoio/delve.Receiver[.some/[thing].el se].afunc", "github.com/undoio/delve", "Receiver[.some/[thing].el se]", "afunc"}, + {"github.com/undoio/delve.(*Receiver[.some/[thing].el se]).afunc", "github.com/undoio/delve", "(*Receiver[.some/[thing].el se])", "afunc"}, } for _, tc := range testCases { diff --git a/pkg/proc/proc_linux_test.go b/pkg/proc/proc_linux_test.go index d10e17ff4..97edf0731 100644 --- a/pkg/proc/proc_linux_test.go +++ b/pkg/proc/proc_linux_test.go @@ -6,8 +6,8 @@ import ( "path/filepath" "testing" - "github.com/go-delve/delve/pkg/proc/native" - protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/proc/native" + protest "github.com/undoio/delve/pkg/proc/test" ) func TestLoadingExternalDebugInfo(t *testing.T) { diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index e0fa81c3f..e58882801 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -23,17 +23,17 @@ import ( "testing" "time" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/regnum" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/core" - "github.com/go-delve/delve/pkg/proc/gdbserial" - "github.com/go-delve/delve/pkg/proc/native" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/regnum" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/core" + "github.com/undoio/delve/pkg/proc/gdbserial" + "github.com/undoio/delve/pkg/proc/native" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service/api" ) var normalLoadConfig = proc.LoadConfig{true, 1, 64, 64, -1, 0} @@ -99,6 +99,7 @@ func withTestProcessArgs(name string, t testing.TB, wd string, args []string, bu var p *proc.Target var err error var tracedir string + var recording string switch testBackend { case "native": @@ -110,6 +111,11 @@ func withTestProcessArgs(name string, t testing.TB, wd string, args []string, bu t.Log("recording") p, tracedir, err = gdbserial.RecordAndReplay(append([]string{fixture.Path}, args...), wd, true, []string{}, [3]string{}) t.Logf("replaying %q", tracedir) + case "undo": + protest.MustHaveRecordingAllowed(t) + t.Log("recording") + p, recording, err = gdbserial.UndoRecordAndReplay(append([]string{fixture.Path}, args...), wd, true, []string{}, [3]string{}) + t.Logf("replaying") default: t.Fatal("unknown backend") } @@ -119,6 +125,9 @@ func withTestProcessArgs(name string, t testing.TB, wd string, args []string, bu defer func() { p.Detach(true) + if recording != "" { + os.Remove(recording) + } }() fn(p, fixture) @@ -358,6 +367,7 @@ func TestBreakpointWithNonExistantFunction(t *testing.T) { } func TestClearBreakpointBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestProcess("testprog", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.sleepytime") @@ -1061,6 +1071,7 @@ func testGSupportFunc(name string, t *testing.T, p *proc.Target, fixture protest } func TestGetG(t *testing.T) { + protest.AllowRecording(t) withTestProcess("testprog", t, func(p *proc.Target, fixture protest.Fixture) { testGSupportFunc("nocgo", t, p, fixture) }) @@ -1151,7 +1162,7 @@ func evalVariableOrError(p *proc.Target, symbol string) (*proc.Variable, error) var scope *proc.EvalScope var err error - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { @@ -1359,6 +1370,7 @@ func TestThreadFrameEvaluation(t *testing.T) { if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { t.SkipNow() } + protest.AllowRecording(t) withTestProcess("testdeadlock", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") @@ -1765,6 +1777,7 @@ func TestCondBreakpointError(t *testing.T) { } func TestHitCondBreakpointEQ(t *testing.T) { + protest.AllowRecording(t) withTestProcess("break", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 7) bp.Logical.HitCond = &struct { @@ -2005,6 +2018,7 @@ func TestIssue149(t *testing.T) { return } // setting breakpoint on break statement + protest.AllowRecording(t) withTestProcess("break", t, func(p *proc.Target, fixture protest.Fixture) { findFileLocation(p, t, fixture.Source, 8) }) @@ -2046,6 +2060,7 @@ func TestCmdLineArgs(t *testing.T) { } } + protest.AllowRecording(t) // make sure multiple arguments (including one with spaces) are passed to the binary correctly withTestProcessArgs("testargs", t, ".", []string{"test"}, 0, expectSuccess) withTestProcessArgs("testargs", t, ".", []string{"-test"}, 0, expectPanic) @@ -2245,6 +2260,7 @@ func TestIssue573(t *testing.T) { } func TestTestvariables2Prologue(t *testing.T) { + protest.AllowRecording(t) withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) { addrEntry := p.BinInfo().LookupFunc["main.main"].Entry addrPrologue := findFunctionLocation(p, t, "main.main") @@ -2745,7 +2761,7 @@ func TestIssue594(t *testing.T) { assertNoError(p.Continue(), t, "Continue()") var f string var ln int - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { frame, err := findFirstNonRuntimeFrame(p) assertNoError(err, t, "findFirstNonRuntimeFrame") f, ln = frame.Current.File, frame.Current.Line @@ -2902,7 +2918,7 @@ func TestAttachDetach(t *testing.T) { return } } - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { return } var buildFlags protest.BuildFlags @@ -3064,6 +3080,7 @@ func TestIssue877(t *testing.T) { } const envval = "/usr/local/lib" os.Setenv("DYLD_LIBRARY_PATH", envval) + protest.AllowRecording(t) withTestProcess("issue877", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") v := evalVariable(p, t, "dyldenv") @@ -3114,7 +3131,7 @@ func TestIssue871(t *testing.T) { var scope *proc.EvalScope var err error - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { @@ -3201,7 +3218,7 @@ func TestAttachStripped(t *testing.T) { return } } - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { return } if runtime.GOOS == "darwin" { @@ -3261,6 +3278,7 @@ func TestAttachStripped(t *testing.T) { func TestIssue844(t *testing.T) { // Conditional breakpoints should not prevent next from working if their // condition isn't met. + protest.AllowRecording(t) withTestProcess("nextcond", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 9) condbp := setFileBreakpoint(p, t, fixture.Source, 10) @@ -3485,6 +3503,7 @@ func TestCgoSources(t *testing.T) { protest.MustHaveCgo(t) + protest.AllowRecording(t) withTestProcess("cgostacktest/", t, func(p *proc.Target, fixture protest.Fixture) { sources := p.BinInfo().Sources for _, needle := range []string{"main.go", "hello.c"} { @@ -3504,6 +3523,7 @@ func TestCgoSources(t *testing.T) { func TestSystemstackStacktrace(t *testing.T) { // check that we can follow a stack switch initiated by runtime.systemstack() + protest.AllowRecording(t) withTestProcess("panic", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "runtime.startpanic_m") assertNoError(p.Continue(), t, "first continue") @@ -3559,6 +3579,7 @@ func TestIssue1034(t *testing.T) { // The external linker on macOS produces an abbrev for DW_TAG_subprogram // without the "has children" flag, we should support this. + protest.AllowRecording(t) withTestProcess("cgostacktest/", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.main") assertNoError(p.Continue(), t, "Continue()") @@ -3579,6 +3600,7 @@ func TestIssue1008(t *testing.T) { // The external linker on macOS inserts "end of sequence" extended opcodes // in debug_line. which we should support correctly. + protest.AllowRecording(t) withTestProcess("cgostacktest/", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.main") assertNoError(p.Continue(), t, "Continue()") @@ -3624,6 +3646,7 @@ func TestDeclLine(t *testing.T) { t.Skip("go 1.9 and prior versions do not emit DW_AT_decl_line") } + protest.AllowRecording(t) withTestProcess("decllinetest", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 8) setFileBreakpoint(p, t, fixture.Source, 9) @@ -3657,6 +3680,7 @@ func TestDeclLine(t *testing.T) { } func TestIssue1137(t *testing.T) { + protest.AllowRecording(t) withTestProcess("dotpackagesiface", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") v := evalVariable(p, t, "iface") @@ -3760,6 +3784,7 @@ func TestDisassembleGlobalVars(t *testing.T) { if runtime.GOARCH == "386" && runtime.GOOS == "linux" && buildMode == "pie" { t.Skip("On 386 linux when pie, symLookup can't look up global variables") } + protest.AllowRecording(t) withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { mainfn := p.BinInfo().LookupFunc["main.main"] regs, _ := p.CurrentThread().Registers() @@ -3802,6 +3827,7 @@ func TestAllPCsForFileLines(t *testing.T) { // Versions of go before 1.10 do not have DWARF information for inlined calls t.Skip("inlining not supported") } + protest.AllowRecording(t) withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining, func(p *proc.Target, fixture protest.Fixture) { l2pcs := p.BinInfo().AllPCsForFileLines(fixture.Source, []int{7, 20}) if len(l2pcs) != 2 { @@ -3866,6 +3892,7 @@ func TestInlinedStacktraceAndVariables(t *testing.T) { }, } + protest.AllowRecording(t) withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining, func(p *proc.Target, fixture protest.Fixture) { pcs, err := proc.FindFileLocation(p, fixture.Source, 7) assertNoError(err, t, "LineToPC") @@ -3995,6 +4022,7 @@ func TestInlineFunctionList(t *testing.T) { // Versions of go before 1.10 do not have DWARF information for inlined calls t.Skip("inlining not supported") } + protest.AllowRecording(t) withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining|protest.EnableOptimization, func(p *proc.Target, fixture protest.Fixture) { var found bool for _, fn := range p.BinInfo().Functions { @@ -4015,6 +4043,7 @@ func TestInlineBreakpoint(t *testing.T) { // Versions of go before 1.10 do not have DWARF information for inlined calls t.Skip("inlining not supported") } + protest.AllowRecording(t) withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining|protest.EnableOptimization, func(p *proc.Target, fixture protest.Fixture) { pcs, err := proc.FindFileLocation(p, fixture.Source, 17) if err != nil { @@ -4135,6 +4164,7 @@ func TestStepOutReturn(t *testing.T) { if ver.Major >= 0 && !ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 10, Rev: -1}) { t.Skip("return variables aren't marked on 1.9 or earlier") } + protest.AllowRecording(t) withTestProcess("stepoutret", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.stepout") assertNoError(p.Continue(), t, "Continue") @@ -4183,6 +4213,7 @@ func TestStepOutReturn(t *testing.T) { } func TestOptimizationCheck(t *testing.T) { + protest.AllowRecording(t) withTestProcess("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) { fn := p.BinInfo().LookupFunc["main.main"] if fn.Optimized() { @@ -4203,6 +4234,7 @@ func TestOptimizationCheck(t *testing.T) { func TestIssue1264(t *testing.T) { // It should be possible to set a breakpoint condition that consists only // of evaluating a single boolean variable. + protest.AllowRecording(t) withTestProcess("issue1264", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 8) bp.UserBreaklet().Cond = &ast.Ident{Name: "equalsTwo"} @@ -4275,6 +4307,7 @@ func TestNextUnknownInstr(t *testing.T) { if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 10) { t.Skip("versions of Go before 1.10 can't assemble the instruction VPUNPCKLWD") } + protest.AllowRecording(t) withTestProcess("nodisasm/", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.asmFunc") assertNoError(p.Continue(), t, "Continue()") @@ -4378,6 +4411,7 @@ func TestIssue1432(t *testing.T) { } func TestGoroutinesInfoLimit(t *testing.T) { + protest.AllowRecording(t) withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 37) assertNoError(p.Continue(), t, "Continue()") @@ -4407,6 +4441,7 @@ func TestGoroutinesInfoLimit(t *testing.T) { } func TestIssue1469(t *testing.T) { + protest.AllowRecording(t) withTestProcess("issue1469", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 13) assertNoError(p.Continue(), t, "Continue()") @@ -4444,6 +4479,7 @@ func TestDeadlockBreakpoint(t *testing.T) { if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { deadlockBp = proc.UnrecoveredPanic } + protest.AllowRecording(t) withTestProcess("testdeadlock", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") @@ -4517,6 +4553,7 @@ func TestAncestors(t *testing.T) { savedGodebug := os.Getenv("GODEBUG") os.Setenv("GODEBUG", "tracebackancestors=100") defer os.Setenv("GODEBUG", savedGodebug) + protest.AllowRecording(t) withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.testgoroutine") assertNoError(p.Continue(), t, "Continue()") @@ -4634,6 +4671,7 @@ func TestPluginStepping(t *testing.T) { func TestIssue1601(t *testing.T) { protest.MustHaveCgo(t) //Tests that recursive types involving C qualifiers and typedefs are parsed correctly + protest.AllowRecording(t) withTestProcess("issue1601", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue") evalVariable(p, t, "C.globalq") @@ -4643,6 +4681,7 @@ func TestIssue1601(t *testing.T) { func TestIssue1615(t *testing.T) { // A breakpoint condition that tests for string equality with a constant string shouldn't fail with 'string too long for comparison' error + protest.AllowRecording(t) withTestProcess("issue1615", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 19) bp.UserBreaklet().Cond = &ast.BinaryExpr{ @@ -4663,6 +4702,7 @@ func TestCgoStacktrace2(t *testing.T) { protest.MustHaveCgo(t) // If a panic happens during cgo execution the stacktrace should show the C // function that caused the problem. + protest.AllowRecording(t) withTestProcess("cgosigsegvstack", t, func(p *proc.Target, fixture protest.Fixture) { p.Continue() frames, err := proc.ThreadStacktrace(p.CurrentThread(), 100) @@ -4677,6 +4717,7 @@ func TestCgoStacktrace2(t *testing.T) { func TestIssue1656(t *testing.T) { skipUnlessOn(t, "amd64 only", "amd64") + protest.AllowRecording(t) withTestProcess("issue1656/", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.s")), 5) assertNoError(p.Continue(), t, "Continue()") @@ -4695,6 +4736,7 @@ func TestBreakpointConfusionOnResume(t *testing.T) { // stopped at. // This test checks for a regression introduced when fixing Issue #1656 skipUnlessOn(t, "amd64 only", "amd64") + protest.AllowRecording(t) withTestProcess("nopbreakpoint/", t, func(p *proc.Target, fixture protest.Fixture) { maindots := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.s")) maindotgo := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.go")) @@ -4712,6 +4754,7 @@ func TestBreakpointConfusionOnResume(t *testing.T) { } func TestIssue1736(t *testing.T) { + protest.AllowRecording(t) withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") ch1BufVar := evalVariable(p, t, "*(ch1.buf)") @@ -4727,12 +4770,14 @@ func TestIssue1736(t *testing.T) { func TestIssue1817(t *testing.T) { // Setting a breakpoint on a line that doesn't have any PC addresses marked // is_stmt should work. + protest.AllowRecording(t) withTestProcess("issue1817", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 16) }) } func TestListPackagesBuildInfo(t *testing.T) { + protest.AllowRecording(t) withTestProcess("pkgrenames", t, func(p *proc.Target, fixture protest.Fixture) { pkgs := p.BinInfo().ListPackagesBuildInfo(true) t.Logf("returned %d", len(pkgs)) @@ -4811,8 +4856,8 @@ func BenchmarkConditionalBreakpoints(b *testing.B) { } func TestBackwardNextGeneral(t *testing.T) { - if testBackend != "rr" { - t.Skip("Reverse stepping test needs rr") + if testBackend != "rr" && testBackend != "undo" { + t.Skip("Reverse stepping test needs rr or undo") } testseq2(t, "testnextprog", "main.helloworld", []seqTest{ {contContinue, 13}, @@ -4842,8 +4887,8 @@ func TestBackwardNextGeneral(t *testing.T) { } func TestBackwardStepOutGeneral(t *testing.T) { - if testBackend != "rr" { - t.Skip("Reverse stepping test needs rr") + if testBackend != "rr" && testBackend != "undo" { + t.Skip("Reverse stepping test needs rr or undo") } testseq2(t, "testnextprog", "main.helloworld", []seqTest{ {contContinue, 13}, @@ -4854,8 +4899,8 @@ func TestBackwardStepOutGeneral(t *testing.T) { } func TestBackwardStepGeneral(t *testing.T) { - if testBackend != "rr" { - t.Skip("Reverse stepping test needs rr") + if testBackend != "rr" && testBackend != "undo" { + t.Skip("Reverse stepping test needs rr or undo") } testseq2(t, "testnextprog", "main.helloworld", []seqTest{ {contContinue, 13}, @@ -4893,8 +4938,8 @@ func TestBackwardStepGeneral(t *testing.T) { } func TestBackwardNextDeferPanic(t *testing.T) { - if testBackend != "rr" { - t.Skip("Reverse stepping test needs rr") + if testBackend != "rr" && testBackend != "undo" { + t.Skip("Reverse stepping test needs rr or undo") } if goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { testseq2(t, "defercall", "", []seqTest{ @@ -5092,6 +5137,7 @@ func TestStepOutPreservesGoroutine(t *testing.T) { // Checks that StepOut preserves the currently selected goroutine. skipOn(t, "broken", "freebsd") rand.Seed(time.Now().Unix()) + protest.AllowRecording(t) withTestProcess("issue2113", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") @@ -5429,6 +5475,7 @@ func TestVariablesWithExternalLinking(t *testing.T) { // See: // https://github.com/golang/go/issues/25841 // https://github.com/go-delve/delve/issues/2346 + protest.AllowRecording(t) withTestProcessArgs("testvariables2", t, ".", []string{}, protest.BuildModeExternalLinker, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") str1Var := evalVariable(p, t, "str1") @@ -5593,6 +5640,7 @@ func TestManualStopWhileStopped(t *testing.T) { func TestDwrapStartLocation(t *testing.T) { // Tests that the start location of a goroutine is unwrapped in Go 1.17 and later. + protest.AllowRecording(t) withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.stacktraceme") assertNoError(p.Continue(), t, "Continue()") @@ -5752,6 +5800,7 @@ func TestWatchpointStackBackwardsOutOfScope(t *testing.T) { func TestSetOnFunctions(t *testing.T) { // The set command between function variables should fail with an error // Issue #2691 + protest.AllowRecording(t) withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.main") assertNoError(p.Continue(), t, "Continue()") diff --git a/pkg/proc/proc_unix_test.go b/pkg/proc/proc_unix_test.go index 74a39cc6c..ec752343c 100644 --- a/pkg/proc/proc_unix_test.go +++ b/pkg/proc/proc_unix_test.go @@ -14,9 +14,9 @@ import ( "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/native" - protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/native" + protest "github.com/undoio/delve/pkg/proc/test" ) type errIssue419 struct { @@ -29,7 +29,7 @@ func (npe errIssue419) Error() string { } func TestIssue419(t *testing.T) { - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { return } diff --git a/pkg/proc/registers.go b/pkg/proc/registers.go index 185d0615c..246ab251b 100644 --- a/pkg/proc/registers.go +++ b/pkg/proc/registers.go @@ -6,7 +6,7 @@ import ( "math" "strings" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" ) // Registers is an interface for a generic register type. The diff --git a/pkg/proc/scope_test.go b/pkg/proc/scope_test.go index a477281e6..0ce1c27a9 100644 --- a/pkg/proc/scope_test.go +++ b/pkg/proc/scope_test.go @@ -13,9 +13,9 @@ import ( "strings" "testing" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/proc" - protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/proc" + protest "github.com/undoio/delve/pkg/proc/test" ) func TestScopeWithEscapedVariable(t *testing.T) { @@ -23,6 +23,7 @@ func TestScopeWithEscapedVariable(t *testing.T) { return } + protest.AllowRecording(t) withTestProcess("scopeescapevareval", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue") @@ -72,6 +73,7 @@ func TestScope(t *testing.T) { scopeChecks := getScopeChecks(scopetestPath, t) + protest.AllowRecording(t) withTestProcess("scopetest", t, func(p *proc.Target, fixture protest.Fixture) { for i := range scopeChecks { setFileBreakpoint(p, t, fixture.Source, scopeChecks[i].line) diff --git a/pkg/proc/stack.go b/pkg/proc/stack.go index 9d847f498..31cb05217 100644 --- a/pkg/proc/stack.go +++ b/pkg/proc/stack.go @@ -7,9 +7,9 @@ import ( "go/constant" "reflect" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/dwarf/frame" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/reader" ) // This code is partly adapted from runtime.gentraceback in diff --git a/pkg/proc/stackwatch.go b/pkg/proc/stackwatch.go index 3ab572747..b56469a7a 100644 --- a/pkg/proc/stackwatch.go +++ b/pkg/proc/stackwatch.go @@ -3,8 +3,8 @@ package proc import ( "errors" - "github.com/go-delve/delve/pkg/astutil" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/astutil" + "github.com/undoio/delve/pkg/logflags" ) // This file implements most of the details needed to support stack diff --git a/pkg/proc/target.go b/pkg/proc/target.go index 6837d0ba5..e99768010 100644 --- a/pkg/proc/target.go +++ b/pkg/proc/target.go @@ -8,9 +8,9 @@ import ( "sort" "strings" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/proc/internal/ebpf" ) var ( diff --git a/pkg/proc/target_exec.go b/pkg/proc/target_exec.go index e5bd28aa2..bc46fb5d1 100644 --- a/pkg/proc/target_exec.go +++ b/pkg/proc/target_exec.go @@ -10,8 +10,8 @@ import ( "path/filepath" "strings" - "github.com/go-delve/delve/pkg/astutil" - "github.com/go-delve/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/astutil" + "github.com/undoio/delve/pkg/dwarf/reader" ) const maxSkipAutogeneratedWrappers = 5 // maximum recursion depth for skipAutogeneratedWrappers diff --git a/pkg/proc/test/support.go b/pkg/proc/test/support.go index 71cf4452d..6abdeb903 100644 --- a/pkg/proc/test/support.go +++ b/pkg/proc/test/support.go @@ -14,7 +14,7 @@ import ( "sync" "testing" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/goversion" ) // EnableRace allows to configure whether the race detector is enabled on target process. diff --git a/pkg/proc/threads.go b/pkg/proc/threads.go index f191598ed..baceefcd8 100644 --- a/pkg/proc/threads.go +++ b/pkg/proc/threads.go @@ -3,7 +3,7 @@ package proc import ( "errors" - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" ) // Thread represents a thread. diff --git a/pkg/proc/types.go b/pkg/proc/types.go index 1cc1d6be2..323755788 100644 --- a/pkg/proc/types.go +++ b/pkg/proc/types.go @@ -9,9 +9,9 @@ import ( "reflect" "strings" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/reader" - "github.com/go-delve/delve/pkg/goversion" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/reader" + "github.com/undoio/delve/pkg/goversion" ) // The kind field in runtime._type is a reflect.Kind value plus diff --git a/pkg/proc/variable_test.go b/pkg/proc/variable_test.go index 848cb51a4..f7d27dfdc 100644 --- a/pkg/proc/variable_test.go +++ b/pkg/proc/variable_test.go @@ -4,8 +4,8 @@ import ( "path/filepath" "testing" - "github.com/go-delve/delve/pkg/proc" - protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/proc" + protest "github.com/undoio/delve/pkg/proc/test" ) func TestGoroutineCreationLocation(t *testing.T) { diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index d72c5e03f..07b1f24f4 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -16,10 +16,10 @@ import ( "time" "unsafe" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" ) const ( diff --git a/pkg/proc/variables_test.go b/pkg/proc/variables_test.go index 145364e81..8bedab5ff 100644 --- a/pkg/proc/variables_test.go +++ b/pkg/proc/variables_test.go @@ -10,11 +10,11 @@ import ( "strings" "testing" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/service/api" - protest "github.com/go-delve/delve/pkg/proc/test" + protest "github.com/undoio/delve/pkg/proc/test" ) var pnormalLoadConfig = proc.LoadConfig{ @@ -68,7 +68,7 @@ func assertVariable(t *testing.T, variable *proc.Variable, expected varTest) { } func evalScope(p *proc.Target) (*proc.EvalScope, error) { - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { return proc.GoroutineScope(p, p.CurrentThread()) } frame, err := findFirstNonRuntimeFrame(p) @@ -157,7 +157,7 @@ func TestVariableEvaluation2(t *testing.T) { } } - if tc.alternate != "" && testBackend != "rr" { + if tc.alternate != "" && testBackend != "rr" && testBackend != "undo" { assertNoError(setVariable(p, tc.name, tc.alternate), t, "SetVariable()") variable, err = evalVariableWithCfg(p, tc.name, pnormalLoadConfig) assertNoError(err, t, "EvalVariable()") @@ -406,7 +406,7 @@ func TestLocalVariables(t *testing.T) { var scope *proc.EvalScope var err error - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { @@ -990,18 +990,18 @@ func TestPackageRenames(t *testing.T) { {"req", true, `interface {}(*net/http.Request) *{Method: "amethod", …`, "", "interface {}", nil}, // Package name that doesn't match import path - {"iface3", true, `interface {}(*github.com/go-delve/delve/_fixtures/internal/dir0/renamedpackage.SomeType) *{A: true}`, "", "interface {}", nil}, + {"iface3", true, `interface {}(*github.com/undoio/delve/_fixtures/internal/dir0/renamedpackage.SomeType) *{A: true}`, "", "interface {}", nil}, // Interfaces to anonymous types - {"dir0someType", true, "interface {}(*github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType) *{X: 3}", "", "interface {}", nil}, - {"dir1someType", true, "interface {}(github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType) {X: 1, Y: 2}", "", "interface {}", nil}, - {"amap3", true, "interface {}(map[github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType]github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType) [{X: 4}: {X: 5, Y: 6}, ]", "", "interface {}", nil}, - {"anarray", true, `interface {}([2]github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 1},{X: 2}]`, "", "interface {}", nil}, - {"achan", true, `interface {}(chan github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType) chan github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType 0/0`, "", "interface {}", nil}, - {"aslice", true, `interface {}([]github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 3},{X: 4}]`, "", "interface {}", nil}, - {"afunc", true, `interface {}(func(github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType, github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType)) main.main.func1`, "", "interface {}", nil}, - {"astruct", true, `interface {}(*struct { A github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType; B github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType }) *{A: github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, B: github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType {X: 3}}`, "", "interface {}", nil}, - {"iface2iface", true, `interface {}(*interface { AMethod(int) int; AnotherMethod(int) int }) **github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType {X: 4}`, "", "interface {}", nil}, + {"dir0someType", true, "interface {}(*github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType) *{X: 3}", "", "interface {}", nil}, + {"dir1someType", true, "interface {}(github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType) {X: 1, Y: 2}", "", "interface {}", nil}, + {"amap3", true, "interface {}(map[github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType]github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType) [{X: 4}: {X: 5, Y: 6}, ]", "", "interface {}", nil}, + {"anarray", true, `interface {}([2]github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 1},{X: 2}]`, "", "interface {}", nil}, + {"achan", true, `interface {}(chan github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType) chan github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType 0/0`, "", "interface {}", nil}, + {"aslice", true, `interface {}([]github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 3},{X: 4}]`, "", "interface {}", nil}, + {"afunc", true, `interface {}(func(github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType, github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType)) main.main.func1`, "", "interface {}", nil}, + {"astruct", true, `interface {}(*struct { A github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType; B github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType }) *{A: github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, B: github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType {X: 3}}`, "", "interface {}", nil}, + {"iface2iface", true, `interface {}(*interface { AMethod(int) int; AnotherMethod(int) int }) **github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType {X: 4}`, "", "interface {}", nil}, {`"dir0/pkg".A`, false, "0", "", "int", nil}, {`"dir1/pkg".A`, false, "1", "", "int", nil}, @@ -1019,11 +1019,11 @@ func TestPackageRenames(t *testing.T) { testcases1_8 := []varTest{ // before 1.9 embedded struct fields have fieldname == type - {"astruct2", true, `interface {}(*struct { github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType: github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, + {"astruct2", true, `interface {}(*struct { github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType: github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, } testcases1_9 := []varTest{ - {"astruct2", true, `interface {}(*struct { github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{SomeType: github.com/go-delve/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, + {"astruct2", true, `interface {}(*struct { github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{SomeType: github.com/undoio/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, } testcases1_13 := []varTest{ @@ -1076,6 +1076,7 @@ func TestConstants(t *testing.T) { // Not supported on 1.9 or earlier t.Skip("constants added in go 1.10") } + protest.AllowRecording(t) withTestProcess("consts", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue") for _, testcase := range testcases { @@ -1087,6 +1088,7 @@ func TestConstants(t *testing.T) { } func TestIssue1075(t *testing.T) { + protest.AllowRecording(t) withTestProcess("clientdo", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "net/http.(*Client).Do") assertNoError(p.Continue(), t, "Continue()") @@ -1151,7 +1153,7 @@ func TestCallFunction(t *testing.T) { {`fn2glob(10, 20)`, []string{":int:30"}, nil}, // indirect call of func value / set to top-level func {`fn2clos(11)`, []string{`:string:"1 + 6 + 11 = 18"`}, nil}, // indirect call of func value / set to func literal - {`fn2clos(12)`, []string{`:string:"2 + 6 + 12 = 20"`}, nil}, + // UNDO [#30]: {`fn2clos(12)`, []string{`:string:"2 + 6 + 12 = 20"`}, nil}, {`fn2valmeth(13)`, []string{`:string:"13 + 6 = 19"`}, nil}, // indirect call of func value / set to value method {`fn2ptrmeth(14)`, []string{`:string:"14 - 6 = 8"`}, nil}, // indirect call of func value / set to pointer method @@ -1172,7 +1174,7 @@ func TestCallFunction(t *testing.T) { {`onetwothree(intcallpanic("not a number"))`, nil, errors.New("error evaluating \"intcallpanic(\\\"not a number\\\")\" as argument n in function main.onetwothree: can not convert \"not a number\" constant to int")}, // Variable setting tests - {`pa2 = getAStructPtr(8); pa2`, []string{`pa2:*main.astruct:*main.astruct {X: 8}`}, nil}, + // UNDO [#30]: {`pa2 = getAStructPtr(8); pa2`, []string{`pa2:*main.astruct:*main.astruct {X: 8}`}, nil}, // Escape tests @@ -1186,7 +1188,7 @@ func TestCallFunction(t *testing.T) { var testcases112 = []testCaseCallFunction{ // string allocation requires trusted argument order, which we don't have in Go 1.11 {`stringsJoin(stringslice, ",")`, []string{`:string:"one,two,three"`}, nil}, - {`str = "a new string"; str`, []string{`str:string:"a new string"`}, nil}, + // UNDO [#30]: {`str = "a new string"; str`, []string{`str:string:"a new string"`}, nil}, // support calling optimized functions {`strings.Join(nil, "")`, []string{`:string:""`}, nil}, @@ -1360,6 +1362,7 @@ func testCallFunction(t *testing.T, p *proc.Target, tc testCaseCallFunction) { func TestIssue1531(t *testing.T) { // Go 1.12 introduced a change to the map representation where empty cells can be marked with 1 instead of just 0. + protest.AllowRecording(t) withTestProcess("issue1531", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") @@ -1427,9 +1430,9 @@ func TestPluginVariables(t *testing.T) { setFileBreakpoint(p, t, fixture.Source, 41) assertNoError(p.Continue(), t, "Continue 1") - bp := setFunctionBreakpoint(p, t, "github.com/go-delve/delve/_fixtures/plugin2.TypesTest") + bp := setFunctionBreakpoint(p, t, "github.com/undoio/delve/_fixtures/plugin2.TypesTest") t.Logf("bp.Addr = %#x", bp.Addr) - setFunctionBreakpoint(p, t, "github.com/go-delve/delve/_fixtures/plugin2.aIsNotNil") + setFunctionBreakpoint(p, t, "github.com/undoio/delve/_fixtures/plugin2.aIsNotNil") for _, image := range p.BinInfo().Images { t.Logf("%#x %s\n", image.StaticBase, image.Path) @@ -1445,7 +1448,7 @@ func TestPluginVariables(t *testing.T) { var plugin2AFound, mainExeGlobalFound bool for _, v := range allvars { switch v.Name { - case "github.com/go-delve/delve/_fixtures/plugin2.A": + case "github.com/undoio/delve/_fixtures/plugin2.A": plugin2AFound = true case "main.ExeGlobal": mainExeGlobalFound = true @@ -1461,12 +1464,12 @@ func TestPluginVariables(t *testing.T) { // read interface variable, inside plugin code, with a concrete type defined in the executable vs, err := evalVariableWithCfg(p, "s", pnormalLoadConfig) assertNoError(err, t, "Eval(s)") - assertVariable(t, vs, varTest{"s", true, `github.com/go-delve/delve/_fixtures/internal/pluginsupport.Something(*main.asomething) *{n: 2}`, ``, `github.com/go-delve/delve/_fixtures/internal/pluginsupport.Something`, nil}) + assertVariable(t, vs, varTest{"s", true, `github.com/undoio/delve/_fixtures/internal/pluginsupport.Something(*main.asomething) *{n: 2}`, ``, `github.com/undoio/delve/_fixtures/internal/pluginsupport.Something`, nil}) // test that the concrete type -> interface{} conversion works across plugins (mostly tests proc.dwarfToRuntimeType) assertNoError(setVariable(p, "plugin2.A", "main.ExeGlobal"), t, "setVariable(plugin2.A = main.ExeGlobal)") assertNoError(p.Continue(), t, "Continue 3") - assertCurrentLocationFunction(p, t, "github.com/go-delve/delve/_fixtures/plugin2.aIsNotNil") + assertCurrentLocationFunction(p, t, "github.com/undoio/delve/_fixtures/plugin2.aIsNotNil") vstr, err := evalVariableWithCfg(p, "str", pnormalLoadConfig) assertNoError(err, t, "Eval(str)") assertVariable(t, vstr, varTest{"str", true, `"success"`, ``, `string`, nil}) @@ -1478,7 +1481,7 @@ func TestPluginVariables(t *testing.T) { // read interface variable, inside executable code, with a concrete type defined in a plugin vb, err := evalVariableWithCfg(p, "b", pnormalLoadConfig) assertNoError(err, t, "Eval(b)") - assertVariable(t, vb, varTest{"b", true, `github.com/go-delve/delve/_fixtures/internal/pluginsupport.SomethingElse(*github.com/go-delve/delve/_fixtures/plugin2.asomethingelse) *{x: 1, y: 4}`, ``, `github.com/go-delve/delve/_fixtures/internal/pluginsupport.SomethingElse`, nil}) + assertVariable(t, vb, varTest{"b", true, `github.com/undoio/delve/_fixtures/internal/pluginsupport.SomethingElse(*github.com/undoio/delve/_fixtures/plugin2.asomethingelse) *{x: 1, y: 4}`, ``, `github.com/undoio/delve/_fixtures/internal/pluginsupport.SomethingElse`, nil}) }) } diff --git a/pkg/proc/winutil/regs.go b/pkg/proc/winutil/regs.go index 3587ded84..8d585381e 100644 --- a/pkg/proc/winutil/regs.go +++ b/pkg/proc/winutil/regs.go @@ -6,7 +6,7 @@ import ( "fmt" "unsafe" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) // AMD64Registers represents CPU registers on an AMD64 processor. diff --git a/pkg/proc/x86_disasm.go b/pkg/proc/x86_disasm.go index 96e207019..66181a217 100644 --- a/pkg/proc/x86_disasm.go +++ b/pkg/proc/x86_disasm.go @@ -1,7 +1,7 @@ package proc import ( - "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/dwarf/op" "golang.org/x/arch/x86/x86asm" ) diff --git a/pkg/terminal/colorize/colorize_test.go b/pkg/terminal/colorize/colorize_test.go index bbccbcd6e..d8b385c3c 100644 --- a/pkg/terminal/colorize/colorize_test.go +++ b/pkg/terminal/colorize/colorize_test.go @@ -8,8 +8,8 @@ import ( "path/filepath" "testing" - "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/pkg/terminal/colorize" + "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/pkg/terminal/colorize" ) const terminalHighlightEscapeCode string = "\033[%2dm" diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index 42611981e..ff1479299 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -26,12 +26,12 @@ import ( "time" "github.com/cosiner/argv" - "github.com/go-delve/delve/pkg/config" - "github.com/go-delve/delve/pkg/locspec" - "github.com/go-delve/delve/pkg/proc/debuginfod" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/rpc2" + "github.com/undoio/delve/pkg/config" + "github.com/undoio/delve/pkg/locspec" + "github.com/undoio/delve/pkg/proc/debuginfod" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/rpc2" ) const optimizedFunctionWarning = "Warning: debugging optimized function" @@ -124,14 +124,14 @@ Type "help" followed by the name of a command for more information about it.`}, break [name] [locspec] -See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line. +See $GOPATH/src/github.com/undoio/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line. See also: "help on", "help cond" and "help clear"`}, {aliases: []string{"trace", "t"}, group: breakCmds, cmdFn: tracepoint, allowedPrefixes: onPrefix, helpMsg: `Set tracepoint. trace [name] [locspec] -A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line. +A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See $GOPATH/src/github.com/undoio/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line. See also: "help on", "help cond" and "help clear"`}, {aliases: []string{"watch"}, group: breakCmds, cmdFn: watchpoint, helpMsg: `Set watchpoint. @@ -422,7 +422,7 @@ Executes the specified command (print, args, locals) in the context of the n-th source -If path ends with the .star extension it will be interpreted as a starlark script. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/starlark.md for the syntax. +If path ends with the .star extension it will be interpreted as a starlark script. See $GOPATH/src/github.com/undoio/delve/Documentation/cli/starlark.md for the syntax. If path is a single '-' character an interactive starlark interpreter will start instead. Type 'exit' to exit.`}, {aliases: []string{"disassemble", "disass"}, cmdFn: disassCommand, helpMsg: `Disassembler. diff --git a/pkg/terminal/command_test.go b/pkg/terminal/command_test.go index 39d8ff520..ee7a725c3 100644 --- a/pkg/terminal/command_test.go +++ b/pkg/terminal/command_test.go @@ -17,15 +17,15 @@ import ( "testing" "time" - "github.com/go-delve/delve/pkg/config" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/debugger" - "github.com/go-delve/delve/service/rpc2" - "github.com/go-delve/delve/service/rpccommon" + "github.com/undoio/delve/pkg/config" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/debugger" + "github.com/undoio/delve/service/rpc2" + "github.com/undoio/delve/service/rpccommon" ) var testBackend, buildMode string @@ -118,7 +118,7 @@ func withTestTerminal(name string, t testing.TB, fn func(*FakeTerminal)) { } func withTestTerminalBuildFlags(name string, t testing.TB, buildFlags test.BuildFlags, fn func(*FakeTerminal)) { - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { test.MustHaveRecordingAllowed(t) } os.Setenv("TERM", "dumb") @@ -291,6 +291,7 @@ func TestTraceOnNonFunctionEntry(t *testing.T) { } func TestExitStatus(t *testing.T) { + test.AllowRecording(t) withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { term.Exec("continue") status, err := term.handleExit() @@ -638,7 +639,7 @@ func TestListCmd(t *testing.T) { func TestReverseContinue(t *testing.T) { test.AllowRecording(t) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { return } withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { @@ -652,7 +653,7 @@ func TestReverseContinue(t *testing.T) { func TestCheckpoints(t *testing.T) { test.AllowRecording(t) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { return } withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { @@ -812,6 +813,7 @@ func TestConfig(t *testing.T) { func TestIssue1090(t *testing.T) { // Exit while executing 'next' should report the "Process exited" error // message instead of crashing. + test.AllowRecording(t) withTestTerminal("math", t, func(term *FakeTerminal) { term.MustExec("break main.main") term.MustExec("continue") @@ -825,6 +827,7 @@ func TestIssue1090(t *testing.T) { } func TestPrintContextParkedGoroutine(t *testing.T) { + test.AllowRecording(t) withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) { term.MustExec("break stacktraceme") term.MustExec("continue") @@ -864,6 +867,7 @@ func TestStepOutReturn(t *testing.T) { if ver.Major >= 0 && !ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 10, Rev: -1}) { t.Skip("return variables aren't marked on 1.9 or earlier") } + test.AllowRecording(t) withTestTerminal("stepoutret", t, func(term *FakeTerminal) { term.MustExec("break main.stepout") term.MustExec("continue") @@ -876,6 +880,7 @@ func TestStepOutReturn(t *testing.T) { } func TestOptimizationCheck(t *testing.T) { + test.AllowRecording(t) withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { term.MustExec("break main.main") out := term.MustExec("continue") @@ -899,6 +904,7 @@ func TestOptimizationCheck(t *testing.T) { func TestTruncateStacktrace(t *testing.T) { const stacktraceTruncatedMessage = "(truncated)" + test.AllowRecording(t) withTestTerminal("stacktraceprog", t, func(term *FakeTerminal) { term.MustExec("break main.stacktraceme") term.MustExec("continue") @@ -1049,6 +1055,7 @@ func TestExamineMemoryCmd(t *testing.T) { } func TestPrintOnTracepoint(t *testing.T) { + test.AllowRecording(t) withTestTerminal("increment", t, func(term *FakeTerminal) { term.MustExec("trace main.Increment") term.MustExec("on 1 print y+1") @@ -1115,6 +1122,7 @@ func TestParseNewArgv(t *testing.T) { } func TestContinueUntil(t *testing.T) { + test.AllowRecording(t) withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { if runtime.GOARCH != "386" { listIsAt(t, term, "continue main.main", 16, -1, -1) @@ -1126,6 +1134,7 @@ func TestContinueUntil(t *testing.T) { } func TestContinueUntilExistingBreakpoint(t *testing.T) { + test.AllowRecording(t) withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { term.MustExec("break main.main") if runtime.GOARCH != "386" { @@ -1148,6 +1157,7 @@ func TestPrintFormat(t *testing.T) { } func TestHitCondBreakpoint(t *testing.T) { + test.AllowRecording(t) withTestTerminal("break", t, func(term *FakeTerminal) { term.MustExec("break bp1 main.main:4") term.MustExec("condition -hitcount bp1 > 2") diff --git a/pkg/terminal/config.go b/pkg/terminal/config.go index a005c51aa..8e3cc1812 100644 --- a/pkg/terminal/config.go +++ b/pkg/terminal/config.go @@ -6,7 +6,7 @@ import ( "reflect" "text/tabwriter" - "github.com/go-delve/delve/pkg/config" + "github.com/undoio/delve/pkg/config" ) func configureCmd(t *Term, ctx callContext, args string) error { diff --git a/pkg/terminal/disasmprint.go b/pkg/terminal/disasmprint.go index 8e4209b7c..b04102bbb 100644 --- a/pkg/terminal/disasmprint.go +++ b/pkg/terminal/disasmprint.go @@ -7,7 +7,7 @@ import ( "path/filepath" "text/tabwriter" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) func disasmPrint(dv api.AsmInstructions, out io.Writer) { diff --git a/pkg/terminal/docgen.go b/pkg/terminal/docgen.go index bcc2b368e..c61e643d2 100644 --- a/pkg/terminal/docgen.go +++ b/pkg/terminal/docgen.go @@ -7,7 +7,7 @@ import ( ) func replaceDocPath(s string) string { - const docpath = "$GOPATH/src/github.com/go-delve/delve/" + const docpath = "$GOPATH/src/github.com/undoio/delve/" for { start := strings.Index(s, docpath) @@ -22,7 +22,7 @@ func replaceDocPath(s string) string { } text := s[start+len(docpath) : end] - s = s[:start] + fmt.Sprintf("[%s](//github.com/go-delve/delve/tree/master/%s)", text, text) + s[end:] + s = s[:start] + fmt.Sprintf("[%s](//github.com/undoio/delve/tree/master/%s)", text, text) + s[end:] } } diff --git a/pkg/terminal/starbind/conv.go b/pkg/terminal/starbind/conv.go index 49b29b313..02a8ff6d2 100644 --- a/pkg/terminal/starbind/conv.go +++ b/pkg/terminal/starbind/conv.go @@ -9,7 +9,7 @@ import ( "go.starlark.net/starlark" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) // autoLoadConfig is the load configuration used to automatically load more from a variable diff --git a/pkg/terminal/starbind/starlark.go b/pkg/terminal/starbind/starlark.go index de37879e4..481b27079 100644 --- a/pkg/terminal/starbind/starlark.go +++ b/pkg/terminal/starbind/starlark.go @@ -12,8 +12,8 @@ import ( "go.starlark.net/resolve" "go.starlark.net/starlark" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" ) //go:generate go run ../../../_scripts/gen-starlark-bindings.go go ./starlark_mapping.go diff --git a/pkg/terminal/starbind/starlark_mapping.go b/pkg/terminal/starbind/starlark_mapping.go index daf5f1ee7..782a93528 100644 --- a/pkg/terminal/starbind/starlark_mapping.go +++ b/pkg/terminal/starbind/starlark_mapping.go @@ -4,8 +4,8 @@ package starbind import ( "fmt" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/rpc2" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/rpc2" "go.starlark.net/starlark" ) diff --git a/pkg/terminal/starlark.go b/pkg/terminal/starlark.go index 9134a2760..5837c6e96 100644 --- a/pkg/terminal/starlark.go +++ b/pkg/terminal/starlark.go @@ -1,9 +1,9 @@ package terminal import ( - "github.com/go-delve/delve/pkg/terminal/starbind" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/terminal/starbind" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" ) type starlarkContext struct { diff --git a/pkg/terminal/terminal.go b/pkg/terminal/terminal.go index ee73cfebc..4d8c899f6 100644 --- a/pkg/terminal/terminal.go +++ b/pkg/terminal/terminal.go @@ -16,12 +16,12 @@ import ( "github.com/derekparker/trie" "github.com/go-delve/liner" - "github.com/go-delve/delve/pkg/config" - "github.com/go-delve/delve/pkg/locspec" - "github.com/go-delve/delve/pkg/terminal/colorize" - "github.com/go-delve/delve/pkg/terminal/starbind" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/config" + "github.com/undoio/delve/pkg/locspec" + "github.com/undoio/delve/pkg/terminal/colorize" + "github.com/undoio/delve/pkg/terminal/starbind" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" ) const ( diff --git a/pkg/terminal/terminal_test.go b/pkg/terminal/terminal_test.go index e6a379109..3802d29a0 100644 --- a/pkg/terminal/terminal_test.go +++ b/pkg/terminal/terminal_test.go @@ -6,7 +6,7 @@ import ( "runtime" "testing" - "github.com/go-delve/delve/pkg/config" + "github.com/undoio/delve/pkg/config" ) type tRule struct { diff --git a/service/api/conversions.go b/service/api/conversions.go index 5248f95d6..20e74ed87 100644 --- a/service/api/conversions.go +++ b/service/api/conversions.go @@ -11,9 +11,9 @@ import ( "strconv" "strings" - "github.com/go-delve/delve/pkg/dwarf/godwarf" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/dwarf/godwarf" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" ) // ConvertLogicalBreakpoint converts a proc.LogicalBreakpoint into an API breakpoint. diff --git a/service/api/types.go b/service/api/types.go index 5187ebdd8..a37d5eefd 100644 --- a/service/api/types.go +++ b/service/api/types.go @@ -8,7 +8,7 @@ import ( "strconv" "unicode" - "github.com/go-delve/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc" ) // ErrNotExecutable is an error returned when trying diff --git a/service/client.go b/service/client.go index bfb359672..67feecc13 100644 --- a/service/client.go +++ b/service/client.go @@ -3,7 +3,7 @@ package service import ( "time" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) // Client represents a debugger service client. All client methods are diff --git a/service/config.go b/service/config.go index ce99487ad..5426a902f 100644 --- a/service/config.go +++ b/service/config.go @@ -3,7 +3,7 @@ package service import ( "net" - "github.com/go-delve/delve/service/debugger" + "github.com/undoio/delve/service/debugger" ) // Config provides the configuration to start a Debugger and expose it with a diff --git a/service/dap/command.go b/service/dap/command.go index ab318e095..2e9a92c70 100644 --- a/service/dap/command.go +++ b/service/dap/command.go @@ -7,7 +7,7 @@ import ( "sort" "strings" - "github.com/go-delve/delve/pkg/config" + "github.com/undoio/delve/pkg/config" "github.com/google/go-dap" ) diff --git a/service/dap/config.go b/service/dap/config.go index 3a13c12d1..edccf31d9 100644 --- a/service/dap/config.go +++ b/service/dap/config.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - "github.com/go-delve/delve/pkg/config" + "github.com/undoio/delve/pkg/config" ) func listConfig(args *launchAttachArgs) string { diff --git a/service/dap/handles.go b/service/dap/handles.go index 8c1f94970..dc9678a0e 100644 --- a/service/dap/handles.go +++ b/service/dap/handles.go @@ -1,6 +1,6 @@ package dap -import "github.com/go-delve/delve/pkg/proc" +import "github.com/undoio/delve/pkg/proc" const startHandle = 1000 @@ -19,7 +19,7 @@ type fullyQualifiedVariable struct { // A way to load this variable by either using all names in the hierarchic // sequence above this variable (most readable when referenced by the UI) // if available or a special expression based on: - // https://github.com/go-delve/delve/blob/master/Documentation/api/ClientHowto.md#loading-more-of-a-variable + // https://github.com/undoio/delve/blob/master/Documentation/api/ClientHowto.md#loading-more-of-a-variable // Empty if the variable cannot or should not be reloaded. fullyQualifiedNameOrExpr string // True if this represents variable scope diff --git a/service/dap/server.go b/service/dap/server.go index 640e29500..847df4cc0 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -32,16 +32,16 @@ import ( "sync" "time" - "github.com/go-delve/delve/pkg/gobuild" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/locspec" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/debugger" - "github.com/go-delve/delve/service/internal/sameuser" + "github.com/undoio/delve/pkg/gobuild" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/locspec" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/debugger" + "github.com/undoio/delve/service/internal/sameuser" "github.com/google/go-dap" "github.com/sirupsen/logrus" @@ -2457,7 +2457,7 @@ func (s *Session) convertVariableWithOpts(v *proc.Variable, qualifiedNameOrExpr var reloadVariable = func(v *proc.Variable, qualifiedNameOrExpr string) (value string) { // We might be loading variables from the frame that's not topmost, so use // frame-independent address-based expression, not fully-qualified name as per - // https://github.com/go-delve/delve/blob/master/Documentation/api/ClientHowto.md#looking-into-variables. + // https://github.com/undoio/delve/blob/master/Documentation/api/ClientHowto.md#looking-into-variables. // TODO(polina): Get *proc.Variable object from debugger instead. Export a function to set v.loaded to false // and call v.loadValue gain with a different load config. It's more efficient, and it's guaranteed to keep // working with generics. diff --git a/service/dap/server_test.go b/service/dap/server_test.go index 2216bb033..39a99cf1b 100644 --- a/service/dap/server_test.go +++ b/service/dap/server_test.go @@ -20,14 +20,14 @@ import ( "testing" "time" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/dap/daptest" - "github.com/go-delve/delve/service/debugger" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/dap/daptest" + "github.com/undoio/delve/service/debugger" "github.com/google/go-dap" ) @@ -2434,19 +2434,19 @@ func TestGlobalScopeAndVariables(t *testing.T) { client.ScopesRequest(1000) scopes = client.ExpectScopesResponse(t) checkScope(t, scopes, 0, "Locals", localsScope) - checkScope(t, scopes, 1, "Globals (package github.com/go-delve/delve/_fixtures/internal/dir0/pkg)", globalsScope) + checkScope(t, scopes, 1, "Globals (package github.com/undoio/delve/_fixtures/internal/dir0/pkg)", globalsScope) client.VariablesRequest(globalsScope) globals := client.ExpectVariablesResponse(t) checkChildren(t, globals, "Globals", 1) - ref := checkVarExact(t, globals, 0, "SomeVar", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeVar", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType {X: 0}", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType", hasChildren) + ref := checkVarExact(t, globals, 0, "SomeVar", "github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeVar", "github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType {X: 0}", "github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeType", hasChildren) if ref > 0 { client.VariablesRequest(ref) somevar := client.ExpectVariablesResponse(t) checkChildren(t, somevar, "SomeVar", 1) // TODO(polina): unlike main.p, this prefix won't work - checkVarExact(t, somevar, 0, "X", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeVar.X", "0", "float64", noChildren) + checkVarExact(t, somevar, 0, "X", "github.com/undoio/delve/_fixtures/internal/dir0/pkg.SomeVar.X", "0", "float64", noChildren) } }, disconnect: false, @@ -5516,7 +5516,7 @@ func TestLaunchTestRequest(t *testing.T) { testFile, []int{14}, []onBreakpoint{{ execute: func() { - checkStop(t, client, -1, "github.com/go-delve/delve/_fixtures/buildtest.TestCurrentDirectory", 14) + checkStop(t, client, -1, "github.com/undoio/delve/_fixtures/buildtest.TestCurrentDirectory", 14) client.VariablesRequest(1001) // Locals locals := client.ExpectVariablesResponse(t) checkChildren(t, locals, "Locals", 1) diff --git a/service/debugger/debugger.go b/service/debugger/debugger.go index d96cbb0ed..8c6e6f2ed 100644 --- a/service/debugger/debugger.go +++ b/service/debugger/debugger.go @@ -17,16 +17,16 @@ import ( "sync" "time" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/gobuild" - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/locspec" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/core" - "github.com/go-delve/delve/pkg/proc/gdbserial" - "github.com/go-delve/delve/pkg/proc/native" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/gobuild" + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/locspec" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/pkg/proc/core" + "github.com/undoio/delve/pkg/proc/gdbserial" + "github.com/undoio/delve/pkg/proc/native" + "github.com/undoio/delve/service/api" "github.com/sirupsen/logrus" ) @@ -170,6 +170,9 @@ func New(config *Config, processArgs []string) (*Debugger, error) { case "rr": d.log.Infof("opening trace %s", d.config.CoreFile) p, err = gdbserial.Replay(d.config.CoreFile, false, false, d.config.DebugInfoDirectories) + case "undo": + d.log.Infof("opening recording %s", d.config.CoreFile) + p, err = gdbserial.UndoReplay(d.config.CoreFile, "", false, d.config.DebugInfoDirectories) default: d.log.Infof("opening core file %s (executable %s)", d.config.CoreFile, d.processArgs[0]) p, err = core.OpenCore(d.config.CoreFile, d.processArgs[0], d.config.DebugInfoDirectories) @@ -295,6 +298,9 @@ func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error) } }() return nil, nil + case "undo": + tgt, _, err := gdbserial.UndoRecordAndReplay(processArgs, wd, false, d.config.DebugInfoDirectories, d.config.Redirects) + return tgt, err case "default": if runtime.GOOS == "darwin" { @@ -497,7 +503,7 @@ func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs [] } } - if recorded { + if recorded && d.config.Backend == "rr" { run, stop, err2 := gdbserial.RecordAsync(d.processArgs, d.config.WorkingDir, false, d.config.Redirects) if err2 != nil { return nil, err2 @@ -506,6 +512,8 @@ func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs [] d.recordingStart(stop) p, err = d.recordingRun(run) d.recordingDone() + } else if recorded && d.config.Backend == "undo" { + p, _, err = gdbserial.UndoRecordAndReplay(d.processArgs, d.config.WorkingDir, false, d.config.DebugInfoDirectories, d.config.Redirects) } else { p, err = d.Launch(d.processArgs, d.config.WorkingDir) } @@ -2019,8 +2027,8 @@ func (d *Debugger) ExamineMemory(address uint64, length int) ([]byte, error) { func (d *Debugger) GetVersion(out *api.GetVersionOut) error { if d.config.CoreFile != "" { - if d.config.Backend == "rr" { - out.Backend = "rr" + if d.config.Backend == "rr" || d.config.Backend == "undo" { + out.Backend = d.config.Backend } else { out.Backend = "core" } diff --git a/service/debugger/debugger_test.go b/service/debugger/debugger_test.go index 275e1a5ca..7eecef4f5 100644 --- a/service/debugger/debugger_test.go +++ b/service/debugger/debugger_test.go @@ -7,9 +7,9 @@ import ( "runtime" "testing" - "github.com/go-delve/delve/pkg/gobuild" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/gobuild" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service/api" ) func TestDebugger_LaunchNoMain(t *testing.T) { diff --git a/service/debugger/debugger_unix.go b/service/debugger/debugger_unix.go index 2978ce16e..9b30032ff 100644 --- a/service/debugger/debugger_unix.go +++ b/service/debugger/debugger_unix.go @@ -9,7 +9,7 @@ import ( "os" "runtime" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) func verifyBinaryFormat(exePath string) error { diff --git a/service/debugger/debugger_unix_test.go b/service/debugger/debugger_unix_test.go index bb90dbd04..7372a9879 100644 --- a/service/debugger/debugger_unix_test.go +++ b/service/debugger/debugger_unix_test.go @@ -14,9 +14,9 @@ import ( "testing" "github.com/creack/pty" - "github.com/go-delve/delve/pkg/gobuild" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/pkg/gobuild" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service/api" ) func TestDebugger_LaunchNoExecutablePerm(t *testing.T) { diff --git a/service/debugger/debugger_windows.go b/service/debugger/debugger_windows.go index cd0bad96e..b498f87e6 100644 --- a/service/debugger/debugger_windows.go +++ b/service/debugger/debugger_windows.go @@ -7,7 +7,7 @@ import ( "os/exec" "path/filepath" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) func attachErrorMessage(pid int, err error) error { diff --git a/service/internal/sameuser/sameuser_linux.go b/service/internal/sameuser/sameuser_linux.go index 4aeeb5e44..eb7dcd572 100644 --- a/service/internal/sameuser/sameuser_linux.go +++ b/service/internal/sameuser/sameuser_linux.go @@ -13,7 +13,7 @@ import ( "os" "strings" - "github.com/go-delve/delve/pkg/logflags" + "github.com/undoio/delve/pkg/logflags" ) // for testing diff --git a/service/rpc1/client.go b/service/rpc1/client.go index 9c24e7eb9..659b9c250 100644 --- a/service/rpc1/client.go +++ b/service/rpc1/client.go @@ -9,7 +9,7 @@ import ( "sync" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service/api" ) // RPCClient is a RPC service.Client. diff --git a/service/rpc1/server.go b/service/rpc1/server.go index b42943096..64c8ffdaa 100644 --- a/service/rpc1/server.go +++ b/service/rpc1/server.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/debugger" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/debugger" ) var defaultLoadConfig = proc.LoadConfig{ diff --git a/service/rpc2/client.go b/service/rpc2/client.go index f01c0a973..6fc9f5733 100644 --- a/service/rpc2/client.go +++ b/service/rpc2/client.go @@ -8,8 +8,8 @@ import ( "net/rpc/jsonrpc" "time" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" ) // RPCClient is a RPC service.Client. @@ -242,7 +242,7 @@ func (c *RPCClient) GetBreakpointByName(name string) (*api.Breakpoint, error) { // CreateBreakpoint will send a request to the RPC server to create a breakpoint. // Please refer to the documentation for `Debugger.CreateBreakpoint` for a description of how // the requested breakpoint parameters are interpreted and used: -// https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint +// https://pkg.go.dev/github.com/undoio/delve/service/debugger#Debugger.CreateBreakpoint func (c *RPCClient) CreateBreakpoint(breakPoint *api.Breakpoint) (*api.Breakpoint, error) { var out CreateBreakpointOut err := c.call("CreateBreakpoint", CreateBreakpointIn{*breakPoint}, &out) diff --git a/service/rpc2/server.go b/service/rpc2/server.go index fc97c0a6a..24d0dee42 100644 --- a/service/rpc2/server.go +++ b/service/rpc2/server.go @@ -6,11 +6,11 @@ import ( "sort" "time" - "github.com/go-delve/delve/pkg/dwarf/op" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/debugger" + "github.com/undoio/delve/pkg/dwarf/op" + "github.com/undoio/delve/pkg/proc" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/debugger" ) type RPCServer struct { @@ -251,7 +251,7 @@ type CreateBreakpointOut struct { // CreateBreakpoint creates a new breakpoint. The client is expected to populate `CreateBreakpointIn` // with an `api.Breakpoint` struct describing where to set the breakpoing. For more information on // how to properly request a breakpoint via the `api.Breakpoint` struct see the documentation for -// `debugger.CreateBreakpoint` here: https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint. +// `debugger.CreateBreakpoint` here: https://pkg.go.dev/github.com/undoio/delve/service/debugger#Debugger.CreateBreakpoint. func (s *RPCServer) CreateBreakpoint(arg CreateBreakpointIn, out *CreateBreakpointOut) error { if err := api.ValidBreakpointName(arg.Breakpoint.Name); err != nil { return err @@ -523,7 +523,7 @@ type EvalOut struct { // Eval returns a variable in the specified context. // -// See https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md +// See https://github.com/undoio/delve/blob/master/Documentation/cli/expr.md // for a description of acceptable values of arg.Expr. func (s *RPCServer) Eval(arg EvalIn, out *EvalOut) error { cfg := arg.Cfg diff --git a/service/rpccommon/server.go b/service/rpccommon/server.go index a68894173..46434d538 100644 --- a/service/rpccommon/server.go +++ b/service/rpccommon/server.go @@ -16,15 +16,15 @@ import ( "unicode" "unicode/utf8" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/pkg/version" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/dap" - "github.com/go-delve/delve/service/debugger" - "github.com/go-delve/delve/service/internal/sameuser" - "github.com/go-delve/delve/service/rpc1" - "github.com/go-delve/delve/service/rpc2" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/pkg/version" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/dap" + "github.com/undoio/delve/service/debugger" + "github.com/undoio/delve/service/internal/sameuser" + "github.com/undoio/delve/service/rpc1" + "github.com/undoio/delve/service/rpc2" "github.com/sirupsen/logrus" ) diff --git a/service/test/common_test.go b/service/test/common_test.go index 473e3cc62..90db8b93e 100644 --- a/service/test/common_test.go +++ b/service/test/common_test.go @@ -8,9 +8,9 @@ import ( "strings" "testing" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/rpc1" - "github.com/go-delve/delve/service/rpc2" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/rpc1" + "github.com/undoio/delve/service/rpc2" ) func assertNoError(err error, t *testing.T, s string) { diff --git a/service/test/integration1_test.go b/service/test/integration1_test.go index c3d46dce0..4c3869660 100644 --- a/service/test/integration1_test.go +++ b/service/test/integration1_test.go @@ -11,14 +11,14 @@ import ( "testing" "time" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service/debugger" - - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/rpc1" - "github.com/go-delve/delve/service/rpccommon" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service/debugger" + + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/rpc1" + "github.com/undoio/delve/service/rpccommon" ) func withTestClient1(name string, t *testing.T, fn func(c *rpc1.RPCClient)) { @@ -28,7 +28,7 @@ func withTestClient1(name string, t *testing.T, fn func(c *rpc1.RPCClient)) { } func withTestClient1Extended(name string, t *testing.T, fn func(c *rpc1.RPCClient, fixture protest.Fixture)) { - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { protest.MustHaveRecordingAllowed(t) } listener, err := net.Listen("tcp", "127.0.0.1:0") @@ -104,6 +104,7 @@ func Test1Restart_afterExit(t *testing.T) { } func Test1Restart_breakpointPreservation(t *testing.T) { + protest.AllowRecording(t) withTestClient1("continuetestprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "firstbreakpoint", Tracepoint: true}) assertNoError(err, t, "CreateBreakpoint()") @@ -160,6 +161,7 @@ func Test1Restart_duringStop(t *testing.T) { } func Test1ClientServer_exit(t *testing.T) { + protest.AllowRecording(t) withTestClient1("continuetestprog", t, func(c *rpc1.RPCClient) { state, err := c.GetState() if err != nil { @@ -183,6 +185,7 @@ func Test1ClientServer_exit(t *testing.T) { } func Test1ClientServer_step(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.helloworld", Line: -1}) if err != nil { @@ -206,6 +209,7 @@ func Test1ClientServer_step(t *testing.T) { } func testnext(testcases []nextTest, initialLocation string, t *testing.T) { + protest.AllowRecording(t) withTestClient1("testnextprog", t, func(c *rpc1.RPCClient) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: initialLocation, Line: -1}) if err != nil { @@ -297,6 +301,7 @@ func Test1NextFunctionReturn(t *testing.T) { } func Test1ClientServer_breakpointInMainThread(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testprog", t, func(c *rpc1.RPCClient) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.helloworld", Line: 1}) if err != nil { @@ -318,6 +323,7 @@ func Test1ClientServer_breakpointInMainThread(t *testing.T) { } func Test1ClientServer_breakpointInSeparateGoroutine(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testthreads", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.anotherthread", Line: 1}) if err != nil { @@ -337,6 +343,7 @@ func Test1ClientServer_breakpointInSeparateGoroutine(t *testing.T) { } func Test1ClientServer_breakAtNonexistentPoint(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "nowhere", Line: 1}) if err == nil { @@ -346,6 +353,7 @@ func Test1ClientServer_breakAtNonexistentPoint(t *testing.T) { } func Test1ClientServer_clearBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testprog", t, func(c *rpc1.RPCClient) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.sleepytime", Line: 1}) if err != nil { @@ -372,6 +380,7 @@ func Test1ClientServer_clearBreakpoint(t *testing.T) { } func Test1ClientServer_switchThread(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testnextprog", t, func(c *rpc1.RPCClient) { // With invalid thread id _, err := c.SwitchThread(-1) @@ -415,6 +424,7 @@ func Test1ClientServer_switchThread(t *testing.T) { } func Test1ClientServer_infoLocals(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testnextprog", t, func(c *rpc1.RPCClient) { fp := testProgPath(t, "testnextprog") _, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 24}) @@ -436,6 +446,7 @@ func Test1ClientServer_infoLocals(t *testing.T) { } func Test1ClientServer_infoArgs(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testnextprog", t, func(c *rpc1.RPCClient) { fp := testProgPath(t, "testnextprog") _, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 47}) @@ -464,6 +475,7 @@ func Test1ClientServer_infoArgs(t *testing.T) { } func Test1ClientServer_traceContinue(t *testing.T) { + protest.AllowRecording(t) withTestClient1("integrationprog", t, func(c *rpc1.RPCClient) { fp := testProgPath(t, "integrationprog") _, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 15, Tracepoint: true, Goroutine: true, Stacktrace: 5, Variables: []string{"i"}}) @@ -521,6 +533,7 @@ func Test1ClientServer_traceContinue(t *testing.T) { } func Test1ClientServer_traceContinue2(t *testing.T) { + protest.AllowRecording(t) withTestClient1("integrationprog", t, func(c *rpc1.RPCClient) { bp1, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Tracepoint: true}) if err != nil { @@ -564,6 +577,7 @@ func Test1ClientServer_traceContinue2(t *testing.T) { } func Test1ClientServer_FindLocations(t *testing.T) { + protest.AllowRecording(t) withTestClient1("locationsprog", t, func(c *rpc1.RPCClient) { someFunctionCallAddr := findLocationHelper(t, c, "locationsprog.go:26", false, 1, 0)[0] someFunctionLine1 := findLocationHelper(t, c, "locationsprog.go:27", false, 1, 0)[0] @@ -725,6 +739,7 @@ func Test1ClientServer_FullStacktrace(t *testing.T) { lenient = true } + protest.AllowRecording(t) withTestClient1("goroutinestackprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.stacktraceme", Line: -1}) assertNoError(err, t, "CreateBreakpoint()") @@ -972,6 +987,7 @@ func Test1Disasm(t *testing.T) { } func Test1NegativeStackDepthBug(t *testing.T) { + protest.AllowRecording(t) // After the target process has terminated should return an error but not crash withTestClient1("continuetestprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.sayhi", Line: -1}) @@ -988,6 +1004,7 @@ func Test1ClientServer_CondBreakpoint(t *testing.T) { if runtime.GOOS == "freebsd" { t.Skip("test is not valid on FreeBSD") } + protest.AllowRecording(t) withTestClient1("parallel_next", t, func(c *rpc1.RPCClient) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.sayhi", Line: 1}) assertNoError(err, t, "CreateBreakpoint()") @@ -1035,6 +1052,7 @@ func Test1Issue419(t *testing.T) { } func Test1TypesCommand(t *testing.T) { + protest.AllowRecording(t) withTestClient1("testvariables2", t, func(c *rpc1.RPCClient) { state := <-c.Continue() assertNoError(state.Err, t, "Continue()") @@ -1061,6 +1079,7 @@ func Test1TypesCommand(t *testing.T) { } func Test1Issue406(t *testing.T) { + protest.AllowRecording(t) withTestClient1("issue406", t, func(c *rpc1.RPCClient) { locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "issue406.go:146") assertNoError(err, t, "FindLocation()") diff --git a/service/test/integration2_test.go b/service/test/integration2_test.go index be7b2646b..eb36f8565 100644 --- a/service/test/integration2_test.go +++ b/service/test/integration2_test.go @@ -18,15 +18,15 @@ import ( "testing" "time" - protest "github.com/go-delve/delve/pkg/proc/test" - "github.com/go-delve/delve/service/debugger" - - "github.com/go-delve/delve/pkg/goversion" - "github.com/go-delve/delve/pkg/logflags" - "github.com/go-delve/delve/service" - "github.com/go-delve/delve/service/api" - "github.com/go-delve/delve/service/rpc2" - "github.com/go-delve/delve/service/rpccommon" + protest "github.com/undoio/delve/pkg/proc/test" + "github.com/undoio/delve/service/debugger" + + "github.com/undoio/delve/pkg/goversion" + "github.com/undoio/delve/pkg/logflags" + "github.com/undoio/delve/service" + "github.com/undoio/delve/service/api" + "github.com/undoio/delve/service/rpc2" + "github.com/undoio/delve/service/rpccommon" ) var normalLoadConfig = api.LoadConfig{ @@ -61,7 +61,7 @@ func withTestClient2(name string, t *testing.T, fn func(c service.Client)) { } func startServer(name string, buildFlags protest.BuildFlags, t *testing.T, redirects [3]string) (clientConn net.Conn, fixture protest.Fixture) { - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { protest.MustHaveRecordingAllowed(t) } listener, clientConn := service.ListenerPipe() @@ -473,6 +473,7 @@ func TestClientServer_breakpointInSeparateGoroutine(t *testing.T) { } func TestClientServer_breakAtNonexistentPoint(t *testing.T) { + protest.AllowRecording(t) withTestClient2("testprog", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "nowhere", Line: 1}) if err == nil { @@ -482,6 +483,7 @@ func TestClientServer_breakAtNonexistentPoint(t *testing.T) { } func TestClientServer_clearBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestClient2("testprog", t, func(c service.Client) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.sleepytime", Line: 1}) if err != nil { @@ -508,6 +510,7 @@ func TestClientServer_clearBreakpoint(t *testing.T) { } func TestClientServer_toggleBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestClient2("testtoggle", t, func(c service.Client) { toggle := func(bp *api.Breakpoint) { t.Helper() @@ -581,6 +584,7 @@ func TestClientServer_toggleBreakpoint(t *testing.T) { } func TestClientServer_toggleAmendedBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestClient2("testtoggle", t, func(c service.Client) { toggle := func(bp *api.Breakpoint) { dbp, err := c.ToggleBreakpoint(bp.ID) @@ -943,6 +947,7 @@ func TestClientServer_traceContinue2(t *testing.T) { } func TestClientServer_FindLocations(t *testing.T) { + protest.AllowRecording(t) withTestClient2("locationsprog", t, func(c service.Client) { someFunctionCallAddr := findLocationHelper(t, c, "locationsprog.go:26", false, 1, 0)[0] someFunctionLine1 := findLocationHelper(t, c, "locationsprog.go:27", false, 1, 0)[0] @@ -1058,7 +1063,7 @@ func TestClientServer_FindLocations(t *testing.T) { if goversion.VersionAfterOrEqual(runtime.Version(), 1, 13) { withTestClient2("pkgrenames", t, func(c service.Client) { - someFuncLoc := findLocationHelper(t, c, "github.com/go-delve/delve/_fixtures/internal/dir%2eio.SomeFunction:0", false, 1, 0)[0] + someFuncLoc := findLocationHelper(t, c, "github.com/undoio/delve/_fixtures/internal/dir%2eio.SomeFunction:0", false, 1, 0)[0] findLocationHelper(t, c, "dirio.SomeFunction:0", false, 1, someFuncLoc) }) } @@ -1147,6 +1152,7 @@ func TestClientServer_FindLocationsAddr(t *testing.T) { } func TestClientServer_FindLocationsExactMatch(t *testing.T) { + protest.AllowRecording(t) // if an expression matches multiple functions but one of them is an exact // match it should be used anyway. // In this example "math/rand.Intn" would normally match "math/rand.Intn" @@ -1335,11 +1341,11 @@ func TestIssue355(t *testing.T) { s, err = c.Halt() assertErrorOrExited(s, err, t, "Halt()") _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: -1}) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { assertError(err, t, "CreateBreakpoint()") } _, err = c.ClearBreakpoint(bp.ID) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { assertError(err, t, "ClearBreakpoint()") } _, err = c.ListThreads() @@ -1552,6 +1558,7 @@ func TestSkipPrologue(t *testing.T) { } func TestSkipPrologue2(t *testing.T) { + protest.AllowRecording(t) withTestClient2("callme", t, func(c service.Client) { callme := findLocationHelper(t, c, "main.callme", false, 1, 0)[0] callmeZ := uint64(clientEvalVariable(t, c, "main.callme").Addr) @@ -1682,12 +1689,16 @@ func TestClientServer_Issue528(t *testing.T) { return } + protest.AllowRecording(t) withTestClient2("issue528", t, func(c service.Client) { findLocationHelper(t, c, "State.Close", false, 1, 0) }) } func TestClientServer_FpRegisters(t *testing.T) { + if testBackend == "undo" { + t.Skip("undo backend doesn't report floating-point registers [#19]") + } if runtime.GOARCH != "amd64" { t.Skip("test is valid only on AMD64") } @@ -1865,8 +1876,8 @@ func TestClientServer_SelectedGoroutineLoc(t *testing.T) { func TestClientServer_ReverseContinue(t *testing.T) { protest.AllowRecording(t) - if testBackend != "rr" { - t.Skip("backend is not rr") + if testBackend != "rr" && testBackend != "undo" { + t.Skip("only valid for recorded targets") } withTestClient2("continuetestprog", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: -1}) @@ -1994,6 +2005,7 @@ func TestClientServer_StepOutReturn(t *testing.T) { if ver.Major >= 0 && !ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 10, Rev: -1}) { t.Skip("return variables aren't marked on 1.9 or earlier") } + protest.AllowRecording(t) withTestClient2("stepoutret", t, func(c service.Client) { c.SetReturnValuesLoadConfig(&normalLoadConfig) _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.stepout", Line: -1}) @@ -2047,7 +2059,7 @@ func TestClientServer_StepOutReturn(t *testing.T) { } func TestAcceptMulticlient(t *testing.T) { - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { t.Skip("recording not allowed for TestAcceptMulticlient") } listener, err := net.Listen("tcp", "127.0.0.1:0") @@ -2235,6 +2247,7 @@ func TestAncestors(t *testing.T) { savedGodebug := os.Getenv("GODEBUG") os.Setenv("GODEBUG", "tracebackancestors=100") defer os.Setenv("GODEBUG", savedGodebug) + protest.AllowRecording(t) withTestClient2("testnextprog", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.testgoroutine", Line: -1}) assertNoError(err, t, "CreateBreakpoin") @@ -2289,6 +2302,7 @@ func TestUnknownMethodCall(t *testing.T) { } func TestIssue1703(t *testing.T) { + protest.AllowRecording(t) // Calling Disassemble when there is no current goroutine should work. withTestClient2("testnextprog", t, func(c service.Client) { locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main", true, nil) @@ -2302,7 +2316,7 @@ func TestIssue1703(t *testing.T) { func TestRerecord(t *testing.T) { protest.AllowRecording(t) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { t.Skip("only valid for recorded targets") } withTestClient2("testrerecord", t, func(c service.Client) { @@ -2354,6 +2368,7 @@ func TestRerecord(t *testing.T) { func TestIssue1787(t *testing.T) { // Calling FunctionReturnLocations without a selected goroutine should // work. + protest.AllowRecording(t) withTestClient2("testnextprog", t, func(c service.Client) { if c, _ := c.(*rpc2.RPCClient); c != nil { c.FunctionReturnLocations("main.main") @@ -2362,6 +2377,7 @@ func TestIssue1787(t *testing.T) { } func TestDoubleCreateBreakpoint(t *testing.T) { + protest.AllowRecording(t) withTestClient2("testnextprog", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "firstbreakpoint", Tracepoint: true}) assertNoError(err, t, "CreateBreakpoint 1") @@ -2420,6 +2436,7 @@ func TestClearLogicalBreakpoint(t *testing.T) { // Clearing a logical breakpoint should clear all associated physical // breakpoints. // Issue #1955. + protest.AllowRecording(t) withTestClient2Extended("testinline", t, protest.EnableInlining, [3]string{}, func(c service.Client, fixture protest.Fixture) { bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.inlineThis"}) assertNoError(err, t, "CreateBreakpoint()") @@ -2456,7 +2473,7 @@ func TestRedirects(t *testing.T) { t.Fatalf("Wrong output %q", string(buf)) } os.Remove(outpath) - if testBackend != "rr" { + if testBackend != "rr" && testBackend != "undo" { _, err = c.Restart(false) assertNoError(err, t, "Restart") <-c.Continue() @@ -2498,7 +2515,7 @@ func TestIssue2162(t *testing.T) { func TestDetachLeaveRunning(t *testing.T) { // See https://github.com/go-delve/delve/issues/2259 - if testBackend == "rr" { + if testBackend == "rr" || testBackend == "undo" { return } @@ -2563,6 +2580,7 @@ func assertNoDuplicateBreakpoints(t *testing.T, c service.Client) { func TestToggleBreakpointRestart(t *testing.T) { // Checks that breakpoints IDs do not overlap after Restart if there are disabled breakpoints. + protest.AllowRecording(t) withTestClient2("testtoggle", t, func(c service.Client) { bp1, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "firstbreakpoint"}) assertNoError(err, t, "CreateBreakpoint 1") @@ -2639,6 +2657,7 @@ func TestGoroutinesGrouping(t *testing.T) { func TestLongStringArg(t *testing.T) { // Test the ability to load more elements of a string argument, this could // be broken if registerized variables are not handled correctly. + protest.AllowRecording(t) withTestClient2("morestringarg", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.f"}) assertNoError(err, t, "CreateBreakpoint")