Navigation

Debugger

From Mono

Table of contents

Tutorial

See the Guide:Debugger for the tutorial and debugger reference.

Status

At this point the Mono debugger is highly tied to internals of the Mono VM and the Mono compilers, so you will need to be using fresh SVN checkouts for mono, mcs and the debugger module.

The debugger is available on the "debugger" module of SVN. Other means of debugging Mono applications are described here

At this point, the debugger is fully functional, but it requires extensive user testing and bug reporting to identify the weak points in the debugger - both from the usability and functionality perspectives. Please provide your feedback on Bugzilla.


Feature list

At the Mono [Meeting (http://www.go-mono.com/meeting)], we revised the debugger plans, and started deciding the full set of features that we want in the debugger. The following list describes both implemented and unimplemented features:

Data inspection and manipulation

  • Inspect and change static and instance fields, local variables, and parameters [DONE].
  • Inspect and change captured vars, and compiler-generated code in general [POST 1.0]
  • Watches (also hardware watches) [DONE].
  • Data dump [DONE].

Stack traces

  • Move up-down managed stack frames [DONE]
  • Move up-down unmanaged stack frames [PARTIAL]

Control program execution

  • SingleSteppingEngine (next, nexti, line, step, stepi) [DONE].
  • Debug unmanaged code [LOW PRIORITY].
  • Breakpoints:
    • by line, [DONE]
    • by function, [DONE]
    • for unjitted methods, [DONE]
    • contitional (uses expression evaluation).

Thread support

  • Show threads [DONE].
  • Select-switch threads [DONE].
  • Thread apply [TODO]
  • All threads stop when the prompt is active. [DONE]
  • CTRL-C stops all threads [DONE].

Low level state inspection

  • Disassembly. [DONE]
  • Show regs. [DONE]

Process handling

  • Can follow forks and execs when requested by the user [DONE].
  • Can detach from processes after a fork() [DONE].
  • Can attach to existing Mono processes [DONE].
  • Can examine core dumps generated by Mono processes [DONE].
    • (This hasn't been tested very well and may be buggy; is this a 1.0 item? Martin)

The maintainer for the debugger is [Martin Baulig (mailto:martin@novell.com)].

Plan

At the meeting we also prioritized each feature, and decided the feature set for the "1.0" debugger release:

  • Remove "--args" (just handle remaining args as args)
  • Breaks before run
  • Work on data dump user friendliness:
    • allow formatting as bytes, words, and System types in general [DONE]
  • Commands:
    • print vars
    • describe field
    • describe fields
    • describe object
    • describe class
    • describe static
  • Fix "show location" and "show describe"
  • Show appdomains/threads
  • Debug xsp (no crash with multiple appdomains)
  • Implement "thread apply" (only for backtrace)
  • Implement display and undisplay [DONE]
  • Make all threads stop when the prompt is active
  • Make so that CTRL-C stops all threads

Work on the following features, on the other hand, will be postponed after release 1.0:

  • Properly support unmanaged code.
  • Be able to change frames handling also unmanaged stack frames.
  • Conditional expressions/breakpoints.
  • Autocomplete.
  • Handle compiler-generated code (we mean from the C# compiler, like captured vars).

We also defined a first step (milestone 1) in the road towards 1.0:

  • All tests work.
  • Change thread behavior.
  • Have reset-run tests working:
    • Add these feature tests:
      • show locals on each step, and
      • add expression evaluation on the target.
  • Implement a "stress test":

on "hello-world.exe", "mcs hello-world.cs", "mcs mcs", do

  run
  while (!done) { 
    stop
    show all vars
    examine, describe
    show thread
    disassemble
    switch threads
    run
  }

Also execute "hello-world.exe" with "stepi" and showing all locals at each step.

After milestone 1, all the other features needed for 1.0 will be implemented.

The "acceptance criteria" for the 1.0 release is the following:

  • All 1.0 features are implemented.
  • User documentation is on the wiki

- Also document the debugger-JIT interface (massi).


Bugs

Debugger bug tracking:

  • [Query (http://bugzilla.ximian.com/buglist.cgi?product=Mono%3A+Debugger&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=bugs.bug_id)] [Add (http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%3A+Debugger)]

In addition to the bugs in bugzilla, there are also a couple of outstanding issues I know about:

  • Support for debugging native applications needs to be improved.
  • Improved breakpoint support is on my TODO list for "Dublin".
  • Hardware watchpoints are still experimental.
  • There are some issues with the lifetime of variables.
  • There are a few required API changes before we can start integrating the debugger in MonoDevelop again - this is on my TODO list for "Sidney".


Architecture

The Mono Debugger is made up of a library that provides features to debug applications. Today there is a commmand line debugger, and we hope to re-activate the MonoDevelop debugger sometime soon.