Revert the previous 7 commits of: Validate binary before use
ddc98fbf2f
Create empty nat/linux-maps.[ch] and common/target-utils.[ch]6e5b4429db
Move gdb_regex* to common/f7af1fcd75
Prepare linux_find_memory_regions_full & co. for move9904185cfd
Move linux_find_memory_regions_full & co.700ca40f6f
gdbserver build-id attribute generatorca5268b6be
Validate symbol file using build-id0a94970d66
Tests for validate symbol file using build-id gdb/ChangeLog 2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com> 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 <jan.kratochvil@redhat.com> 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 <jan.kratochvil@redhat.com> Revert the previous 2 commits: gdbserver build-id attribute generator Validate symbol file using build-id gdb/testsuite/ChangeLog 2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com> Revert the previous commit: Tests for validate symbol file using build-id.
This commit is contained in:
parent
0a94970d66
commit
db1ff28b60
43 changed files with 830 additions and 1952 deletions
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 */
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue