service,terminal: apply substitute path to trace/break argument

Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements #2203
This commit is contained in:
aarzilli
2020-10-26 13:36:52 +01:00
committed by Alessandro Arzilli
parent 6ab6929b9a
commit db93049813
13 changed files with 174 additions and 116 deletions

View File

@ -600,6 +600,13 @@ type FindLocationIn struct {
Scope api.EvalScope
Loc string
IncludeNonExecutableLines bool
// SubstitutePathRules is a slice of source code path substitution rules,
// the first entry of each pair is the path of a directory as it appears in
// the executable file (i.e. the location of a source file when the program
// was compiled), the second entry of each pair is the location of the same
// directory on the client system.
SubstitutePathRules [][2]string
}
type FindLocationOut struct {
@ -621,7 +628,7 @@ type FindLocationOut struct {
// NOTE: this function does not actually set breakpoints.
func (c *RPCServer) FindLocation(arg FindLocationIn, out *FindLocationOut) error {
var err error
out.Locations, err = c.debugger.FindLocation(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Loc, arg.IncludeNonExecutableLines)
out.Locations, err = c.debugger.FindLocation(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Loc, arg.IncludeNonExecutableLines, arg.SubstitutePathRules)
return err
}