diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-08-04 20:41:13 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-08-04 20:41:13 +0000 |
commit | 69f260e218e1b6f87f92c459ef462c9188b8d29a (patch) | |
tree | 394ecf1fb3d77c8d504fb2bb203138eb4b80cb96 /gdb/linux-tdep.c | |
parent | b9cd7676d0e4aba49b2d3882c2e1481866e9b015 (diff) | |
download | gdb-69f260e218e1b6f87f92c459ef462c9188b8d29a.tar.gz |
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.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 37770f5f5b9..66347030392 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); +} |