From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29802 invoked by alias); 9 Nov 2009 21:01:46 -0000 Received: (qmail 29402 invoked by uid 22791); 9 Nov 2009 21:01:45 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Nov 2009 21:01:41 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA9L1d9h031945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Nov 2009 16:01:39 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA9L1aRx032192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 9 Nov 2009 16:01:39 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id nA9L1aKO019558 for ; Mon, 9 Nov 2009 22:01:36 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id nA9L1aiU019557 for gdb-patches@sourceware.org; Mon, 9 Nov 2009 22:01:36 +0100 Date: Mon, 09 Nov 2009 21:01:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 15/15] PIE: Drop PIE "GDB does NOT currently support" Message-ID: <20091109210136.GP19138@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes 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 X-SW-Source: 2009-11/txt/msg00182.txt.bz2 Hi, no longer true. Thanks, Jan gdb/ * linux-tdep.c: Remove includes gdbcore.h, observer.h and elf-bfd.h. (check_is_pie_binary, _initialize_linux_tdep): Remove. gdb/testsuite/ * gdb.base/pie-support.exp, gdb.base/pie-support.c: Remove. --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -18,13 +18,10 @@ along with this program. If not, see . */ #include "defs.h" -#include "gdbcore.h" #include "gdbtypes.h" #include "linux-tdep.h" -#include "observer.h" #include "auxv.h" #include "target.h" -#include "elf-bfd.h" #include "elf/common.h" /* This function is suitable for architectures that don't @@ -155,33 +152,3 @@ linux_has_shared_address_space (void) return target_is_uclinux; } - -/* Observer for the executable_changed event, to check whether the new - exec binary is a PIE (Position Independent Executable) specimen, which - is currently unsupported. */ - -static void -check_is_pie_binary (void) -{ - Elf_Internal_Ehdr *elf_hdr; - - if (!exec_bfd) - return; - else if (bfd_get_flavour (exec_bfd) != bfd_target_elf_flavour) - return; - - if (elf_tdata (exec_bfd)->elf_header->e_type == ET_DYN) - warning (_("\ -The current binary is a PIE (Position Independent Executable), which\n\ -GDB does NOT currently support. Most debugger features will fail if used\n\ -in this session.\n")); -} - -/* Provide a prototype to silence -Wmissing-prototypes. */ -extern initialize_file_ftype _initialize_linux_tdep; - -void -_initialize_linux_tdep (void) -{ - observer_attach_executable_changed (check_is_pie_binary); -} --- a/gdb/testsuite/gdb.base/pie-support.c +++ /dev/null @@ -1,34 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -#include - -void -f1 (int a) -{ - printf ("a = %d\n", a); -} - -int -main (int argc, char *argv[]) -{ - f1 (1); - - return 0; -} --- a/gdb/testsuite/gdb.base/pie-support.exp +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2009 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -set testfile pie-support -set srcfile ${testfile}.c -set objfile ${objdir}/${subdir}/${testfile}.o -set binfile ${objdir}/${subdir}/${testfile} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {quiet debug additional_flags=-fpie}] != "" } { - untested "Couldn't compile test PIE object file." - return -1 -} -if { [gdb_compile "${objfile}" "${binfile}" executable {quiet debug additional_flags=-pie}] != "" } { - untested "Couldn't compile test PIE binary." - return -1 -} - -# Get things started. - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir - -if [is_remote host] { - set binfile [remote_download host $binfile] - if { $binfile == "" } { - untested "Couldn't download remote test binary." - return -1 - } -} - -# The file command used to kill the remote target. For the benefit -# of the testsuite, preserve this behavior. -send_gdb "kill\n" -gdb_expect 120 { - -re "Kill the program being debugged. .y or n. $" { - send_gdb "y\n" - verbose "\t\tKilling previous program being debugged" - exp_continue - } - -re "$gdb_prompt $" { - # OK. - } -} - -gdb_test "file $binfile" "current binary is a PIE.*" "correctly detected PIE binary"