aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-tdep.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2009-08-04 20:41:13 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2009-08-04 20:41:13 +0000
commit6b3ae8188c8d9755f820786e86eb40625dabe2bb (patch)
treec019b319e1b8d26d8625d1b884b487baef7ac05b /gdb/linux-tdep.c
parente3c69974ac166b09a48d5b0a971cf4833d293b90 (diff)
downloadgdb-6b3ae8188c8d9755f820786e86eb40625dabe2bb.zip
gdb-6b3ae8188c8d9755f820786e86eb40625dabe2bb.tar.gz
gdb-6b3ae8188c8d9755f820786e86eb40625dabe2bb.tar.bz2
2009-08-04 Thiago Jung Bauermann <thiago.bauermann@gmail.com>
gdb/ * linux-tdep.c (check_is_pie_binary, _initialize_linux_tdep): New functions. gdb/testsuite/ * gdb.base/pie-support.exp: New file. * gdb.base/pie-support.c: New file.
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r--gdb/linux-tdep.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 37770f5..6634703 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -18,8 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdbcore.h"
#include "gdbtypes.h"
#include "linux-tdep.h"
+#include "observer.h"
+
+#include "elf-bfd.h"
/* This function is suitable for architectures that don't
extend/override the standard siginfo structure. */
@@ -134,3 +138,30 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
return siginfo_type;
}
+
+/* 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"));
+}
+
+void
+_initialize_linux_tdep (void)
+{
+ observer_attach_executable_changed (check_is_pie_binary);
+}