execl function at GDB


 
Thread Tools Search this Thread
Top Forums Programming execl function at GDB
# 1  
Old 12-16-2008
execl function at GDB

Hi,
we would appreciate if any one answer the below query.
void main()
{
printf(“ I am in main\n”);
execl(“/HOME/source/file2”,” /HOME/source/file2”,1,0);
printf(“after execl\n”);
}
How to step the file2 source code in GDB.

Last edited by RAMESHPRABUDASS; 12-16-2008 at 09:18 AM..
# 2  
Old 12-18-2008
Maybe you want to add a break point to execl()

in the gdb prompt before running the program do


> break execl


execution should pause at execl function then you can do


> step

or simply

> s
# 3  
Old 12-18-2008
According to your explanation we are unable to step the file2 source code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Execl() command

Hi, If I write in a c file : execlp("date","date",NULL); printf("A\n"); And then run through the terminal would "A" be printed ? I understood that execlp will exit the program after it finished so the next lines of code won`t be executed afterwards.. Is that true ? (1 Reply)
Discussion started by: uniran
1 Replies

2. Programming

Why does gdb stop at a different line than “i b” shows while returning from function?

Here is the program I am trying to debug: #include <stdio.h> int i = 5; int main(void) { int x = 3; display(x); return 0; } void display(int x) { for ( i=0; i<x; ++i ) { printf("i is %d.\n", i); } }This code is coming from here Peter's gdb Tutorial: Stepping... (2 Replies)
Discussion started by: ijustneeda
2 Replies

3. Programming

[C] execl and pipes?

Hi, I have two programs, one is named "Master" and the other one "slave". What I want to do is , when I execute Master, inside slave will be called by excecl, do some calculations, and send those to the master program... A little example of what I am failing to do: if ((PID1=fork())==0) { //... (6 Replies)
Discussion started by: lamachejo
6 Replies

4. Programming

How to step in one function after the function be executed in gdb?

In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies

5. Programming

When execl fails in C

when execl fails using the command lss, it doesnt go into the next line execl("/bin/sh", "/bin/sh", "-c", command, NULL); perror("execl failed"); exit(127); for some reason the child process just stops and also the parent process also stops so the line after the line that... (3 Replies)
Discussion started by: omega666
3 Replies

6. Red Hat

execl command

how to use find command in execl function, I used: execl("/usr/bin/find","find","~","-name","filename.c",0); but it shows find: ~ no file and directory i need to get the path of the file from the home .:wall: (2 Replies)
Discussion started by: Mahendravarma
2 Replies

7. Shell Programming and Scripting

need help with execl command

I want to make simultanous sh commands in an exec command for example I want to counts the lines in a file wc -l my file.txt | awk -F" " '{print $1}'` works fine in sh but I want to implement it in a c code the first part works like this execl("/usr/bin/wc", "wc", "-l", "myfile.txt",... (1 Reply)
Discussion started by: walnut
1 Replies

8. Programming

execl()

can anyone explain how to pass arguments of a program in execl function pls explain with a sample code. (2 Replies)
Discussion started by: bankpro
2 Replies

9. Programming

How to specify path of a function within execl

Consider the following scenario program1: main() { ...... execl("path","function",...); ..... } function() { ----- ------- } Now i want to include the path of function in execl. How to do this. should the path be the path of function's executable file. If it so how... (1 Reply)
Discussion started by: bankpro
1 Replies

10. Programming

execl / execv ?

Hi, Is it possible to run a program from my C program using only the full pathname? for example if I wanna call: "ls", so I whould have to use: execl("/bin/ls", "ls", NULL); Is it possible to do this using only: "/bin/ls" thanks (1 Reply)
Discussion started by: owijust
1 Replies
Login or Register to Ask a Question