The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to trace a user salhoub HP-UX 4 08-04-2008 06:05 AM
how to trace the logs vivek_damodaran HP-UX 3 05-13-2008 12:09 PM
Trace DHCP - Help! nuGuy UNIX for Dummies Questions & Answers 0 04-27-2008 01:00 PM
trace route ip ppass IP Networking 2 01-11-2005 11:50 AM
Trace connections jraitsev UNIX for Advanced & Expert Users 8 03-14-2002 06:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-04-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Function Trace

Does anyone know if there is a util out there to run through a shell script and be able to trace the function call tree. I have inherited some code and the original author was ****mad**** keen on functions - even ones called only once!
If anyone knows of anything I would appreciate it - web trawling has not revealed anything yet.
  #2 (permalink)  
Old 10-04-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
You could not do this 100% because a function can be called by name from a variable.

A good clue, however, is that a function has to be defined before it can be called, so if you look through the file in order it should be basically in bottom up order.
  #3 (permalink)  
Old 10-04-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 704
Hi.

You may be able to build something on your own -- see below, among the 300K hits found by Google "bash trap trace" ... cheers, drl
Quote:
# Bash includes the caller builtin, which displays the context of any active subroutine call (a shell function or a script executed with the . or source builtins). This supports the bash debugger.
# The trap builtin (see section 4.1 Bourne Shell Builtins) allows a DEBUG pseudo-signal specification, similar to EXIT. Commands specified with a DEBUG trap are executed before every simple command, for command, case command, select command, every arithmetic for command, and before the first command executes in a shell function. The DEBUG trap is not inherited by shell functions unless the function has been given the trace attribute or the functrace option has been enabled using the shopt builtin. The extdebug shell option has additional effects on the DEBUG trap.

-- excerpt from bash differences
  #4 (permalink)  
Old 10-05-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Ta

Thanks for the pointers

cheers all
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0