Sponsored Content
Top Forums Programming Search the symbol table of a child process Post 303034396 by jim mcnamara on Wednesday 24th of April 2019 12:45:23 PM
Old 04-24-2019
If you need a direct read from a symbol table, use shared memory. The reader is the parent. The child has to do some minimal work. No worK? The Corona's approach is all there is left. If your UNIX supports the /proc filesystem then you can get information from there because it exposes process kernel memory - depending on what you want, which you did not specify.

proc(5) - Linux manual page

Even better - consider the ptrace system call: ptrace(2) - Linux manual page
You can directly read child process memory.

Last edited by jim mcnamara; 04-24-2019 at 01:53 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

no symbol table

Hi@all, I try to compile c code on hpux 11.11 pa-risc 2 with gcc (32bit). I compile with the option -g, so that I get the symbol table, but it is not available. Does someone knows something on this? thx (2 Replies)
Discussion started by: Dom_Cyrus
2 Replies

2. Programming

how to view symbol table in unix

hi , How to view the contents of a "c" program symbol table information in unix. (1 Reply)
Discussion started by: saravanan_nitt
1 Replies

3. Linux

Reading ELF file Symbol table of C++ program

Folks, I have some program(Test.cpp) as follows, #include<iostream> class Abc { private: int _theVar; public : int printVar(); }; int Abc :: printVar() { _theVar=10; } main() { Abc _t; (0 Replies)
Discussion started by: vinod_chitrali
0 Replies

4. Programming

Reading ELF file Symbol table of C++ program

Folks, I have some program(Test.cpp) as follows, #include<iostream> class Abc { private: int _theVar; public : int printVar(); }; int Abc :: printVar() { _theVar=10; } main() { Abc _t; (2 Replies)
Discussion started by: vinod_chitrali
2 Replies

5. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

6. Programming

Symbol table of a C program

Hi, is there any command to see symbol table info. will it show where its allocating memory for varibales golbals & locals and code.(i mean the segments). i read there is a section called read only data segment and this is where initialized data such as strings stores. i have wriiten the... (7 Replies)
Discussion started by: MrUser
7 Replies

7. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

8. Shell Programming and Scripting

script to get child process for a process

!/bin/sh pid=$(ps -Aj | grep MSTRSvr | grep -v grep | awk '{print $1}') sid=$(ps -Aj | grep MSTRSvr | grep -v grep | awk '{print $3}') ps -s "$sid" I am not able to get the desired output it says process list error if i use watch ps -s "$sid" it considers only the first session id (5 Replies)
Discussion started by: schippada
5 Replies

9. Emergency UNIX and Linux Support

signal between parent process and child process

Hello, everyone. Here's a program: pid_t pid = fork(); if (0 == pid) // child process { execvp ...; } I send a signal (such as SIGINT) to the parent process, the child process receive the signal as well as the parent process. However I don't want to child process to receive the... (7 Replies)
Discussion started by: jackliang
7 Replies

10. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies
ptrace(3C)                                                 Standard C Library Functions                                                 ptrace(3C)

NAME
ptrace - allows a parent process to control the execution of a child process SYNOPSIS
#include <unistd.h> #include <sys/types.h> int ptrace(int request, pid_t pid, int addr, int data); DESCRIPTION
The ptrace() function allows a parent process to control the execution of a child process. Its primary use is for the implementation of breakpoint debugging. The child process behaves normally until it encounters a signal (see signal.h(3HEAD)), at which time it enters a stopped state and its parent is notified by the wait(3C) function. When the child is in the stopped state, its parent can examine and mod- ify its "core image" using ptrace(). Also, the parent can cause the child either to terminate or continue, with the possibility of ignoring the signal that caused it to stop. The request argument determines the action to be taken by ptrace() and is one of the following: 0 This request must be issued by the child process if it is to be traced by its parent. It turns on the child's trace flag that stipulates that the child should be left in a stopped state on receipt of a signal rather than the state specified by func (see signal(3C)). The pid, addr, and data arguments are ignored, and a return value is not defined for this request. Peculiar results ensue if the parent does not expect to trace the child. The remainder of the requests can only be used by the parent process. For each, pid is the process ID of the child. The child must be in a stopped state before these requests are made. 1, 2 With these requests, the word at location addr in the address space of the child is returned to the parent process. If instruction and data space are separated, request 1 returns a word from instruction space, and request 2 returns a word from data space. If instruction and data space are not separated, either request 1 or request 2 may be used with equal results. The data argument is ignored. These two requests fail if addr is not the start address of a word, in which case -1 is returned to the parent process and the parent's errno is set to EIO. 3 With this request, the word at location addr in the child's user area in the system's address space (see <sys/user.h>) is returned to the parent process. The data argument is ignored. This request fails if addr is not the start address of a word or is outside the user area, in which case -1 is returned to the parent process and the parent's errno is set to EIO. 4, 5 With these requests, the value given by the data argument is written into the address space of the child at location addr. If instruction and data space are separated, request 4 writes a word into instruction space, and request 5 writes a word into data space. If instruction and data space are not separated, either request 4 or request 5 may be used with equal results. On success, the value written into the address space of the child is returned to the parent. These two requests fail if addr is not the start address of a word. On failure -1 is returned to the parent process and the parent's errno is set to EIO. 6 With this request, a few entries in the child's user area can be written. data gives the value that is to be written and addr is the location of the entry. The few entries that can be written are the general registers and the condition codes of the Processor Status Word. 7 This request causes the child to resume execution. If the data argument is 0, all pending signals including the one that caused the child to stop are canceled before it resumes execution. If the data argument is a valid signal number, the child resumes exe- cution as if it had incurred that signal, and any other pending signals are canceled. The addr argument must be equal to 1 for this request. On success, the value of data is returned to the parent. This request fails if data is not 0 or a valid signal num- ber, in which case -1 is returned to the parent process and the parent's errno is set to EIO. 8 This request causes the child to terminate with the same consequences as exit(2). 9 This request sets the trace bit in the Processor Status Word of the child and then executes the same steps as listed above for request 7. The trace bit causes an interrupt on completion of one machine instruction. This effectively allows single stepping of the child. To forestall possible fraud, ptrace() inhibits the set-user-ID facility on subsequent calls to one of the exec family of functions (see exec(2)). If a traced process calls one of these functions, it stops before executing the first instruction of the new image showing signal SIGTRAP. ERRORS
The ptrace() function will fail if: EIO The request argument is an illegal number. EPERM The calling process does not have appropriate privileges to control the calling process. See proc(4). ESRCH The pid argument identifies a child that does not exist or has not executed a ptrace() call with request 0. USAGE
The ptrace() function is available only with the 32-bit version of libc(3LIB). It is not available with the 64-bit version of this library. The /proc debugging interfaces should be used instead of ptrace(), which provides quite limited debugger support and is itself implemented using the /proc interfaces. There is no actual ptrace() system call in the kernel. See proc(4) for descriptions of the /proc debugging interfaces. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
exec(2), exit(2), libc(3LIB), signal(3C), signal.h(3HEAD), wait(3C), proc(4), attributes(5) SunOS 5.10 22 Mar 2004 ptrace(3C)
All times are GMT -4. The time now is 08:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy