From patchwork Wed Oct 5 09:34:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 58380 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 29A013857C75 for ; Wed, 5 Oct 2022 09:35:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29A013857C75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664962537; bh=6vANwzkDeGWTRtgxcezA+lgvTbB+fSBbyFzshxpZN0Y=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=T39qobgdqQ2A3vY9LP8OMMjSkjpKnajCLmExS/ab8E6IlqygYpf2fhOfdHaHQpaIg WfNwzmLqJzMNigJgeIPp0IXRLguga64K3BJkLRVgXuAMeckAjEx43hNq6SePgh56de ODxiXMcIGciatNYxugA+AeXoqsJ2oZxYfzIOItn4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3FD31385743A for ; Wed, 5 Oct 2022 09:34:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FD31385743A Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-397-xmSRI_-tNcqG1xVm6zObvg-1; Wed, 05 Oct 2022 05:34:46 -0400 X-MC-Unique: xmSRI_-tNcqG1xVm6zObvg-1 Received: by mail-wm1-f69.google.com with SMTP id l15-20020a05600c4f0f00b003b4bec80edbso9143498wmq.9 for ; Wed, 05 Oct 2022 02:34:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6vANwzkDeGWTRtgxcezA+lgvTbB+fSBbyFzshxpZN0Y=; b=4DGB39H95N4D6jeIObp6yslEHGZ8UkOEzvDr5oVz8XXobylm6rUGj4TLKRLetYG5D4 z+xGkEORXQPUK/UGtC2PoKFgmQyO68m6LphiRIoVmev61S3YkSV2adpYyDGwXlO4MYQw H6rqkONtSWJr+pkebdN23aZOwAaDQn1Dszv2xc+zFHjk6x+Q12lUcU25GZAe8+lnwAxB QW5jrbM5k8+OPvwOKkVMpmFhKQ22RZpv5ofQol/rFFuz8EC25bhiizaGDMvxxl1aW7bb e/jMaXbBLMmYEnjvUqX8+1I+m9yxZclvpEFfrcyTO+G7XCPKyV9FCBoGKw/VMnmRZsq6 Fdyg== X-Gm-Message-State: ACrzQf07zJ0Ptpr6Zi0/HAMF2mDETLT5/Wm5H3CPh8x4BqyRfueBnjHX Np20/e/a9uE6Px2DeJbOKz7j4IVXbkLorzQlS4KJ0tR6H7eulCksskQvE1Jzc1xi852u51PpUnF kh5sEKJTuhhczwVpHcdVfPf2E6OwHydJm/UZCv2ovzNPgJ1OWQxg8xNk1er08z7tl76PYDCqE9Q == X-Received: by 2002:adf:efc5:0:b0:22e:4a6:2d5b with SMTP id i5-20020adfefc5000000b0022e04a62d5bmr14287181wrp.293.1664962485374; Wed, 05 Oct 2022 02:34:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ACXn5xFw6PqVEGFcr9WEgoGdCFzX2tdoUcKI9Ng+84b9h/6Ho7FiFOMmyxW0A0CrDqN8fCQ== X-Received: by 2002:adf:efc5:0:b0:22e:4a6:2d5b with SMTP id i5-20020adfefc5000000b0022e04a62d5bmr14287168wrp.293.1664962485118; Wed, 05 Oct 2022 02:34:45 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id r17-20020a05600c425100b003b332a7b898sm1362247wmm.45.2022.10.05.02.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 02:34:44 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 1/2] gdb: add some additional debug in mark_async_event_handler Date: Wed, 5 Oct 2022 10:34:39 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Extend the existing debug printf call to include the previous state of the async_event_handler object. --- gdb/async-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/async-event.c b/gdb/async-event.c index 12ce62cfa5f..8c6ba099f59 100644 --- a/gdb/async-event.c +++ b/gdb/async-event.c @@ -293,8 +293,10 @@ create_async_event_handler (async_event_handler_func *proc, void mark_async_event_handler (async_event_handler *async_handler_ptr) { - event_loop_debug_printf ("marking async event handler `%s`", - async_handler_ptr->name); + event_loop_debug_printf ("marking async event handler `%s` " + "(previous state was %d)", + async_handler_ptr->name, + async_handler_ptr->ready); async_handler_ptr->ready = 1; } From patchwork Wed Oct 5 09:34:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 58379 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 8087E3857010 for ; Wed, 5 Oct 2022 09:35:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8087E3857010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664962514; bh=9dMYBIrfag+/acGlcs/0Fec1XgQzg7BIcjEKI82/gB8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YZR4FPRxmkjRAXx8fqUf2CK0QxTcvlBhvFsNzdkaqt/R2Jq4bCk5slB0Rkuxs8WtS dZGI5RRQ49PjCqtfnvzgjIcmiHreKBsttSMGG+xz0DBrHovJe0LafFTk54FGLmtftW CmUhLbhJ1Tw57wUIDT4BvkFw+x02c9hwguQJujWU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E13DB385740A for ; Wed, 5 Oct 2022 09:34:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E13DB385740A Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-94-SRC22MUOPSacIvEPDm4sQQ-1; Wed, 05 Oct 2022 05:34:48 -0400 X-MC-Unique: SRC22MUOPSacIvEPDm4sQQ-1 Received: by mail-wr1-f69.google.com with SMTP id k30-20020adfb35e000000b0022e04708c18so3811879wrd.22 for ; Wed, 05 Oct 2022 02:34:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9dMYBIrfag+/acGlcs/0Fec1XgQzg7BIcjEKI82/gB8=; b=O4RKcOC3oyqGUibEry5JX6qKiMGXnqj9xTCoofzDgMUtfuzjheNZNzOvP9mhLQfJEC tXJSb4knKv42Z2Xg15o+wzZJQ5LL8rPSJRK6HPReEFnT/KFYZbsxcgnOmuDCBVW0bqsp 8sQXFy38/SC739DF1ZnZ7jr+Da6ICoQKo5DEUF+5Ie+VoQANabl4PaXbvKdG7v8TP+Lt sCNHXCzrDUq/sDL8idfPbpVcajEhr+b2mnkZ8Zy6EoircD6nJw9dgt5d0oPAGWoHe1g+ 2TVHnj8ET0h9TgQzMcu0soH8zD9T7M69hPqyUyPVjh0jbMixCi+6x/RAJIsjjSbTQ+xh E6mw== X-Gm-Message-State: ACrzQf2o1Tq0lATOHuYEHyEo4PUEfad5a8DDRwv9whQMMICzfr4i83O6 Ig3przTrwcYfhfkXgi7/vXSlfTnjEBG8C7bLsMGds6u22591tIiDZAPWjCEEV2Hcq5NcSCmHKMY 9MdlgVZEFwEfRbG8kbcgYZpLPOuH5A6gV5nQ4KYgH3cTLxQ0y0J3DFNtOYiXiH08vxPjlvdsHCQ == X-Received: by 2002:a05:600c:35cf:b0:3b4:c0c2:d213 with SMTP id r15-20020a05600c35cf00b003b4c0c2d213mr2796138wmq.162.1664962486885; Wed, 05 Oct 2022 02:34:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6s1C3BZCrd3m7C1vk1MjthMu7BnvHZ/sV09vnDDeXvmCESHJhd4x1WBDHAD22whsSvqA/WmQ== X-Received: by 2002:a05:600c:35cf:b0:3b4:c0c2:d213 with SMTP id r15-20020a05600c35cf00b003b4c0c2d213mr2796124wmq.162.1664962486563; Wed, 05 Oct 2022 02:34:46 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id j5-20020a05600c1c0500b003b477532e66sm8884959wms.2.2022.10.05.02.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 02:34:46 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 2/2] gdb: more infrun debug from breakpoint.c Date: Wed, 5 Oct 2022 10:34:40 +0100 Message-Id: <129b33db9ac98dc806807d6595fbeec3e18edeb1.1664962429.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This commit adds additional infrun debug from the breakpoint.c file. The new debug output all relates to breakpoint condition evaluation. There is already some infrun debug emitted from the breakpoint.c file, so hopefully, adding more will not be contentious. I think the functions being instrumented make sense as part of the infrun process, the inferior stops, evaluates the condition, and then either stops or continues. This new debug gives more insight into that process. I had to make the bp_location* argument to find_loc_num_by_location const, and add a declaration for find_loc_num_by_location. There should be no user visible changes unless they turn on debug output. --- gdb/breakpoint.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 002f4a935b1..38546ea44ba 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -165,6 +165,8 @@ static std::vector bkpt_probe_decode_location_spec static bool bl_address_is_meaningful (bp_location *loc); +static int find_loc_num_by_location (const bp_location *loc); + /* update_global_location_list's modes of operation wrt to whether to insert locations now. */ enum ugll_insert_mode @@ -5302,6 +5304,8 @@ bpstat_check_watchpoint (bpstat *bs) static void bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) { + INFRUN_SCOPED_DEBUG_ENTER_EXIT; + const struct bp_location *bl; struct breakpoint *b; /* Assume stop. */ @@ -5316,6 +5320,10 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) b = bs->breakpoint_at; gdb_assert (b != NULL); + infrun_debug_printf ("thread = %s, breakpoint %d.%d", + thread->ptid.to_string ().c_str (), + b->number, find_loc_num_by_location (bl)); + /* Even if the target evaluated the condition on its end and notified GDB, we need to do so again since GDB does not know if we stopped due to a breakpoint or a single step breakpoint. */ @@ -5323,6 +5331,9 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) if (frame_id_p (b->frame_id) && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ()))) { + infrun_debug_printf ("incorrect frame %s not %s, not stopping", + get_stack_frame_id (get_current_frame ()).to_string ().c_str (), + b->frame_id.to_string ().c_str ()); bs->stop = 0; return; } @@ -5333,6 +5344,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) if ((b->thread != -1 && b->thread != thread->global_num) || (b->task != 0 && b->task != ada_get_task_number (thread))) { + infrun_debug_printf ("incorrect thread or task, not stopping"); bs->stop = 0; return; } @@ -5424,16 +5436,22 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) if (cond && !condition_result) { + infrun_debug_printf ("condition_result = false, not stopping"); bs->stop = 0; } else if (b->ignore_count > 0) { + infrun_debug_printf ("ignore count %d, not stopping", + b->ignore_count); b->ignore_count--; bs->stop = 0; /* Increase the hit count even though we don't stop. */ ++(b->hit_count); gdb::observers::breakpoint_modified.notify (b); - } + } + + if (bs->stop) + infrun_debug_printf ("stopping at this breakpoint"); } /* Returns true if we need to track moribund locations of LOC's type @@ -13157,7 +13175,7 @@ enable_disable_bp_num_loc (int bp_num, int loc_num, bool enable) owner. 1-based indexing. -1 signals NOT FOUND. */ static int -find_loc_num_by_location (bp_location *loc) +find_loc_num_by_location (const bp_location *loc) { if (loc != nullptr && loc->owner != nullptr) {