Skip to content

Document how to debug C# modules #15

Description

@xobs

Writing C# modules unlocks a lot of functionality in Renode, however it's very difficult to debug these modules.

For example, in this module:

using System;
using Antmicro.Renode.Core;
using Antmicro.Renode.Peripherals.Bus;
using Antmicro.Renode.Time;
using Antmicro.Renode.Logging;
using System.Threading;

namespace Antmicro.Renode.Peripherals.Timers
{
    public class SimpleTicker : IDoubleWordPeripheral
    {
        public SimpleTicker(ulong periodInMs, Machine machine)
        {
            machine.ClockSource.AddClockEntry(new ClockEntry(periodInMs, ClockEntry.FrequencyToRatio(this, 1000), OnTick, this, String.Empty));
        }
       // ...
    }
}

It's difficult to know:

  1. What properties there are on machine
  2. Where Machine is defined (which package does it come from?)
  3. What do each of the parameters in that function mean?
  4. What is a ClockSource and how does it work?
  5. What other properties are there in Antmicro.Renode.Peripherals?
  6. What is the interface required to implement IDoubleWordPeripheral?
  7. Does this even compile?

Many of these questions could be answered by connecting this .cs file to an IDE of some sort. I'm not sure how 2 could be answered, because I gather that's a feature of C#. 7 can only be answered by restarting Renode.

With C# modules being documented, it would also be nice to know how to implement modules and debug issues within them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions