开发者

Need help to draw control-flow graph with GLEE and C# [closed]

开发者 https://www.devze.com 2022-12-10 08:23 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_运维技巧

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

I am trying to draw a control-flow graph(CFG) from source code using the GLEE graph library and C# language. Problem is, I am new to GLEE. I need a tutorial or sample programs/projects to help me get started quickly with GLEE. The source for which I need to draw a CFG has the following structure:

begin myProcedure
  statement 1;
  statement 2;
  if(condition) then
    statement 3;
  else
    statement 4;
  end if
end myProcedure

Any ideas?


Unless you hard-wire the control flow graph into your answer (homework?), the graphing isn't the hard part of this problem. Extracting the control flow graph from the source code of your language is.

Your example is clearly not C# (BEGIN?), so you will need to find a language parser; you will need something to do name and type resolution (to handle GOTOs to labels or exits of named blocks), and construct a flow graph as a graph data structure. If you are processing something like GCC (a C-like language with indirect GOTOs), you'll need pointer analysis to determine possible targets of indirect GOTOs. If you intend to process C#, or Java, you might be able to extract the control from from the class files (having much the same problems) and then you'll have to map that back to the source code.

It is easiest to do such a task if you have a lot of available machinery (parsing, name-resolution, control-flow graph construction library) on which to build your control-flow graph extractor. The DMS Software Reengineering Toolkit provides all these foundations, as well as parsers for many languages. For C, Java and COBOL, DMS also provides the direct extraction of control flow graphs handling all of the above issues and even data flow graphs too. See sample control and data flow graphs.


In order to draw a graph using glee is a quite easy task once you have parsed your source code, for making graph using glee you can follow this simple tutorial :

http://chalaki.com/how-to-program-msagl-glee-to-create-hierarchical-graph-layouts/519/


Looks like you are new to C# as well, given that GLEE hasn't been available for nearly 2 years (having been replaced by MSAGL, a paid product which does come with examples) I think you might find it hard to first, find any examples and second, to get any support. It seems you can get MSAGL for $99 at the moment (down from $295), might be worth the investment for the time saved.


http://research.microsoft.com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx

the download comes with a csharp sample app

0

精彩评论

暂无评论...
验证码 换一张
取 消