delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/12/13:18:05

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <CADqjQ-+t+YBrZmOpoWfgRJLfa397Uwhy-7KFQ2KqYj5CqsmZFA@mail.gmail.com>
References: <CADqjQ-JYHL3ZbYw2umByGJBr9rF87hX-o2smZM-rxsegD4cNnQ AT mail DOT gmail DOT com> <CADqjQ-Ldmr1iLNanERREbmoaSEcKqTcRWuTrNZDvB3bdgDpp2A AT mail DOT gmail DOT com> <CADqjQ-+t+YBrZmOpoWfgRJLfa397Uwhy-7KFQ2KqYj5CqsmZFA AT mail DOT gmail DOT com>
Date: Tue, 12 Jul 2011 13:17:22 -0400
Message-ID: <CADqjQ-LOxVPrD6B3QgBM1U5-yL=baWA=Zt4jLWQRg1wXeS74Bg@mail.gmail.com>
Subject: Re: Pthreads and GDB?
From: Jan Chludzinski <jan DOT chludzinski AT gmail DOT com>
To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p6CHI2Fx014596

The 2 threads finish executing before I can set a break.  Why?  ---Jan

On Tue, Jul 12, 2011 at 1:15 PM, Jan Chludzinski
<jan DOT chludzinski AT gmail DOT com> wrote:
> Sorry, I forgot to build with the -g option.
>
> But still as I'm stepping passed the 2 pthread_create() routines they
> finish executing before I can set a break.  Why?
>
> ---Jan
>
>
> On Tue, Jul 12, 2011 at 1:02 PM, Jan Chludzinski
> <jan DOT chludzinski AT gmail DOT com> wrote:
>>> Since cygwin1.dll is multithreaded, I routinely set breakpoints which
>>> are only hit in a thread.  So, yes, gdb is supposed to be multi-thread
>>> aware.
>>
>> I have a 2 thread program.  I set the break for main() and run (to main):
>>
>>      (gdb) b main
>>      Breakpoint 1 at 0x401191
>>      (gdb) r
>>      Starting program: /home/John/projects/pthreads/test1/a.exe
>>      [New thread 3680.0x13e8]
>>      Error: dll starting at 0x76ff0000 not found.
>>      Error: dll starting at 0x76590000 not found.
>>      Error: dll starting at 0x76ff0000 not found.
>>      Error: dll starting at 0x76c40000 not found.
>>      [New thread 3680.0xc7c]
>>      Breakpoint 1, 0x00401191 in main ()
>>
>> Wait a few seconds and start to step:
>>
>>      (gdb) n
>>      Single stepping until exit from function main,
>>      which has no line number information.
>>      [New thread 3680.0x1410]
>>      [New thread 3680.0x1540]
>>      Counter value functionCount1: 1
>>      Counter value functionCount2: 2
>>      ...
>>      Final count: 10
>>      Program exited normally.
>>
>> As you can see the threads have finished executing, along with the
>> main thread, *before * I ever get a chance to step to the first
>> pthread_create().  Let alone set a break in a thread.
>>
>> Why?
>>
>> Thanks, Jan
>>
>> On Tue, Jul 12, 2011 at 6:16 AM, Jan Chludzinski
>> <jan DOT chludzinski AT gmail DOT com> wrote:
>>> I went to GNU.org to read about GDB and threads since I'm having
>>> trouble working with ptheads under GDB on Cygwin.  I notice this on
>>> the GNU.org web site:
>>>
>>> "Warning: These facilities are not yet available on every GDB
>>> configuration where the operating system supports threads. If your GDB
>>> does not support threads, these commands have no effect. For example,
>>> a system without thread support shows no output from `info threads',
>>> and always rejects the thread command, like this:"
>>>
>>> What the level of support for threads with GDB under Cygwin?
>>>
>>> Switching between threads causes seg-faults.  Also, I thought that
>>> while you're stepping through one thread, the other threads weren't
>>> running? Shouldn't I be able to set a breakpoint in a thread before
>>> pthread_create() is invoked?  Doesn't appear to be the case?
>>>
>>> ---Jan
>>>
>>
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019