From patchwork Mon Jun 5 12:59:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farre X-Patchwork-Id: 70604 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 371C53839DEF for ; Mon, 5 Jun 2023 12:59:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 371C53839DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685969986; bh=1sAyH83bGJGs75gEavEp0wxWbCUWFIQMJqllpTAu2iM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=cmOtLCUNHut5FjoUUDTi9eDZZlqADtn9AOBV+WrLI3B4Sc2UK+Yv1DUi1YHmB6Afh ShxvAYNC2D0CDp5dtzhBw1FFd+rF6RT+VoHPH5MTD2rnQEBIN+Sd+cyJ66D8Ro8l0/ fSI1bD0cEn7OiI86SynhUeWfqJ9CNgpa6r0ifzcc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 769893857806 for ; Mon, 5 Jun 2023 12:59:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 769893857806 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f62d93f38aso787456e87.0 for ; Mon, 05 Jun 2023 05:59:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685969960; x=1688561960; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1sAyH83bGJGs75gEavEp0wxWbCUWFIQMJqllpTAu2iM=; b=bJZ6l2uaXZGQDBoms0YqcRJJAoRgzngEHzNI8eff0xliiQLhQalrMhcWRVQBDyL/5/ yEjQpSia0rTw9HYlvuXoylgDxID1/xfFtmlfDOPOavg1DwCVGCbhYm0knRGrMs/A22EU HbS0SKsZVt34DcKB10xjAfvOEeOJN1w0DPfk2QuANmgGSWyJYAnEQqlFdSo16vzajCri DF0CplQ8VCDKbMct/RT1UHHD4gnNy0IDE3X78W1PpDTpRPU7opo6M+AqglQqjmagQ25I JDLbyGO5CEkT93iV/mqlv3OHu45KANpWakPEY9drFamLkL7NYALq3D/m3OuHcoFwVRik SgOQ== X-Gm-Message-State: AC+VfDxCfK3a7iHu24m0mllFpmgiDzRSCErQ5ylgPfhCEFtck/iPTMpk LMMZiinuDj45cYFbbgmdBsQWX/AczYE8Bw== X-Google-Smtp-Source: ACHHUZ6s6zPdhuXYsupl+Ob78JgKM6nACNxv/JDHtVHaT6UhUnQkY1qhuDoOyyPMf4ipzEMlfJnYXw== X-Received: by 2002:a05:6512:40b:b0:4f2:579d:6867 with SMTP id u11-20020a056512040b00b004f2579d6867mr5394149lfk.20.1685969959902; Mon, 05 Jun 2023 05:59:19 -0700 (PDT) Received: from fedora.. (78-73-77-63-no2450.tbcn.telia.com. [78.73.77.63]) by smtp.gmail.com with ESMTPSA id f14-20020a19ae0e000000b004a6f66eed7fsm1120944lfc.165.2023.06.05.05.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 05:59:19 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Simon Farre Subject: [PATCH v1] [gdb/dap] Add thread exited event Date: Mon, 5 Jun 2023 14:59:07 +0200 Message-Id: <20230605125907.76835-1-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Farre via Gdb-patches From: Simon Farre Reply-To: Simon Farre Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Reports a thread exit according to the DAP spec: https://microsoft.github.io/debug-adapter-protocol/specification#Events_Thread This patch requires the ThreadExitedEvent to be checked in, in order to work. That patch is found here https://sourceware.org/pipermail/gdb-patches/2023-June/200071.html --- gdb/python/lib/gdb/dap/events.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py index d9ae603dfa4..1618f9cd6ac 100644 --- a/gdb/python/lib/gdb/dap/events.py +++ b/gdb/python/lib/gdb/dap/events.py @@ -66,17 +66,23 @@ def _bp_deleted(event): }, ) - @in_gdb_thread -def _new_thread(event): +def thread_event(event, reason): send_event( "thread", { - "reason": "started", + "reason": reason, "threadId": event.inferior_thread.global_num, }, ) +@in_gdb_thread +def _new_thread(event): + thread_event(event, "started") + +@in_gdb_thread +def _thread_exited(event): + thread_event(event, "exited") _suppress_cont = False @@ -160,4 +166,5 @@ gdb.events.breakpoint_created.connect(_bp_created) gdb.events.breakpoint_modified.connect(_bp_modified) gdb.events.breakpoint_deleted.connect(_bp_deleted) gdb.events.new_thread.connect(_new_thread) +gdb.events.thread_exited.connect(_thread_exited) gdb.events.cont.connect(_cont)