public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/29164] New: [Multithread] Finish never return when a breakpoint hit
@ 2022-05-21 12:12 zakaria.ternane at gmail dot com
  2022-05-21 12:13 ` [Bug breakpoints/29164] " zakaria.ternane at gmail dot com
  2022-05-21 12:14 ` zakaria.ternane at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: zakaria.ternane at gmail dot com @ 2022-05-21 12:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29164

            Bug ID: 29164
           Summary: [Multithread] Finish never return when a breakpoint
                    hit
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: zakaria.ternane at gmail dot com
  Target Milestone: ---

Created attachment 14110
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14110&action=edit
Minimal Working Exemple

OS : macOS Monterey / Linux

Hello,

When using the finish command in a gdb session consisting of two
threads, the finish is never hit if a breakpoint is hit in the other
thread before hitting the finish point.

In the following example, I have two threads and I set breakpoints on
"pthread_mutex_lock" and on "pthread_join" (pthread lib).  When the
first breakpoint is hit (on pthread_mutex_lock), I send the ```finish```
command. Then, the "join" breakpoint is hit and the even using
continue, the finish is never call back again.

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>

int val = 0;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

void* fa(__attribute__((unused)) void* unused){
    pthread_mutex_lock(&mutex);
    val++;
    pthread_mutex_unlock(&mutex);
    return NULL;

}

int main(){
    pthread_t t1;

    printf("Value = %d\n", val);

    pthread_create(&t1, NULL, &fa, NULL);

    val += 10;

    pthread_join(t1, NULL);

    printf("Value = %d\n", val);

    return 0;
}

Sincerely,

Zakaria Ternane

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug breakpoints/29164] [Multithread] Finish never return when a breakpoint hit
  2022-05-21 12:12 [Bug breakpoints/29164] New: [Multithread] Finish never return when a breakpoint hit zakaria.ternane at gmail dot com
@ 2022-05-21 12:13 ` zakaria.ternane at gmail dot com
  2022-05-21 12:14 ` zakaria.ternane at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: zakaria.ternane at gmail dot com @ 2022-05-21 12:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29164

Zakaria TERNANE <zakaria.ternane at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14110|Minimal Working Exemple     |Minimal Working Example
        description|                            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug breakpoints/29164] [Multithread] Finish never return when a breakpoint hit
  2022-05-21 12:12 [Bug breakpoints/29164] New: [Multithread] Finish never return when a breakpoint hit zakaria.ternane at gmail dot com
  2022-05-21 12:13 ` [Bug breakpoints/29164] " zakaria.ternane at gmail dot com
@ 2022-05-21 12:14 ` zakaria.ternane at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: zakaria.ternane at gmail dot com @ 2022-05-21 12:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29164

Zakaria TERNANE <zakaria.ternane at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |10.1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-21 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 12:12 [Bug breakpoints/29164] New: [Multithread] Finish never return when a breakpoint hit zakaria.ternane at gmail dot com
2022-05-21 12:13 ` [Bug breakpoints/29164] " zakaria.ternane at gmail dot com
2022-05-21 12:14 ` zakaria.ternane at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).