diff options
author | Pedro Alves <palves@redhat.com> | 2012-01-27 19:23:43 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-01-27 19:23:43 +0000 |
commit | be07f1a20c962deb662b93209b4ca91bc8e5cbd8 (patch) | |
tree | c46c5b008a5c786ff58b86259640972d3cec1409 /gdb/gdbserver/linux-low.c | |
parent | 8c85a4e2f7b1b536104ffcb95f843fb048c229e9 (diff) | |
download | gdb-be07f1a20c962deb662b93209b4ca91bc8e5cbd8.zip gdb-be07f1a20c962deb662b93209b4ca91bc8e5cbd8.tar.gz gdb-be07f1a20c962deb662b93209b4ca91bc8e5cbd8.tar.bz2 |
2012-01-27 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_child_pid_to_exec_file): Delete.
(elf_64_file_p): Make static.
(linux_pid_exe_is_elf_64_file): New.
* linux-low.h (linux_child_pid_to_exec_file, elf_64_file_p):
Delete declarations.
(linux_pid_exe_is_elf_64_file): Declare.
* linux-x86-low.c (x86_arch_setup): Use
linux_pid_exe_is_elf_64_file.
Diffstat (limited to 'gdb/gdbserver/linux-low.c')
-rw-r--r-- | gdb/gdbserver/linux-low.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 45aeb73..0a8b3de 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -186,32 +186,6 @@ static int linux_event_pipe[2] = { -1, -1 }; static void send_sigstop (struct lwp_info *lwp); static void wait_for_sigstop (struct inferior_list_entry *entry); -/* Accepts an integer PID; Returns a string representing a file that - can be opened to get info for the child process. - Space for the result is malloc'd, caller must free. */ - -char * -linux_child_pid_to_exec_file (int pid) -{ - char *name1, *name2; - - name1 = xmalloc (MAXPATHLEN); - name2 = xmalloc (MAXPATHLEN); - memset (name2, 0, MAXPATHLEN); - - sprintf (name1, "/proc/%d/exe", pid); - if (readlink (name1, name2, MAXPATHLEN) > 0) - { - free (name1); - return name2; - } - else - { - free (name2); - return name1; - } -} - /* Return non-zero if HEADER is a 64-bit ELF file. */ static int @@ -228,7 +202,7 @@ elf_64_header_p (const Elf64_Ehdr *header) zero if the file is not a 64-bit ELF file, and -1 if the file is not accessible or doesn't exist. */ -int +static int elf_64_file_p (const char *file) { Elf64_Ehdr header; @@ -248,6 +222,18 @@ elf_64_file_p (const char *file) return elf_64_header_p (&header); } +/* Accepts an integer PID; Returns true if the executable PID is + running is a 64-bit ELF file.. */ + +int +linux_pid_exe_is_elf_64_file (int pid) +{ + char file[MAXPATHLEN]; + + sprintf (file, "/proc/%d/exe", pid); + return elf_64_file_p (file); +} + static void delete_lwp (struct lwp_info *lwp) { |