1. 14 2月, 2020 1 次提交
    • C
      pkg,service: add cmd `examinemem`(`x`) for examining memory. (#1814) · a5d9dbee
      chainhelen 提交于
      According to #1800 #1584 #1038, `dlv` should enable the user to dive into
      memory. User can print binary data in specific memory address range.
      But not support for sepecific variable name or structures temporarily.(Because
      I have no idea that modify `print` command.)
      
      Close #1584.
      a5d9dbee
  2. 13 2月, 2020 1 次提交
    • A
      proc: only format registers value when it's necessary (#1860) · b9d0ddd8
      Alessandro Arzilli 提交于
      A significant amount of time is spent generating the string
      representation for the proc.Registers object of each thread, since this
      field is rarely used (only when the Registers API is called) it should
      be generated on demand.
      
      Also by changing the internal representation of proc.Register to be
      closer to that of op.DwarfRegister it will help us implement #1838
      (when Delve will need to be able to display the registers of an
      internal frame, which we currently represent using op.DwarfRegister
      objects).
      
      Benchmark before:
      
      BenchmarkConditionalBreakpoints-4   	       1	22292554301 ns/op
      
      Benchmark after:
      
      BenchmarkConditionalBreakpoints-4   	       1	17326345671 ns/op
      
      Reduces conditional breakpoint latency from 2.2ms to 1.7ms.
      
      Updates #1549, #1838
      b9d0ddd8
  3. 22 1月, 2020 2 次提交
  4. 10 1月, 2020 1 次提交
    • A
      proc,service: return build informations for each package · a8606afb
      aarzilli 提交于
      Adds an API call that returns a list of packages contained in the
      program and the files that were used to build them, and also a best
      guess at which filesystem directory contained the package when it was
      built.
      
      This can be used by IDEs to map file paths if the debugging environment
      doesn't match the build environment exactly.
      a8606afb
  5. 05 11月, 2019 1 次提交
  6. 02 11月, 2019 1 次提交
    • A
      proc,debugger: implement logical breakpoints (#1717) · 222deeec
      Alessandro Arzilli 提交于
      Modifies FindFileLocation, FindFunctionLocation and LineToPC as well as
      service/debugger to support inlining and introduces the concept of
      logical breakpoints.
      
      For inlined functions FindFileLocation, FindFunctionLocation and
      LineToPC will now return one PC address for each inlining and one PC
      for the concrete implementation of the function (if present).
      
      A proc.Breakpoint will continue to represent a physical breakpoint, at
      a single memory location.
      
      Breakpoints returned by service/debugger, however, will represent
      logical breakpoints and may be associated with multiple memory
      locations and, therefore, multiple proc.Breakpoints.
      
      The necessary logic is introduced in service/debugger so that a change
      to a logical breakpoint will be mirrored to all its physical
      breakpoints and physical breakpoints are aggregated into a single
      logical breakpoint when returned.
      222deeec
  7. 23 10月, 2019 1 次提交
  8. 26 9月, 2019 1 次提交
  9. 28 7月, 2019 1 次提交
  10. 17 7月, 2019 1 次提交
  11. 09 7月, 2019 1 次提交
  12. 01 7月, 2019 1 次提交
    • 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
  13. 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
  14. 30 3月, 2019 1 次提交
  15. 28 3月, 2019 1 次提交
  16. 21 3月, 2019 1 次提交
  17. 27 2月, 2019 1 次提交
  18. 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
  19. 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
  20. 20 10月, 2018 1 次提交
    • D
      *: Show return values on CLI trace · 3129aa73
      Derek Parker 提交于
      This patch allows the `trace` CLI subcommand to display return values of
      a function. Additionally, it will also display information on where the
      function exited, which could also be helpful in determining the path
      taken during function execution.
      
      Fixes #388
      3129aa73
  21. 16 10月, 2018 2 次提交
  22. 25 9月, 2018 1 次提交
  23. 20 9月, 2018 1 次提交
  24. 31 8月, 2018 1 次提交
    • A
      proc,service,terminal: information about stack trace truncation · ac74944d
      aarzilli 提交于
      Add a flag to Stackframe that indicates where the stack frame is the
      bottom-most frame of the stack. This allows clients to know whether the
      stack trace terminated normally or if it was truncated because the
      maximum depth was reached.
      Add a truncation message to the 'stack' command.
      ac74944d
  25. 25 7月, 2018 1 次提交
    • A
      proc,service,terminal: read defer list · 8f1fc63d
      aarzilli 提交于
      Adds -defer flag to the stack command that decorates the stack traces
      by associating each stack frame with its deferred calls.
      
      Reworks proc.next to use this feature instead of using proc.DeferPC,
      laying the groundwork to implement #1240.
      8f1fc63d
  26. 14 7月, 2018 1 次提交
  27. 10 7月, 2018 1 次提交
  28. 29 6月, 2018 1 次提交
  29. 27 6月, 2018 1 次提交
    • A
      proc,terminal,service: let headless instances run without connected clients · 9a216211
      aarzilli 提交于
      This pull request makes several changes to delve to allow headless
      instancess that are started with the --accept-multiclient flag to
      keep running even if there is no connected client. Specifically:
      
      1. Makes a headless instance started with --accept-multiclient quit
          after one of the clients sends a Detach request (previously they
          would never ever quit, which was a bug).
      2. Changes proc/gdbserial and proc/native so that they mark the
          Process as exited after they detach, even if they did not kill the
          process during detach. This prevents bugs such as #1231 where we
          attempt to manipulate a target process after we detached from it.
      3. On non --accept-multiclient instances do not kill the target
          process unless we started it or the client specifically requests
          it (previously if the client did not Detach before closing the
          connection we would kill the target process unconditionally)
      4. Add a -c option to the quit command that detaches from the
          headless server after restarting the target.
      5. Change terminal so that, when attached to --accept-multiclient,
          pressing ^C will prompt the user to either disconnect from the
          server or pause the target process. Also extend the exit prompt to
          ask if the user wants to keep the headless server running.
      
      Implements #245, #952, #1159, #1231
      9a216211
  30. 12 6月, 2018 1 次提交
    • A
      proc,service: display return values when stepping out of a function · 60c58acb
      aarzilli 提交于
      Displays the return values of the current function when we step out of
      it after executing a step, next or stepout command.
      
      Implementation of this feature is tricky: when the function has
      returned the return variables are not in scope anymore. Implementing
      this feature requires evaluating variables that are out of scope, using
      a stack frame that doesn't exist anymore.
      
      We can't calculate the address of these variables when the
      next/step/stepout command is initiated either, because between that
      point and the time where the stepout breakpoint is actually hit the
      goroutine stack could grow and be moved to a different memory address.
      60c58acb
  31. 24 4月, 2018 1 次提交
  32. 20 3月, 2018 1 次提交
  33. 19 1月, 2018 1 次提交
  34. 21 12月, 2017 1 次提交
  35. 14 12月, 2017 2 次提交
  36. 08 12月, 2017 1 次提交