Sponsored Content
Top Forums Programming A program to trace execution of another program Post 302197971 by jiten_hegde on Thursday 22nd of May 2008 03:13:51 AM
Old 05-22-2008
A program to trace execution of another program

Hi,

I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally.

If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx.
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

get stack trace from C program on Solaris 8

I'm on solaris 8. I need to check the stack trace inside my C program. I don't have printstack or walkstack. I tested getcontext and it works. But how do I get the symbols from "stack_t" ? Help please. Many thanks! (4 Replies)
Discussion started by: rydahl
4 Replies

2. Programming

execution small C++ program in UNIX

Hi my friends I am beginner unix programmer I have written small c++ program in text editor and I have change it mode to 555 to make it executable file to use it in unix O.P. #include<iostream.h> main() { cout<<"Hello World"; } but some syntax erroe came for << can any one help... (5 Replies)
Discussion started by: bintaleb
5 Replies

3. Linux

unix command for multifile program execution

how can I compile and execute multifile program in unix os.:o (0 Replies)
Discussion started by: alokmishra8
0 Replies

4. UNIX for Dummies Questions & Answers

multifile c program compilation and execution

i am using unix os and my program is divided in two text files .:):) how to compile and make one executable file, using unix command. (1 Reply)
Discussion started by: alokmishra8
1 Replies

5. Solaris

Program execution order like FIFO queue

Hi all: I have a problem with a C++ service runing on solaris 10. This service only set a signal on oracle table. When the service detect a cut off on the line (tcp/ip), trigger a cobol program for set the signal OFF. When the line is on again, the service trigger the same cobol program for set... (0 Replies)
Discussion started by: hcastellani
0 Replies

6. Programming

Debugging Program during execution

I have made use of 'valgrind' and -finstrument-functions compiler option for debugging / analyzing code. Both the options lets us know the line / file being executed to some extent. Is there a generic way that lets program dump the file:line it is getting executed dumped to a log file during... (3 Replies)
Discussion started by: uunniixx
3 Replies

7. Programming

popen hangs program during cmd execution

How can I get around this? when my program reaches the following popen job it halts the program until the ping/netstat/ipconfig/traceroute is completed then resume to the rest of the program... FILE *in; extern FILE *popen(); char buff; char newline; char nstat; char nping; ... (5 Replies)
Discussion started by: Jess83
5 Replies

8. Programming

i want trace the c program flow in unix

In windows there is separate environment for c language. and we can able to trace the program. but how can i trace c program flow in unix :confused: (1 Reply)
Discussion started by: prakash.tau
1 Replies

9. Programming

Help with C++ program execution.

//Find the root of the equation (x^2)-2 by bisection method. #include<iostream> using namespace std; double a,x; double f(double x) { return ((x*x)-2); } //Suppose the function is (x*x)-2. void calcx(double a1,double b1) { x =... (2 Replies)
Discussion started by: poonam.gaigole
2 Replies

10. Shell Programming and Scripting

Execution of compressed program

I need UNIX scripts for polling, Uncompressing files and moving files between directory. Also trying to save file paths and any other variables in an independent file (.env) and use these at runtime by executing this file in the main script. (3 Replies)
Discussion started by: new2script
3 Replies
KTRACE(1)						    BSD General Commands Manual 						 KTRACE(1)

NAME
ktrace -- enable kernel process tracing SYNOPSIS
ktrace [-aCcdi] [-f trfile] [-g pgrp | -p pid] [-t trstr] ktrace [-adi] [-f trfile] [-t trstr] command DESCRIPTION
The ktrace command enables kernel trace logging for the specified processes. Kernel trace data is logged to the file ktrace.out. The kernel operations that are traced include system calls, namei translations, signal processing, and I/O. Once tracing is enabled on a process, trace data will be logged until either the process exits or the trace point is cleared. A traced process can generate enormous amounts of log data quickly; It is strongly suggested that users memorize how to disable tracing before attempting to trace a process. The following command is sufficient to disable tracing on all user owned processes, and, if executed by root, all processes: $ ktrace -C The trace file is not human readable; use kdump(1) to decode it. The options are as follows: -a Append to the trace file instead of recreating it. -C Disable tracing on all user owned processes, and, if executed by root, all processes in the system. -c Clear the trace points associated with the specified file or processes. -d Descendants; perform the operation for all current children of the designated processes. -f file Log trace records to file instead of ktrace.out. -g pgid Enable (disable) tracing on all processes in the process group (only one -g flag is permitted). -i Inherit; pass the trace flags to all future children of the designated processes. -p pid Enable (disable) tracing on the indicated process id (only one -p flag is permitted). -t trstr The string argument represents the kernel trace points, one per letter. The following table equates the letters with the trace- points: c trace system calls n trace namei translations i trace I/O s trace signal processing u userland traces w context switches command Execute command with the specified trace flags. The -p, -g, and command options are mutually exclusive. EXAMPLES
# trace all kernel operations of process id 34 $ ktrace -p 34 # trace all kernel operations of processes in process group 15 and # pass the trace flags to all current and future children $ ktrace -idg 15 # disable all tracing of process 65 $ ktrace -cp 65 # disable tracing signals on process 70 and all current children $ ktrace -t s -cdp 70 # enable tracing of I/O on process 67 $ ktrace -ti -p 67 # run the command "w", tracing only system calls $ ktrace -tc w # disable all tracing to the file "tracedata" $ ktrace -c -f tracedata # disable tracing of all processes owned by the user $ ktrace -C SEE ALSO
kdump(1) BUGS
Only works if file is a regular file. HISTORY
The ktrace command appeared in 4.4BSD. BSD
June 6, 1993 BSD
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy