1. 29 10月, 2019 1 次提交
    • A
      proc: always resolve array types even if they don't appear in the · 5a947bce
      aarzilli 提交于
      program
      
      When evaluating type casts always resolve array types.
      
      Instead of resolving them by looking up the string in debug_info
      construct a fake array type so that a type cast to an array type always
      works as long as the element type exists.
      
      We already did this for byte arrays, this commit extends this to any
      array type. The reason is that we return a fake array type (that
      doesn't exist in the target program) for the array of a channel type.
      
      Fixes #1736
      5a947bce
  2. 22 10月, 2019 1 次提交
  3. 08 10月, 2019 1 次提交
  4. 26 9月, 2019 2 次提交
  5. 14 8月, 2019 1 次提交
  6. 01 7月, 2019 2 次提交
    • A
      proc: allow simultaneous call injection to multiple goroutines (#1591) · dd4fd5dc
      Alessandro Arzilli 提交于
      * proc: allow simultaneous call injection to multiple goroutines
      
      Changes the call injection code so that we can have multiple call
      injections going on at the same time as long as they happen on distinct
      goroutines.
      
      * proc: fix EvalExpressionWithCalls for constant expressions
      
      The lack of address of constant expressions would confuse EvalExpressionWithCalls
      
      Fixes #1577
      dd4fd5dc
    • A
      Go 1.13 support (#1546) · 55eed318
      Alessandro Arzilli 提交于
      * tests: fix tests for Go 1.13
      
      - Go 1.13 doesn't autogenerate init functions anymore, tests that
        expected that now fail and should be skipped.
      - Plugin tests now need -gcflags'all=-N -l' now, we were probably
        getting lucky with -gcflags='-N -l' before.
      
      * proc: allow signed integers as shift counts
      
      Go1.13 allows signed integers to be used as the right hand side of a
      shift operator, change eval to match.
      
      * goversion: update maximum supported version
      
      * travis: force Go to use vendor directory
      
      Travis scripts get confused by "go: downloading" lines, the exact
      reason is not clear. Testing that the vendor directory is up to date is
      a good idea anyway.
      55eed318
  7. 26 6月, 2019 1 次提交
    • A
      proc,service: remove support for locspec '<fnname>:0' (#1588) · 7afda8db
      Alessandro Arzilli 提交于
      The location specified '<fnname>:0' could be used to set a breakpoint
      on the entry point of the function (as opposed to locspec '<fnname>'
      which sets it after the prologue).
      Setting a breakpoint on an entry point is almost never useful, the way
      this feature was implemented could cause it to be used accidentally and
      there are other ways to accomplish the same task (by setting a
      breakpoint on the PC address directly).
      7afda8db
  8. 18 6月, 2019 1 次提交
  9. 13 6月, 2019 1 次提交
  10. 30 5月, 2019 1 次提交
    • A
      More Function Calls, parts 2 (#1504) · 60830c2b
      Alessandro Arzilli 提交于
      * proc: support nested function calls
      
      Changes the code in fncall.go to support nested function calls.
      
      This changes delays argument evaluation until after we have used
      the call injection protocol to allocate an argument frame. When
      evaluating the parse tree of an expression we'll initiate each
      function call we find on the way down and then complete the function
      call on the way up.
      
      For example. in:
      
      	f(g(x))
      
      we will:
      
      1. initiate the call injection protocol for f(...)
      2. progress it until the point where we have space for the arguments
         of 'f' (i.e. when we receive the debugCallAXCompleteCall message
         from the target runtime)
      3. inititate the call injection protocol for g(...)
      4. progress it until the point where we have space for the arguments
         of 'g'
      5. copy the value of x into the argument frame of 'g'
      6. finish the call to g(...)
      7. copy the return value of g(x) into the argument frame of 'f'
      8. finish the call to f(...)
      
      Updates #119
      
      * proc: bugfix: closure addr was wrong for non-closure functions
      60830c2b
  11. 09 5月, 2019 2 次提交
    • A
      proc: allow function calls to appear inside an expression (#1503) · c30a333f
      Alessandro Arzilli 提交于
      The initial implementation of the 'call' command required the
      function call to be the root expression, i.e. something like:
      
      	double(3) + 1
      
      was not allowed, because the root expression was the binary operator
      '+', not the function call.
      
      With this change expressions like the one above and others are
      allowed.
      
      This is the first step necessary to implement nested function calls
      (where the result of a function call is used as argument to another
      function call).
      
      This is implemented by replacing proc.CallFunction with
      proc.EvalExpressionWithCalls. EvalExpressionWithCalls will run
      proc.(*EvalScope).EvalExpression in a different goroutine. This
      goroutine, the 'eval' goroutine, will communicate with the main
      goroutine of the debugger by means of two channels: continueRequest
      and continueCompleted.
      
      The eval goroutine evaluates the expression recursively, when
      a function call is encountered it takes care of setting up the
      function call on the target program and writes a request to the
      continueRequest channel, this causes the 'main' goroutine to restart
      the target program by calling proc.Continue.
      
      Whenever Continue encounters a breakpoint that belongs to the
      function call injection protocol (runtime.debugCallV1 and associated
      functions) it writes to continueCompleted which resumes the 'eval'
      goroutine.
      
      The 'eval' goroutine takes care of implementing the function call
      injection protocol.
      
      When the expression is fully evaluated the 'eval' goroutine will
      write a special message to 'continueRequest' signaling that the
      expression evaluation is terminated which will cause Continue to
      return to the user.
      
      Updates #119
      c30a333f
    • A
      proc: support debugging plugins (#1414) · f3b149bd
      Alessandro Arzilli 提交于
      This change splits the BinaryInfo object into a slice of Image objects
      containing information about the base executable and each loaded shared
      library (note: go plugins are shared libraries).
      
      Delve backens are supposed to call BinaryInfo.AddImage whenever they
      detect that a new shared library has been loaded.
      
      Member fields of BinaryInfo that are used to speed up access to dwarf
      (Functions, packageVars, consts, etc...) remain part of BinaryInfo and
      are updated to reference the correct image object. This simplifies this
      change.
      
      This approach has a few shortcomings:
      
      1. Multiple shared libraries can define functions or globals with the
         same name and we have no way to disambiguate between them.
      
      2. We don't have a way to handle library unloading.
      
      Both of those affect C shared libraries much more than they affect go
      plugins. Go plugins can't be unloaded at all and a lot of name
      collisions are prevented by import paths.
      
      There's only one problem that is concerning: if two plugins both import
      the same package they will end up with multiple definition for the same
      function.
      For example if two plugins use fmt.Printf the final in-memory image
      (and therefore our BinaryInfo object) will end up with two copies of
      fmt.Printf at different memory addresses. If a user types
        break fmt.Printf
      a breakpoint should be created at *both* locations.
      Allowing this is a relatively complex change that should be done in a
      different PR than this.
      
      For this reason I consider this approach an acceptable and sustainable
      stopgap.
      
      Updates #865
      f3b149bd
  12. 27 4月, 2019 1 次提交
  13. 30 3月, 2019 1 次提交
  14. 05 1月, 2019 1 次提交
    • D
      *: Update import name to github.com/go-delve/delve · 4c9a72e4
      Derek Parker 提交于
      The repository is being switched from the personal account
      github.com/derekparker/delve to the organization account
      github.com/go-delve/delve. This patch updates imports and docs, while
      preserving things which should not be changed such as my name in the
      CHANGELOG and in TODO comments.
      4c9a72e4
  15. 10 11月, 2018 1 次提交
    • A
      proc: Improve performance of loadMap on very large sparse maps · 89c8da65
      aarzilli 提交于
      Users can create sparse maps in two ways, either by:
      a) adding lots of entries to a map and then deleting most of them, or
      b) using the make(mapType, N) expression with a very large N
      
      When this happens reading the resulting map will be very slow
      because loadMap needs to scan many buckets for each entry it finds.
      
      Technically this is not a bug, the user just created a map that's
      very sparse and therefore very slow to read. However it's very
      annoying to have the debugger hang for several seconds when trying
      to read the local variables just because one of them (which you
      might not even be interested into) happens to be a very sparse map.
      
      There is an easy mitigation to this problem: not reading any
      additional buckets once we know that we have already read all
      entries of the map, or as many entries as we need to fulfill the
      MaxArrayValues parameter.
      
      Unfortunately this is mostly useless, a VLSM (Very Large Sparse Map)
      with a single entry will still be slow to access, because the single
      entry in the map could easily end up in the last bucket.
      
      The obvious solution to this problem is to set a limit to the
      number of buckets we read when loading a map. However there is no
      good way to set this limit.
      If we hardcode it there will be no way to print maps that are beyond
      whatever limit we pick.
      We could let users (or clients) specify it but the meaning of such
      knob would be arcane and they would have no way of picking a good
      value (because there is no objectively good value for it).
      
      The solution used in this commit is to set an arbirtray limit on
      the number of buckets we read but only when loadMap is invoked
      through API calls ListLocalVars and ListFunctionArgs. In this way
      `ListLocalVars` and `ListFunctionArgs` (which are often invoked
      automatically by GUI clients) remain fast even in presence of a
      VLSM, but the contents of the VLSM can still be inspected using
      `EvalVariable`.
      89c8da65
  16. 09 11月, 2018 1 次提交
  17. 07 11月, 2018 1 次提交
    • A
      tests: rename _fixtures/vendor to _fixtures/internal · 73d636f7
      aarzilli 提交于
      Some tests used a fake vendor directory placed inside _fixtures to
      import some support packages.
      In go.mod mode vendor directory are only supported on the root of the
      project, which breaks some of our tests.
      Since vendor directories outside the root of the project are so rare
      anyway it's possible that a future version of go will stop supporting
      it even in GOPATH mode.
      Also it was weird and unnecessary in the first place anyawy.
      73d636f7
  18. 16 10月, 2018 2 次提交
  19. 12 10月, 2018 1 次提交
    • A
      proc: support position independent executables (PIE) · 74c98bc9
      aarzilli 提交于
      Support for position independent executables (PIE) on the native linux
      backend, the gdbserver backend on linux and the core backend.
      Also implemented in the windows native backend, but it can't be tested
      because go doesn't support PIE on windows yet.
      74c98bc9
  20. 28 9月, 2018 1 次提交
  21. 26 9月, 2018 1 次提交
    • A
      proc: implement conversion of integers to string · 50419b61
      aarzilli 提交于
      Go allows converting a single integer value to string, resulting in a
      string containing a single unicode rune with the same code as the value
      of the integer.
      Allow the same conversion to happen.
      
      Fixes #1322
      50419b61
  22. 30 8月, 2018 1 次提交
    • A
      proc: fix type of some struct global variables · 0461af83
      aarzilli 提交于
      Normally variables that have a named struct as a type will get a
      typedef entry as their type, sometimes however the Go linker will
      decide to use the DW_TAG_structure_type entry instead.
      
      For consistency always wrap a struct type into a typedef when we are
      creating a new variables (see comment in newVariable for exceptions).
      
      This fixes a bug where it would be impossible to call methods on a
      global variable.
      0461af83
  23. 17 8月, 2018 3 次提交
  24. 16 8月, 2018 2 次提交
    • A
      proc: use (*Variable).setValue in fncall · 9335c540
      aarzilli 提交于
      9335c540
    • A
      proc: change (*Variable).setValue for use in CallFunction · 12a3f8bb
      aarzilli 提交于
      Changes (*Variable).setValue so that it can be used in CallFunction to
      set up the argument frame for the function call, adding the ability to:
      - nil nillable types
      - set strings to the empty string
      - copy from one structure to another (including strings and slices)
      - convert any interface type to interface{}
      - convert pointer shaped types (map, chan, pointers, and structs
        consisting of a single pointer field) to interface{}
      
      This covers all cases where an assignment statement can be evaluated
      without allocating memory or calling functions in the target process.
      12a3f8bb
  25. 14 7月, 2018 1 次提交
  26. 15 6月, 2018 1 次提交
    • A
      proc: allow "package/path".varname syntax · 2a2d1040
      aarzilli 提交于
      If the application being debugged imports two packages with the same
      name (but different paths) there was no way to disambiguate the two,
      since the character '/' can not appear inside a go identifier.
      
      By allowing users to use a string literal as the package name a package
      path can be specified.
      2a2d1040
  27. 19 5月, 2018 1 次提交
    • A
      proc/native,proc/gdbserial: let target access terminal · cc86bde5
      aarzilli 提交于
      Change the linux verison of proc/native and proc/gdbserial (with
      debugserver) so that they let the target process use the terminal when
      delve is launched in headless mode.
      
      Windows already worked, proc/gdbserial (with rr) already worked.
      I couldn't find a way to make proc/gdbserial (with lldb-server) work.
      
      No tests are added because I can't think of a way to test for
      foregroundness of a process.
      
      Fixes #65
      cc86bde5
  28. 14 4月, 2018 1 次提交
  29. 11 4月, 2018 1 次提交
  30. 21 3月, 2018 1 次提交
  31. 07 3月, 2018 1 次提交
    • A
      proc: remove proc.Process.Halt · e47599d0
      aarzilli 提交于
      The proper way to stop a running process is to call RequestManualStop,
      which most code already did with the exception of some old test code.
      e47599d0
  32. 14 2月, 2018 1 次提交
    • A
      dwarf/reader,proc: support DW_AT_abstract_origin (#1111) · 0c40a8f5
      Alessandro Arzilli 提交于
      debug_info entries can use DW_AT_abstract_origin to inherit the
      attributes of another entry, supporting this attribute is necessary to
      support DW_TAG_inlined_subroutine.
      
      Go, starting with 1.10, emits DW_TAG_inlined_subroutine entries when
      inlining is enabled.
      0c40a8f5
  33. 19 1月, 2018 1 次提交