From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17102 invoked by alias); 25 Sep 2017 20:33:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17064 invoked by uid 89); 25 Sep 2017 20:33:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=fellow, H*Ad:U*nathan, protect X-HELO: mail-pf0-f174.google.com Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Sep 2017 20:33:51 +0000 Received: by mail-pf0-f174.google.com with SMTP id x78so4383938pff.10 for ; Mon, 25 Sep 2017 13:33:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:from:subject:message-id:date :user-agent:mime-version:content-language; bh=rcZIA2iJQ1sSGK+G19tOlZZHZl279nOKm+dsdRSshLw=; b=jFTNWWv4alNK/koI4NJBCHuUQ3xQh2M/749pNLqiTQILaYgYCHpWaBSN9PO8XQiGNY 9extJ59wAIhKiHvrjrCPvS0bgparJvrqMnX0L6/8OoSZPMYjxdKyO1O18J4O5JoEyCIo x63LW2nmkY1vQTCICf07EaL5tt/iB8ERg9WuNnccErJeaf4+0J/BGAf6jsj/Q3B10sLU n3BL+snzsk0E+5c1ufRyA8IWLVB5eHXz7kxlSYP0T1UhsiZpCabrbQ9qGPAzqgq2LuwO sZ1vudRk7rYwmyNZRYYD5StERNs04bQplAF3RQHoOkrq16RBJ1NGnA59Xymx1bx3cK3x lp8A== X-Gm-Message-State: AHPjjUiLJgZDwl2tUWcTjsmgeSqWPhCV6C046AnWPwA+OTNedsJttnlJ 7NELo15wsYOxirIGygo0wg8= X-Google-Smtp-Source: AOwi7QB16PLiAzFn8mGj9dUp9PjsB+ts72MFRwZCJJobsGsoAxuZBO97Dat6fJ6EpkAFABvtHqgtaA== X-Received: by 10.99.122.91 with SMTP id j27mr8715022pgn.2.1506371630048; Mon, 25 Sep 2017 13:33:50 -0700 (PDT) Received: from [10.20.14.216] ([67.135.43.183]) by smtp.googlemail.com with ESMTPSA id u186sm11527919pgb.35.2017.09.25.13.33.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Sep 2017 13:33:49 -0700 (PDT) To: gdb-patches@sourceware.org Cc: palves@redhat.com, alexander.v.shaposhnikov@gmail.com From: Nathan Sidwell Subject: [gdb patch] seg fault on missing dwarf Message-ID: <02efda56-3678-f4f6-849d-df474214e82f@acm.org> Date: Mon, 25 Sep 2017 20:33:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E4D75313B0FF6DF89456ADFD" X-SW-Source: 2017-09/txt/msg00762.txt.bz2 This is a multi-part message in MIME format. --------------E4D75313B0FF6DF89456ADFD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 512 Pedro, this is Alex's patch of https://sourceware.org/ml/gdb-patches/2017-09/msg00745.html cleaned up with changelog formatting. Alex is a fellow FaceBooker. The patch looks obvious to me, particularly as a few lines down we have: fprintf_unfiltered (gdb_stdlog, " %s CUs, %s TUs\n", pulongest (dwp_file->cus ? dwp_file->cus->nr_units : 0), pulongest (dwp_file->tus ? dwp_file->tus->nr_units : 0)); to protect dump output from exactly this problem. ok? nathan -- Nathan Sidwell --------------E4D75313B0FF6DF89456ADFD Content-Type: text/x-patch; name="gdb-null.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb-null.diff" Content-length: 1171 2017-09-25 Alexander Shaposhnikov * dwarf2read.c (open_and_init_dwp_file): Protect against dwp_file having NULL cus or tus. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b1914cf..547e3f0 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -11185,7 +11185,8 @@ open_and_init_dwp_file (void) dwp_file->tus = create_dwp_hash_table (dwp_file, 1); /* The DWP file version is stored in the hash table. Oh well. */ - if (dwp_file->cus->version != dwp_file->tus->version) + if (dwp_file->cus && dwp_file->tus + && dwp_file->cus->version != dwp_file->tus->version) { /* Technically speaking, we should try to limp along, but this is pretty bizarre. We use pulongest here because that's the established @@ -11195,7 +11196,7 @@ open_and_init_dwp_file (void) pulongest (dwp_file->cus->version), pulongest (dwp_file->tus->version), dwp_name.c_str ()); } - dwp_file->version = dwp_file->cus->version; + dwp_file->version = dwp_file->cus ? dwp_file->cus->version : 0; if (dwp_file->version == 2) bfd_map_over_sections (dwp_file->dbfd, dwarf2_locate_v2_dwp_sections, --------------E4D75313B0FF6DF89456ADFD--