From patchwork Thu Feb 13 06:19:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 38018 Received: (qmail 64912 invoked by alias); 13 Feb 2020 06:19:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 64904 invoked by uid 89); 13 Feb 2020 06:19:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:debug_f X-HELO: mail-pj1-f74.google.com Received: from mail-pj1-f74.google.com (HELO mail-pj1-f74.google.com) (209.85.216.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2020 06:19:09 +0000 Received: by mail-pj1-f74.google.com with SMTP id hi12so2900864pjb.7 for ; Wed, 12 Feb 2020 22:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=3qLnAIbGQMfxWzmW5OoU6I/58nUTLdfYSLxnZpGTbSo=; b=vNbw2VRUQGFa4Qdhr405XLUE/onoWakvlTOct6wTM1L6f6hdeI9Y3lsp6EXuTqsf1P /MeqvgUEh+wSWreqCMWSw+K8uqY27+d6KyR6uolpVseQlIQF0ppKpaqYTHZcq6WVUS9x SBZpxIn5jTONtMCQnRG4u6gYnCqKm7DwtAC+nK6Xa1NB5f2THLVYuV6G83cT5bQOYAcK JrUBj4nzGHGiHuss+XLEowNnwgIRB8rBthuGFQeszriNJeVClrmf3pjPqXHaOz0M8ICp j/yMDVOjb8IfppmxpDoPmExygYF04efdOs5iM5eApsqVXGAtzIbJg2umimVp5cOOcSXo oAQA== Date: Wed, 12 Feb 2020 22:19:03 -0800 Message-Id: <20200213061903.83384-1-tamur@google.com> Mime-Version: 1.0 Subject: [PATCH] Search .dwo in the binary directory. X-Patchwork-Original-From: "Ali Tamur via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Ali Tamur To: gdb-patches@sourceware.org Cc: Nitika.Achra@amd.com, JiniSusan.George@amd.com, Ali Tamur X-IsSubscribed: yes .dwo files generated by the compiler usually resides in the same directory as the generated binary itself. Add that binary to the list of directories to search when searching for the .dwo file. gdb/ChangeLog: * dwarf2/read.c (try_open_dwop_file): Include binary directory to the list of directories to search. Search the path also when looking for a .dwo file. --- gdb/dwarf2/read.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7edbd9d7df..39f583e758 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12012,9 +12012,14 @@ try_open_dwop_file (struct dwarf2_per_objfile *dwarf2_per_objfile, else search_path = debug_file_directory; + /* Add the directory of the binary to the search list. */ + search_path_holder.reset( + concat (ldirname (dwarf2_per_objfile->objfile->original_name).c_str (), + dirname_separator_string, search_path, (char *) NULL)); + search_path = search_path_holder.get (); + openp_flags flags = OPF_RETURN_REALPATH; - if (is_dwp) - flags |= OPF_SEARCH_IN_PATH; + flags |= OPF_SEARCH_IN_PATH; gdb::unique_xmalloc_ptr absolute_name; desc = openp (search_path, flags, file_name,