This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

finding recursive calls

Has anyone written a tool to help track down recursive function calls? I'm sure many of us have seen the dreaded C51 linker warning above recursive calls.

My problem: I just spent 30 minutes sifting through someone elses code trying to find the actual culprit that produced the recursive call linker warning (no function pointers in the code, so I was pretty sure the warning was real). It turned out to be about 4 or 5 function calls deep pass the function it warned about. Not a difficult task to do by hand, but....

I'm sure that the map file can be used to create a call tree, but I believe you'd have to create the call tree manually. It seems that that it wouldn't be that difficult to write a program that will parse the map file and tell you all the functions involved in a specified recursively called function. If it doesn't exist, maybe I'll be bored enough to actually write it someday :)

-nelson

  • What about the call/caller trees in the uVision Browser?

    There are plenty of "reverse engineering" tools on the market which will "map" your code - I think StarBase (formerly Premia, the makers of CodeWright) do one?

  • Source Browser in uVision2 have a bug:
    - when select function in Left window,
    and switch to "Call Graph" mode,
    then in Right window instead
    of full "call tree" only last
    sub-tree for each function displayed.

    This is for Keil C51 v6.12 (uVision v2.12),
    but I think the same problem in v6.14.

    Who know about C51 v6.14 (uVision2 v2.14) ?


  • Yes, I think you're right. :-(

    Can you get your code to compile in MSVC, and use the Browser there?

    What about the "call trees" shown in the Linker's Overlay Map in the mapfile?

  • What about the call/caller trees in the uVision Browser?

    I'm still using uVision 1.32, and probably won't be switching soon (legacy code work). I didn't think uV2 would have that feature, so I forgot to mention what version I was using.

    There are plenty of "reverse engineering" tools on the market which will "map" your code - I think StarBase (formerly Premia, the makers of CodeWright) do one?

    Hmmmm... maybe one of the many CodeWright features I still have to learn? I just started using CodeWright about 2 or 3 weeks ago, and still have lots to learn.

  • >Can you get your code to compile in MSVC, and use the Browser there?

    Yes, MSVC Browser show call tree,
    and recursion looks like:

    test_1()
      |--test_2()
            |-- test_1()
                  |-- test_2()
                       etc...
    


    >What about the "call trees" shown in
    >the Linker's Overlay Map in the mapfile?

    Yes, it work.
    But this is not the same as "visual tree", user forced to study linear represantation of tree.

    I think, Keil can:
    - fix a bug in Source Browser
    - add some features to print call tree
    - add some features for easy navigating via call tree

    and all be Ok.