Stack Traces

So I havent blogged about what I am working on for a while. Here is a quick summary and status:

I have moved from working on the frysk gui to working on frysk core. I enjoy working on the gui very much but change and learning new things is always great.

Back when I started on this assignment Frysk provided what we refer to as an abi stack back trace. Which is a stack frames, their addresses, and corresponding symbols (if they are still available in the executable). My assignment was and is using an executables debug info to enrich this model and provide more information.

Each abi frame corresponds to a Subprogram; a concrete (not inlined) function call. Each Subprogram has parameters, and variables. Actually wait, a Scope has variables, and a Subprogram is a Scope. Any Scope can intern own other Scopes and so on.

So I started working on creating the data structure described above writing test cases etc and in todays frysk you have access to all this information.

Given a stopped Task (thread) a client of this api can do the following:


public void examineStack(Task task){
  Frame frame = StackFactory.createFrame(task);Subprogram subprogram = frame.getSubprogram();
  System.out.println("function name: " + subprogram.getName());

  LinkedList parameters = subprogram.getParameters();
  System.out.println("this function has " + parameters.size() + " paramters");

  Variable variable = (Variable) parameters.getFirst();
  System.out.println("The first paramters is " + variable.getVariable().getText());
  System.out.println("In the current frame it has a value of " + variable.getValue(frame));

  LinkedList variables = subprogram.getVariables();
  System.out.println("The function has " + variables.size() + " variables ");

  variable = (Variable) variables.getFirst();
  System.out.println("The first variable is " + variable.getVariable().getText());
  System.out.println("In the current frame it has the value of " + variable.getValue(frame));

}

You will notice of course that I have avoided inlined functions. The way we have chosen to handle them is very interesting imho, and is the topic of the next blog post.

Ps. formatting code in wordpress is a pain.

Advertisement

One Response to “Stack Traces”

  1. Mark Wielaard Says:

    For formatting code in wordpress there is http://www.thunderguy.com/semicolon/wordpress/code-markup-wordpress-plugin/ which allows you to easily put in formatted code snippets. But you loose the visual editor support in that case.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.