From db1ff28b60f8886b8d7c634f1db2f939ba47a13c Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 15 Jul 2015 20:27:32 +0200 Subject: Revert the previous 7 commits of: Validate binary before use ddc98fbf2fd9e244a215a4d09e559180dc573a14 Create empty nat/linux-maps.[ch] and common/target-utils.[ch] 6e5b4429db0d66e2d0b27e1bcfe4709f3dae73ed Move gdb_regex* to common/ f7af1fcd759fa126612018a5916cf808df7bb8bc Prepare linux_find_memory_regions_full & co. for move 9904185cfde13d6c6849f1f042c8e3b74974cf08 Move linux_find_memory_regions_full & co. 700ca40f6fc1addd7238f4ab57f76c095ad3c99f gdbserver build-id attribute generator ca5268b6be265580b91ef75c1a1a9815f581ae42 Validate symbol file using build-id 0a94970d663a053c523f23ac0d71deb25a77f709 Tests for validate symbol file using build-id gdb/ChangeLog 2015-07-15 Jan Kratochvil Revert the previous 6 commits: Create empty nat/linux-maps.[ch] and common/target-utils.[ch]. Move gdb_regex* to common/ Prepare linux_find_memory_regions_full & co. for move Move linux_find_memory_regions_full & co. gdbserver build-id attribute generator Validate symbol file using build-id gdb/gdbserver/ChangeLog 2015-07-15 Jan Kratochvil Revert the previous 3 commits: Move gdb_regex* to common/ Move linux_find_memory_regions_full & co. gdbserver build-id attribute generator gdb/doc/ChangeLog 2015-07-15 Jan Kratochvil Revert the previous 2 commits: gdbserver build-id attribute generator Validate symbol file using build-id gdb/testsuite/ChangeLog 2015-07-15 Jan Kratochvil Revert the previous commit: Tests for validate symbol file using build-id. --- gdb/target/target-utils.c | 100 ---------------------------------------------- gdb/target/target-utils.h | 35 ---------------- gdb/target/target.h | 11 ----- 3 files changed, 146 deletions(-) delete mode 100644 gdb/target/target-utils.c delete mode 100644 gdb/target/target-utils.h (limited to 'gdb/target') diff --git a/gdb/target/target-utils.c b/gdb/target/target-utils.c deleted file mode 100644 index cdfa6e6..0000000 --- a/gdb/target/target-utils.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Utility target functions for GDB, and GDBserver. - - Copyright (C) 2015 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 "common-defs.h" -#include "target/target-utils.h" - -LONGEST -read_alloc (gdb_byte **buf_p, int handle, read_alloc_pread_ftype *pread_func, - int padding) -{ - size_t buf_alloc, buf_pos; - gdb_byte *buf; - LONGEST n; - int target_errno; - - /* Start by reading up to 4K at a time. The target will throttle - this number down if necessary. */ - buf_alloc = 4096; - buf = xmalloc (buf_alloc); - buf_pos = 0; - while (1) - { - n = pread_func (handle, &buf[buf_pos], buf_alloc - buf_pos - padding, - buf_pos, &target_errno); - if (n <= 0) - { - if (n < 0 || (n == 0 && buf_pos == 0)) - xfree (buf); - else - *buf_p = buf; - if (n < 0) - { - /* An error occurred. */ - return -1; - } - else - { - /* Read all there was. */ - return buf_pos; - } - } - - buf_pos += n; - - /* If the buffer is filling up, expand it. */ - if (buf_alloc < buf_pos * 2) - { - buf_alloc *= 2; - buf = xrealloc (buf, buf_alloc); - } - } -} - -char * -read_stralloc (struct inferior *inf, const char *filename, - read_stralloc_func_ftype *func) -{ - gdb_byte *buffer; - char *bufstr; - LONGEST i, transferred; - - transferred = func (inf, filename, &buffer, 1); - bufstr = (char *) buffer; - - if (transferred < 0) - return NULL; - - if (transferred == 0) - return xstrdup (""); - - bufstr[transferred] = 0; - - /* Check for embedded NUL bytes; but allow trailing NULs. */ - for (i = strlen (bufstr); i < transferred; i++) - if (bufstr[i] != 0) - { - warning (_("target file %s " - "contained unexpected null characters"), - filename); - break; - } - - return bufstr; -} diff --git a/gdb/target/target-utils.h b/gdb/target/target-utils.h deleted file mode 100644 index e8bf52a..0000000 --- a/gdb/target/target-utils.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Utility target functions for GDB, and GDBserver. - - Copyright (C) 2015 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 . */ - -#ifndef TARGET_TARGET_UTILS_H -#define TARGET_TARGET_UTILS_H - -typedef int (read_alloc_pread_ftype) (int handle, gdb_byte *read_buf, int len, - ULONGEST offset, int *target_errno); -extern LONGEST read_alloc (gdb_byte **buf_p, int handle, - read_alloc_pread_ftype *pread_func, int padding); - -struct inferior; -typedef LONGEST (read_stralloc_func_ftype) (struct inferior *inf, - const char *filename, - gdb_byte **buf_p, int padding); -extern char *read_stralloc (struct inferior *inf, const char *filename, - read_stralloc_func_ftype *func); - -#endif /* TARGET_TARGET_UTILS_H */ diff --git a/gdb/target/target.h b/gdb/target/target.h index 4c85fe0..6ee0fee 100644 --- a/gdb/target/target.h +++ b/gdb/target/target.h @@ -70,15 +70,4 @@ extern void target_stop_and_wait (ptid_t ptid); extern void target_continue_no_signal (ptid_t ptid); -/* Read target file FILENAME, in the filesystem as seen by INF. If - INF is NULL, use the filesystem seen by the debugger (GDB or, for - remote targets, the remote stub). The result is NUL-terminated and - returned as a string, allocated using xmalloc. If an error occurs - or the transfer is unsupported, NULL is returned. Empty objects - are returned as allocated but empty strings. A warning is issued - if the result contains any embedded NUL bytes. */ -struct inferior; -extern char *target_fileio_read_stralloc (struct inferior *inf, - const char *filename); - #endif /* TARGET_COMMON_H */ -- cgit v1.1