From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by sourceware.org (Postfix) with ESMTPS id 35A26386F802 for ; Fri, 10 May 2024 19:53:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35A26386F802 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 35A26386F802 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715370820; cv=none; b=c5l0oQzGHjR+FIF7wMicku0V2lMJ9pVg5VtzmF92yr+GzijkTnwKMAO27NzRJ3bmIum1eqUcClgTDgxuta2cixiYvB+xepzXDKQNp+3sV4zOn0t1YcDlvO9AB0PhYsqgwRko5GsVXwgrJZA/revmj8GiA869wX2uDawk82SpTUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715370820; c=relaxed/simple; bh=WDopAIMOqts1+c8BRKWe9sjMj+7RhS5CgqRnVNPeziw=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=omM4a3EPko2eiCDwhknMkiy0dejktLshBs9M1ICGpuvHLzVwjtrQMvatpR6Wx4NjcrSb1zKSF5Ii8IuCFBsKIz9NT4EkJKwlfUNF6Z9oLw/0/0S0gNWIiTDShouyhkSRoDzsVH5iol5n2gt3quwAMMwgEIFWXHnHfbCbVt+jfng= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-41dc9c83e57so19214395e9.0 for ; Fri, 10 May 2024 12:53:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715370818; x=1715975618; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=m1Lv5fiJKGx7sfDQMiXQzYznuqSPKB+0E4IZOx6ub0s=; b=Y6PWyjPYDF8rptOiWpq2UWfRqgRF+QDVhEo4nOr7+zQOWgH7XNiZRyXow1VQsQAM/Q RXGYhH9AyOf7//b7y4ueT1bTyDnwn2yCOgPDG08JXFceCDsqvpNP95q13zeLDdEPt0W1 jOm1lEHiANA77nTcrplkV88BOSKGCci0QEc3Wz2VLoooDDxe4H79wyDk9hm2VX0bw2tj kEruVIIWssRKOlBIjiuxT4UzBKiNC1WIW6di40WG/GuO59lkFi2el67msl/Cow3S1QQc kX+zqatt5/TrVHdwg9rzGQdkWc5SqA0WBqC8UR9E+L0QuMgn8EjR2MlStQWmkkcbwnDK l9eg== X-Forwarded-Encrypted: i=1; AJvYcCWpKDiyG7LuatPAJeidUpp4Mv8YAYAA4tNknGT78UBzVUfkHWYhz+vxvjt07QIu+WPKds2ETaiPE2GUjpSFgsX7KSnIUJUPLeTvdw== X-Gm-Message-State: AOJu0Yzodwx7MY+NTsW8GpRIGqaoXq1QzNJpW+Mb+eCU0h7/sBzSo1lC /M5w3M6LZIADD3qw4atPhc628Vlvgw6LH0xH2/qkgaLq26GW8sTr X-Google-Smtp-Source: AGHT+IGrZVSaHP300u+qpaHaFq+im7hcb6sy0Zj0kHxOQaKK9cHDmVoWNYwadUQadd0MX2QCt6v42g== X-Received: by 2002:a5d:56cc:0:b0:34e:2a63:8500 with SMTP id ffacd0b85a97d-35018283492mr5355695f8f.16.1715370817814; Fri, 10 May 2024 12:53:37 -0700 (PDT) Received: from ?IPV6:2001:8a0:f908:4900:6534:b101:e988:663d? ([2001:8a0:f908:4900:6534:b101:e988:663d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad0a0sm5381860f8f.74.2024.05.10.12.53.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 May 2024 12:53:37 -0700 (PDT) Message-ID: Date: Fri, 10 May 2024 20:53:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] gdb: Change "list ." command's error when no debuginfo is available To: Guinevere Larsen , gdb-patches@sourceware.org Cc: Simon Marchi , Eli Zaretskii References: <20240430183557.342813-2-blarsen@redhat.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <20240430183557.342813-2-blarsen@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-04-30 19:35, Guinevere Larsen wrote: > /* The inferior is not running, so reset the current source > location to the default (usually the main function). */ > clear_current_source_symtab_and_line (); > - set_default_source_symtab_and_line (); > - cursal = get_current_source_symtab_and_line (); > + try > + { > + set_default_source_symtab_and_line (); > + } > + catch (const gdb_exception &e) Catching gdb_exception is usually a red flag. That catches Ctrl-C and force-quit (for SIGTERM) too. Please don't do that unless there's a good reason. Maybe we should rename gdb_exception -> gdb_exception_avoid_catching_me. :-P > + { > + error (_("Insufficient debug info for showing source " > + "lines at default location")); Speaking of catching errors... This looks brittle -- how can we be sure that the error is about missing debug info? Is this all about this error: void set_default_source_symtab_and_line (void) { if (!have_full_symbols () && !have_partial_symbols ()) error (_("No symbol table is loaded. Use the \"file\" command.")); ? It would be much simpler and clearer to make set_default_source_symtab_and_line (or a variant of it) return false instead.