DBX script to print stack trace seen at breakpoint

  • Follow


Hi,

I have set a number of breakpoints at different points in my code and
want to print the stack trace everytime a breakpoint is hit.

I am trying to write a DBX KSH script that does this but I am not sure
how to stop the function. I source the script inside DBX and call the
function "collect_stack_trace" and it should run the program, save the
stack trace at each breakpoint, continue and then stop.

My problem is to find the end of the run. Currently I have it looking
if the stack size is 0 to denote that end-of-program has been reached.
But I am getting an infinite loop.

function collect_stack_trace
{
       # run the program
        run

        # declare the 'stack_size' integer
        typeset -i stack_size

        # initialize it to the size of the stack trace
        # seen after hitting the first breakpoint.
        stack_size=$(where |/bin/wc -l)

        # loop until there is no stack
        while [ ${stack_size} -gt 0 ] ; do

                # save the stack trace to a file 'output'
                where >> output
                echo " " >> ${TEST_CASE}.output

                # continue the execution
                cont

               # check if we have reached the end of program
              # execution by finding the stack size
                stack_size=$(where |/bin/wc -l)

        done
        exit
}

I am using Forte 11 compiler suite on Solaris 10.

Any suggestions?

Regards
John
0
Reply freesoft12 (20) 3/24/2009 10:21:49 PM


0 Replies
503 Views

(page loaded in 0.028 seconds)

Similiar Articles:













7/24/2012 11:22:45 AM


Reply: