Hi All,
I am tring to debug the following program.I written this
program in HP-Unix and I am using the GDB as a debugger.
#include <stdio.h>
#include<unistd .h>
int main()
{
int pid;
pid = fork();
if(pid == 0)
{
printf("I am the child process,my processid is\t
%d\n",getpid()) ;
printf("I am the child's parent process,my processid
is\t %d\n",getppid() );
sleep(20);
printf("I am the child process,my processid is\t
%d\n",getpid()) ;
printf("I am the child's parent process,my processid
is\t %d\n",getppid() );
}
else
{
printf("I am the parent process,my processid is\t
%d\n",getpid()) ;
printf("I am the parent's parent process,my processid
is\t %d\n",getppid() );
}
}
While debugging using any debugger by default it will take only
parent process to debug.If u want to debug the child process we have to
use the "info threads" command and get the thread numbers.
And we have to switch to the child thread,this is what the
general procedure is.
But in my case it is showing only one entry after executing the
info threads command,I executed this command after the if loop.
Could anybody suggest how to trap that child thread and how to
debug that process.i put the break point at the if loop.If anybody
couldn't get it plz revert back to me.
Regards
Sunil 2 1989
sunil <su*******@gmai l.comwrote:
I am tring to debug the following program.I written this
program in HP-Unix and I am using the GDB as a debugger.
(snip question relating to threads)
(This question is better suited for a different newsgroup, possibly
comp.unix.progr ammer or comp.programmin g.threads.)
Your post is off-topic for comp.lang.c. Please visit http://www.ungerhu.com/jxh/clc.welcome.txt http://c-faq.com http://benpfaff.org/writings/clc/off-topic.html
for posting guidelines and frequently asked questions. Thank you.
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gma il.com | don't, I need to know. Flames welcome.
"sunil" <su*******@gmai l.comwrites:
Hi All,
I am tring to debug the following program.I written this
program in HP-Unix and I am using the GDB as a debugger.
Hi sunil,
You've already been informed that this is Off Topic here : but I just
happened to be reading something recently which might help you.
It can be confusing. But gdb stops all execution of all
threads at a break. See here for further info: http://sources.redhat.com/gdb/curren...b_6.html#SEC45
I'm assuming you DID set a breakpoint at if(pid==0) ?
good luck,
r.
>
#include <stdio.h>
#include<unistd .h>
int main()
{
int pid;
pid = fork();
if(pid == 0)
{
printf("I am the child process,my processid is\t
%d\n",getpid()) ;
printf("I am the child's parent process,my processid
is\t %d\n",getppid() );
sleep(20);
printf("I am the child process,my processid is\t
%d\n",getpid()) ;
printf("I am the child's parent process,my processid
is\t %d\n",getppid() );
}
else
{
printf("I am the parent process,my processid is\t
%d\n",getpid()) ;
printf("I am the parent's parent process,my processid
is\t %d\n",getppid() );
}
}
While debugging using any debugger by default it will take only
parent process to debug.If u want to debug the child process we have to
use the "info threads" command and get the thread numbers.
And we have to switch to the child thread,this is what the
general procedure is.
But in my case it is showing only one entry after executing the
info threads command,I executed this command after the if loop.
Could anybody suggest how to trap that child thread and how to
debug that process.i put the break point at the if loop.If anybody
couldn't get it plz revert back to me.
Regards
Sunil
--
Lint early. Lint often. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Manisha |
last post by:
Hi,
I am creating a C++ dll which is used to process data passed to it
through one of its exported functions. It should be able to process
160 simultaneous requests. For this reason, I have initiated 10 child
threads from the main thread and maintaining a queue of nodes
containing the data to be processed.
The queue node strucute is as follows:
struct SQueueNode
|
by: Jeff Rodriguez |
last post by:
Here's what I want do:
Have a main daemon which starts up several threads in a Boss-Queue structure.
From those threads, I want them all to sit and watch a queue. Once an entry
goes into the queue, grab it and run a system command.
Now I want to make sure that system command doesn't hang forever, so I need some
way to kill the command and have the worker thread go back to work waiting for
another queue entry.
|
by: Development |
last post by:
I am creating 10 threads that do ecatly the same thing. I am having a very
hard time debugging this scenario. It seems that by default when you are
doing f10 or f11 all threads execute. You can see that by watching the
thread window. When you freeze all threads but the one you are working on
it then does not do anything.
So does anybody have any experience debugging multithreaded apps in C# and
could they share the best...
|
by: Bonj |
last post by:
Further to my last post, I have managed to get a child window to display. But its messages are routed to the same WNDPROC that the main window's messages are routed to - what is the way of identifying from the lParam or wParam whether the message came from a child window or the parent? And what if the message uses some other data in the wParam or lParam? Is it better to use one wndproc for the parent window, and one wndproc for all child windows...
|
by: Bruno van Dooren |
last post by:
Hi,
i was debugging a multithreaded app, when i stumbled across some weird
behavior of the debugger.
in the destructor of my main object i send a stop event to the worker
thread, and then wait until that thread has finished.
m_Stop = true;
while(GetExitCodeThread() == STILL_RUNNING)
| |
by: Serdar Kalaycý |
last post by:
Hi everybody,
My problem seems a bit clichè but I could not work around.
Well I read lots of MSDN papers and discussions, but my problem is a bit
different from them. When I tried to run the project in debug mode (by
hitting F5) it gives an error message
"Error while trying to run project: Unable to start debugging on the web
server.
|
by: Doug Robertson |
last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm
completely self taught - so bear in mind my total lack of expertise.
I have a program originally written in VB2003 using the dotnet 1.1
framework. The program makes extensive use of Win32 API calls to help manage
and track remote access sessions with out clients. I've left it running for
days at a time on my system with no problems. It has always been stable.
I...
|
by: james_w77 |
last post by:
I am trying to use Peter's StoppableThread(threading.Thread).
What I want to do is to start 5 child threads, then do something, then
when got ^C keyboard exception, stop the child thread.
For some reason (apparently strange for me :) ), the child threads can
NOT be stopped.
See the enclosed code for more info,
|
by: Jim B. Wilson |
last post by:
I have the mother (of all) application(s, written in C++) that
occasionally outsources certain tasks to a child Python script. The
mother fork/execs (or equivalent) the child and then begins serving the
child's requests.
The child/client sends requests on its stdout and receives responses on
stdin. The interaction is facilitated by a Pyrex extension which handles
the lower-level aspects of the conversation and exposes a few functions...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |