🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #2390

Re: pthreads + execv causes gdb to get confused

#2390
From: Srini
Date: Tue, 26 Mar 2002 05:21
62 lines
3489 bytes
Hi,
I just want to gave a small test case for the problem reported by
Patrick.
My actual application is some thing different, however on the same
lines.
My application (it's a MT application) sets the LD_LIBRARY_PATH
(putenv(LD_LIBRARY_PATH)) from the executable path (i.e from argv[0])
and later part of the code uses the dlopen and creates threads.
Unfortunatly the dlopen is not able to see the change in the
LD_LIBRARY_PATH by the application. It only remembers the
LD_LIBRARY_PATH when it is execed. So i need to call the execvp with
the same application (by this time in my app, there won't be any
threads, except the main) somewhare between setting the path and
before using dlopen. And when i debug the application i am getting the
above mentioned error from gdb.
Cheers,
Srini



"Tauno Voipio" <tauno.voipio@iki.fi.SPAMBAIT_REMOVE> wrote in message news:<YXJn8.341$So2.49070@read2.inet.fi>...
> "Patrick Doyle" <doylep@eecg.toronto.edu> wrote in message
> news:699e3226.0203191209.403ad50e@posting.google.com...
> > Hi.  I hope this is helpful...
> >
> > When debugging a program that uses pthreads, a call to execv causes
> > gdb to get mighty confused:
> >
> > (gdb) run
> > Starting program: abc
> > [New Thread 1024 (LWP 8440)]
> > Breakpoint 2 (...)
> > 736             execvp(argv[0], argv);
> > (gdb) cont
> > Continuing.
> > Cannot find user-level thread for LWP 8445: generic error
> > (gdb) bt
> > Cannot find thread 1024: generic error
> > (gdb) quit
> > The program is running.  Exit anyway? (y or n) y
> > Cannot find thread 1024: generic error
> > (gdb) [5]   Terminated              gdb abc
> >
> > [6]+  Stopped                 gdb abc
> > [bash]$ kill %
> >
> > [6]+  Stopped                 gdb abc
> > [bash]$
> > [6]+  Terminated              gdb abc
> > [bash]$
> >
> > This is Red Hat 7.2 and GNU gdb 20020225.
> 
> Just wonder ...
> 
> What are you trying to achieve?
> You replace the whole executable (if the exec.. succeeds) and would like to
> get GDB keeping track of it. Besides, if there are other threads running,
> they may get confused by the sudden replacement of the whole process code.
> 
> Tauno Voipio
> tauno voipio @ iki fi
Technical Details
Message-ID: <2f641791.0203252121.6099308f@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!not-for-mail
References: <699e3226.0203191209.403ad50e@posting.google.com> <YXJn8.341$So2.49070@read2.inet.fi>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,9a65a43ad455212b
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-03-25 21:21:14 PST
x-uunet-gateway: mr1.ash.ops.us.uu.net from bug-gdb to gnu.gdb.bug; Tue, 26 Mar 2002 05:21:13 GMT
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!not-for-mail
From: srinivas_av@rediffmail.com (Srini)
Subject: Re: pthreads + execv causes gdb to get confused
Date: 25 Mar 2002 21:21:04 -0800
Organization: http://groups.google.com/
Message-ID: <2f641791.0203252121.6099308f@posting.google.com>
References: <699e3226.0203191209.403ad50e@posting.google.com>
 <YXJn8.341$So2.49070@read2.inet.fi>
NNTP-Posting-Host: 202.135.142.194
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1017120064 27247 127.0.0.1 (26 Mar 2002 05:21:04 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 26 Mar 2002 05:21:04 GMT
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Sender: bug-gdb-request@mail.gnu.org
Lines: 62