From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by sourceware.org (Postfix) with ESMTPS id 1784C3888825 for ; Fri, 18 Mar 2022 19:25:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1784C3888825 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f50.google.com with SMTP id p9so12934782wra.12 for ; Fri, 18 Mar 2022 12:25:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZQUTLb86bSneWYViOU6w1U1CvypQ2FPNjhtUURPF6gs=; b=Z/piFzwvsnI/ZJfomTFnFsZjDsBfjh3l5pUnK35/OQLioaVjJy8sPp11evehn0Te3W fAZ3DQOoqBikKrfb+k44K2TLxW5KmN2a5Cw2yeIoneUyVgQhtYIJTRtvYwo5MxIILnHz RRuRFYPFz1Tv7C+yaZCIshxH7a0ygYpUmlxQwq5Hpxy2lq+cnJu3J5nAJi0ZQ2AbO9Pv MEJNy9EiOpPvnoF4TDXjXnWxgPQg+O351wL7sfMkcWznYmx8paWjJkh5LBQbC9Cz65AY lrZZmgkH5LryY56CcfboDqF82EqJ11rfnDYdYgWpWnzqvNe02uvU7G4sCxqwg9WCyBlz WPlA== X-Gm-Message-State: AOAM531g60YJE+4Ecl4FeYqouTVrQHtrwzCgDw2X8JOpzWjOZ0RXabS7 Dch6M0UQWW1fTXPeeMOYdcntguLD+Iw= X-Google-Smtp-Source: ABdhPJwEetIZlwHtCM/KICd+SrFejfHCnNkFyEk4glTn/sZ5h2u8dVY6p9V48Kgbahl1pD0Zb4ygeg== X-Received: by 2002:a05:6000:170d:b0:1f1:fefa:db85 with SMTP id n13-20020a056000170d00b001f1fefadb85mr9056710wrc.148.1647631541322; Fri, 18 Mar 2022 12:25:41 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id w7-20020a1cf607000000b00389a5390180sm7125539wmc.25.2022.03.18.12.25.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Mar 2022 12:25:40 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [ob/pushed] Fix crash with stepi, no debug info, and "set debug infrun 1" Date: Fri, 18 Mar 2022 19:25:39 +0000 Message-Id: <20220318192539.3459991-1-pedro@palves.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 18 Mar 2022 19:25:44 -0000 A stepi in a function without debug info with "set debug infrun 1" crashes GDB since commit c8353d682f69 (gdb/infrun: some extra infrun debug print statements), due to a reference to "tp->current_symtab->filename" when tp->current_symtab is null. This commit adds the missing null check. The output in this case becomes: [infrun] set_step_info: symtab = , line = 0, step_frame_id = {stack=0x7fffffffd980,code=0x0000000000456c30,!special}, step_stack_frame_id = {stack=0x7fffffffd980,code=0x0000000000456c30,!special} Change-Id: I5171a9d222bc7e15b9dba2feaba7d55c7acd99f8 --- gdb/infrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index bc6521c8ec6..104c29abf0a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4180,7 +4180,8 @@ set_step_info (thread_info *tp, struct frame_info *frame, infrun_debug_printf ("symtab = %s, line = %d, step_frame_id = %s, step_stack_frame_id = %s", - tp->current_symtab->filename, tp->current_line, + tp->current_symtab != nullptr ? tp->current_symtab->filename : "", + tp->current_line, tp->control.step_frame_id.to_string ().c_str (), tp->control.step_stack_frame_id.to_string ().c_str ()); } base-commit: da729c5ccde6eeccae539cbe51a285bc84769b3d -- 2.26.2