Blog

Archive for 2008

GDB and Understand

Tuesday, December 30th, 2008

About 1/2 our engineers program on Linux. A couple use the Mac. And the rest use Windows.

On Linux and the Mac it is quite common to have command line GDB session in use for debugging and to need to inspect or walk a call stack from the “where” command.  It is a bit of a pain to have these separated from Understand. And we may (if we can figure out the Windows side) add debugging support directly into Understand, but until here is a tip that makes working with GDB a bit easier.

With B465 you paste any text into a command result window (get one by choosing “Options->Run a command”).  Once pasted, we analyze it for file, line and entity names and it becomes clickable for Understand events and menus.

Here is a GDB call stack pasted in:

 Gdb_

Files and lines are identified so I can visit them in Understand, or right click and get information and graphs.

Also, with B465 we have made file detection much smarter. It will recognize short, relative and full path names and associate line numbers with them in any fashion a compiler or other tool can think to spit them out.

 

Yes! Searching in Graphs

Tuesday, December 30th, 2008

Searching in graphs has been on my Understand wish list since we first added graphs – 10 years ago!

So I’m quite happy to report that Understand 2.0 Build 466 has searching in graphs. To search in a graph just hit the binocular button and enter in the search text. It is incremental. As you type, it matches. Hit return to move to the next, or use the green arrows. The graph will center to the next match. Searches will find on node labels and edge labels (if the graph has them).

Here I search a large call tree for “inflate”:

31 2008-12-30 13.51

 

Tip – Beautify your code

Thursday, November 6th, 2008

Your code is beautiful, formatted to your liking and spaced just how you want it, but sometimes you have to work with other people’s code – yuck! If only there was something that would make it look like your code, instead of spaghetti. Artistic Style, or astyle as it is also known, is a great open source application that does exactly that.

So you can quickly turn this:

image

Into this:

image

We plan on implementing astyle into the editor at some point in the future, but I’m not so patient, and I decided to use our plugin mechanism to do it now, and will show you how.

(more…)

Site Licenses are available

Wednesday, November 5th, 2008

I was just doing technical support for one of our site license customers. It occurred to me that many folks don’t know that is an option. Doing a site license has these benefits:

  • quite low unit pricing
  • easy availability of Understand to when engineers move in and out of projects
  • much easier licensing (no license manager, it just works on your IP ranges or domains)

If your site might be interested just contact Sue or Kevin at sales@scitools.com to learn cost and technical options.

Word Clouds?

Friday, October 24th, 2008

We are always on the lookout for new ways to represent source code. Word Clouds caught my fancy.

Here is one of our own source code showing the top 50 most complex functions in source tree.

clip_image002

We thought doing Classes by lines of code, Classes by Sum Complexity and Architectures by the same might also be interesting.

Q: Worth adding to Understand?

BTW: The Cloud was generated by Wordle.net.  We wrote a script that generates output that can be pasted into its text box.   I’ve attached it in case you want to try it on your own code.
File Attachment: wordart.pl.zip

Tip – Understand the CountPath Metric

Tuesday, October 21st, 2008

So imagine you’re reviewing metrics for a small function:

  61 lines of code, pretty small, keeping functionality nice and modular. Good.

  Cyclomatic complexity of 30. Highly complex, but within the acceptable range. Good.

  CountPath metric 536,870,912. What is this? 536 Million paths in 61 lines of code, that can’t be right, can it?!?

(more…)

Tip – Automated Metrics

Monday, October 13th, 2008

Several people have asked me lately about automating metrics with Understand 2.0. There are two quick ways to automate metrics, as a scheduled activity and via the command line:

(more…)

Tip – Finding unused functions in a specific class

Tuesday, September 30th, 2008

I was walking down to the kitchen to get my afternoon cookie and I met another of our engineers. He asked “hey, how would I use Understand to clean up a class of functions that are no longer used?”. I thought for a bit and said “piece of cake”.

In short…. use the entity filter window to filter on “unused functions”, turn entity->long names on, then type in the name of the class. Done. 

Here are the steps….  First select the “Unused Functions” filter in the Entity Filter window:

2008-09-30 16.36

(more…)

Understand 2.0 New Feature: Editor Macros

Thursday, September 18th, 2008

We are busy internationalizing important messages in Understand 2.0 so that they can be translated into Japanese. This involves a lot of changes that are identical. For instance, all translatable strings have to be turned into functions that go through a translation function “tr()” that will table lookup the string to the corresponding Japanese translation.

So take for instance this section of code:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := “Four score and seven years ago our fathers brought forth,” & EOL &
        “upon this continent, a new nation, conceived in liberty,” & EOL &
        “and dedicated to the proposition that `all men are created equal’.”;

I’ve got to make it look like this:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := tr(“Four score and seven years ago our fathers brought forth,”) & EOL &
        tr(“upon this continent, a new nation, conceived in liberty,”) & EOL &
        tr(“and dedicated to the proposition that `all men are created equal’.”);

Fortunately, Understand 2.0 can record editor macros that make repeated tasks easy and possibly fun.

Here is how…

(more…)

Understand 2.0: Favorites

Thursday, September 18th, 2008

Understand 2.0 Favorites lets you organize locations (file/line#) or entities (e.g function foo, file foo.cpp) into a named folders.

Favorites can be “project favorites”, where they are only applicable to the .udb file open when you made them, or “all project favorites”, which are available no matter what project you have loaded.  The “All Projects” variety is useful to me since I have dozens of projects of largely the same source that I use for different testing/evaluation purposes.

Favorites are shown in the “Favorites” window, which you can show by clicking on the 2008-09-18 13.55 toolbar (or by Windows->Favorites).

I have my favorites organized into three folders:

2008-09-18 13.56

I give a lot of web and in-person demos of Understand, “Good Demos” is where I store classes, functions, and files that help me simply explain the kinds of things Understand does. For instance, here I have classes and functions and a “butterfly” view with the [x] Sync box checked. In a demo, I can just click on the favorite and see the graph update auto-magically.

2008-09-18 14.04

“Interfaces” provides a handy spot to stash a quick way to see the API’s we often work against here. For instance, the “Understand database API (udb)” or “Change API”.  If I need to know the UDB API details, I just click on it and up comes the source:

2008-09-18 14.07

“ToDo” stores places I want to take a peek at again later. Often this is when I find a spot, or a user reports a spot, where a  crash or bug can be replicated.  It is empty now, but let’s pretend I want to come back and look at a spot here in the UDB interface.

First I just click in the editor where I want to remember. Then pull down the Favorites toolbar menu:

2008-09-18 14.09

It asks me to place the favorite, and I specify “All Projects” and put it inside “ToDo”:

2008-09-18 14.10

It is now in my Favorites and I can visit it just by double clicking on it:

14 2008-09-18 14.11