2

As an example of what I need and why I want it, I am trying to determine how a certain value (CurTotal) is getting set (wrongly). I've come up with these notes to myself to try to understand just what is happening:

**CurTotal is declared in frmEntry.SetTotalControlsProperties().

CurTotal gets its value within that method from wrkFile.getAmount(), and txtCurTot is eventually assigned that value.

SetTotalControlsProperties() is called:**

0) From the main (frmCentral) form's openfrmUPC() method
1) From frmEntry's overloaded constructor: public frmEntry(string DSDtablename, string recType, int QOne, int sDesc, int sList)
2) Conditionally from within DoSave(), which is called from btnSave_Click() and PrepareForPrinting()
3) From frmEntry's saveDSD(), which is called from DoSave(), which is called by btnSave_Click and PrepareForPrinting()
4) From frmEntry's saveINV(), which is called from DoSave(), which is called by btnSave_Click and PrepareForPrinting()
5) From frmEntry's btnClear_Click()

So the most "interesting" ones are 0, 2, and 3 (I don't think the observed bogus activity takes place in saveINV(), I'm almost positive it's not in the constructor, and I know it's not in btnclearclick()).

So my head is swimming better than Mark Spitz (or, for you young whippersnappers out there, Michael Phelps) ever dreamed of slicing pell-mell through the chlorinated aqua.

Making matters more malevolent for me, I can't step through this code (Windows CE, running in Windows XP mode, no emulator), except in my waterlogged brain*. So I ask: Is there a tool that visually represents all the potential routes from which SetTotalControlsProperties() is called/CurTotal is set? Best of all would be a tool that provided a listing of just what route the code took to get to a designated spot.

Side question: Why is there no "spaghetti" tag? People got arrested for less than this in communist Russia.

  • Cue (or is it "queue"?) TYA's "Over the Hill" here.

UPDATE

Fresh evidence that there truly is a need for such a tool:

The method that sets the CurTot amount, namely wrkFile.getAmount(), does this:

public double getAmount()
{
    if (tAmount < 0)
    {
        SetTotalItemsAndTotalAmt();
    }
    return tAmount;
}

SetTotalItemsAndTotalAmt() assigns vals based on this query:

string dynSQL = "SELECT * FROM workTables WHERE name = '" + name + "'";

..and "name" here is not passed in to SetTotalItemsAndTotalAmt, nor is it a local var.

Arggghhhhhhhhh!!!

closed as off-topic by Jim G., user53019, user40980, gnat, Bart van Ingen Schenau Sep 1 '13 at 9:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Jim G., Community, Community, gnat, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

  • While not quite what you want you can right click on an item in visual studio and "Find Usages" which will show you where the field / method / class / etc... is used within your solution. – Mike Aug 29 '13 at 23:16
  • Yeah, the Find Sausages is how I figured out who was zooming who. And that was no typo: it IS Find SAusages in this case, because these usages are Super-Annuated. This is VS 2003 and .NET 1.1; the Windows calculator sports the image of an abacus, and Bing maps shows the earth as being flat in this version. – B. Clay Shannon Aug 29 '13 at 23:27
6

So I ask: Is there a tool that visually represents all the potential routes from which SetTotalControlsProperties() is called/CurTotal is set?

It sounds like you're describing the Call Hierarchy feature found in several IDEs, including Visual Studio:

enter image description here

If you can't use an IDE that has this feature, there are separate tools that generate calls graphs.

Best of all would be a tool that provided a listing of just what route the code took to get to a designated spot.

Any good debugger will display a call stack that you can jump around in, which is exactly what you're asking for here.

SetTotalItemsAndTotalAmt() assigns vals based on this query:

string dynSQL = "SELECT * FROM workTables WHERE name = '" + name + "'";

Umm... Little Bobby Tables alert!!!

  • 4
    Love the bobby tables reference. – Mike Aug 29 '13 at 23:54
  • I don't have access to the normal debugging capabilities in this environment (such as Call Stack). All I can do in the IDE is build it (not run it, step through it, etc.). – B. Clay Shannon Aug 29 '13 at 23:57
  • 1
    @Clay Shannon: the call hierarchy feature is based on static code analysis, as are the other call graph generation tools. And you might want to invest some effort into changing the environment so that you can use normal debugging. – Michael Borgwardt Aug 30 '13 at 7:28
  • I have invested quite a bit of effort, as have others over the years with this project. My encouragement to dump it and replace it with a version using newer tools has fallen on deaf ears. – B. Clay Shannon Aug 31 '13 at 13:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.