Search the symbol table of a child process


 
Thread Tools Search this Thread
Top Forums Programming Search the symbol table of a child process
# 8  
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..
# 9  
Old 04-24-2019
Well, I was hoping, I could cook up something simple. Apparently UNIX is a bigger monster, than I expected. I wish everything was as simple as AmigaOS. But that's off topic.

Anyway, I guess the thread is closed...?
# 10  
Old 04-24-2019
We don't even know your goal, architecture, or programming language here. Your question hasn't come across very far. Ask vague questions, get vague answers.

What is your goal? Don't say "to look up a symbol table". Why are you looking up symbols? That sounds like something the debugger would do in any OS, the OS not being one giant do-everything program. You might be asking how to use the GNU debugger. Maybe. Explain further and we'll maybe figure out what you need.
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 04-24-2019
Well, essentially I wanted to expand my debugger for AmigaOS to work on other platforms. I could do just a libgdb wrapper, but I thought it would be more interesting to do it manually and figure out, how these things work on other OS'es. Which means mainly linux at the time.

Obviously I got stuck just trying to find the address of a simple symbol. I came across this: GitHub - TartanLlama/minidbg: A mini x86 linux debugger for teaching purposes But he has the same problem: There is no symbol relocation done, so he doesn't know the actual placement of the symbols in the executable.

I am going to look into if shared memory of the /proc handler can help me. If not, I am probably going to do some libgdb wrapper for my app and focus on getting that to work and other platforms.
# 12  
Old 04-24-2019
You can access raw memory contents that way, but /proc/ won't tell you a thing about the symbols in it, just what address space the process owns.

Shared libraries and symbol lookup have changed a lot in Linux due to 64-bit growing pains and modern security concerns; Linux mutates very fast. They've gone through several models. Best to use GDB.
This User Gave Thanks to Corona688 For This Post:
# 13  
Old 04-27-2019
Ok. Maybe I'll dig in just a bit to see, how much I can learn. I very much doubt, that my project would have any large impact anyway, so if I can just use it for leverage to some kind of understanding, then that is probably good. Thanks for the pointers, I am still scratching the surface, but it is very interesting indeed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question