Contents

Legal Notices

Chapter 1:
  Quick Start


Chapter 2:
  Introduction and Installation


Chapter 3:
  Startup Options


Chapter 4:
  Viewing Trace Files


Chapter 5:
  Tips and Techniques


Chapter 6:
  Troubleshooting


Chapter 7:
  Obtaining Support


Chapter 5:  Tips and Techniques

Daemons and other background programs
Performance Issues

Daemons and other background programs

Normally starting a program under ZFtrace is quite simple: just insert the zftr command in front of the normal command line for the program.  However, using ZFtrace with daemon programs (e.g. those started by init or inetd) and other programs that are not started from the shell requires using one of the following methods:
  • One method is to use the -e flag to cause ZFtrace to debug any programs that are loaded using the exec system call. This allows you to run the main program under ZFtrace, and also debug any children that the main process executes.

  • The other method is to create a shell script wrapper that invokes ZFtrace on the target process. The first step is to rename the real program:
      $ mv myprog myprog.real
    
    Then create the shell script that takes its place and calls ZFtrace on the original program:
      $ cat > myprog <<\EOF
      #!/bin/ksh
      exec zftr myprog.real "$@"
      EOF
      $ chmod +x myprog
    
    Of course you may choose to insert arguments to ZFtrace after the zftr command. Now, whenever myprog gets executed it actually executes ZFtrace on the real myprog program.

Performance Issues

Programs typically run somewhat slower under ZFtrace than natively. The following steps may improve performance:
  • Only compile with debugging information (the -g compiler flag) those modules that are important for debugging. The symbol information that the compiler generates can take a lot of memory, especially in C++ modules. Similarly, always optimize code that will not figure prominently in your debugging efforts. It may be much easier to rebuild specific object modules without optimization than to suffer the performance impact of running large amounts of unoptimized code.
  • Only have one instantiation of ZFtrace running at a time on a given system. Since the emulator may use a substantial amount of paging space and CPU, having multiple instances running at the same time can degrade system performance. This particularly comes into play when a process forks many children, each of which becomes a separate emulated process.



© Copyright 2004 The ZeroFault Group, LLC. All rights reserved. All logos and trademarks are property of their respective owners.