projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Constify regset structures.
[deliverable/binutils-gdb.git]
/
gdb
/
gcore.c
diff --git
a/gdb/gcore.c
b/gdb/gcore.c
index 24732e90586d0cb0449e92abeabf23c27b0c84f2..e22508010012e466e7a05d35bb68e9941b165239 100644
(file)
--- a/
gdb/gcore.c
+++ b/
gdb/gcore.c
@@
-1,6
+1,6
@@
/* Generate a core file for the inferior process.
/* Generate a core file for the inferior process.
- Copyright (C) 2001-201
3
Free Software Foundation, Inc.
+ Copyright (C) 2001-201
4
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-34,6
+34,7
@@
#include "regcache.h"
#include "regset.h"
#include "gdb_bfd.h"
#include "regcache.h"
#include "regset.h"
#include "gdb_bfd.h"
+#include "readline/tilde.h"
/* The largest amount of memory to read from the target at once. We
must throttle it to limit the amount of memory used by GDB during
/* The largest amount of memory to read from the target at once. We
must throttle it to limit the amount of memory used by GDB during
@@
-49,7
+50,7
@@
static int gcore_memory_sections (bfd *);
Open a new bfd core file for output, and return the handle. */
bfd *
Open a new bfd core file for output, and return the handle. */
bfd *
-create_gcore_bfd (char *filename)
+create_gcore_bfd (c
onst c
har *filename)
{
bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
{
bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
@@
-121,8
+122,9
@@
do_bfd_delete_cleanup (void *arg)
static void
gcore_command (char *args, int from_tty)
{
static void
gcore_command (char *args, int from_tty)
{
- struct cleanup *old_chain;
- char *corefilename, corefilename_buffer[40];
+ struct cleanup *filename_chain;
+ struct cleanup *bfd_chain;
+ char *corefilename;
bfd *obfd;
/* No use generating a corefile without a target process. */
bfd *obfd;
/* No use generating a corefile without a target process. */
@@
-130,14
+132,13
@@
gcore_command (char *args, int from_tty)
noprocess ();
if (args && *args)
noprocess ();
if (args && *args)
- corefilename =
args
;
+ corefilename =
tilde_expand (args)
;
else
{
/* Default corefile name is "core.PID". */
else
{
/* Default corefile name is "core.PID". */
- xsnprintf (corefilename_buffer, sizeof (corefilename_buffer),
- "core.%d", PIDGET (inferior_ptid));
- corefilename = corefilename_buffer;
+ corefilename = xstrprintf ("core.%d", ptid_get_pid (inferior_ptid));
}
}
+ filename_chain = make_cleanup (xfree, corefilename);
if (info_verbose)
fprintf_filtered (gdb_stdout,
if (info_verbose)
fprintf_filtered (gdb_stdout,
@@
-147,16
+148,17
@@
gcore_command (char *args, int from_tty)
obfd = create_gcore_bfd (corefilename);
/* Need a cleanup that will close and delete the file. */
obfd = create_gcore_bfd (corefilename);
/* Need a cleanup that will close and delete the file. */
-
ol
d_chain = make_cleanup (do_bfd_delete_cleanup, obfd);
+
bf
d_chain = make_cleanup (do_bfd_delete_cleanup, obfd);
/* Call worker function. */
write_gcore_file (obfd);
/* Succeeded. */
/* Call worker function. */
write_gcore_file (obfd);
/* Succeeded. */
- fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename);
-
- discard_cleanups (old_chain);
+ discard_cleanups (bfd_chain);
gdb_bfd_unref (obfd);
gdb_bfd_unref (obfd);
+
+ fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename);
+ do_cleanups (filename_chain);
}
static unsigned long
}
static unsigned long
@@
-266,13
+268,13
@@
call_target_sbrk (int sbrk_arg)
struct value *sbrk_fn, *ret;
bfd_vma tmp;
struct value *sbrk_fn, *ret;
bfd_vma tmp;
- if (lookup_minimal_symbol ("sbrk", NULL, NULL) != NULL)
+ if (lookup_minimal_symbol ("sbrk", NULL, NULL)
.minsym
!= NULL)
{
sbrk_fn = find_function_in_inferior ("sbrk", &sbrk_objf);
if (sbrk_fn == NULL)
return (bfd_vma) 0;
}
{
sbrk_fn = find_function_in_inferior ("sbrk", &sbrk_objf);
if (sbrk_fn == NULL)
return (bfd_vma) 0;
}
- else if (lookup_minimal_symbol ("_sbrk", NULL, NULL) != NULL)
+ else if (lookup_minimal_symbol ("_sbrk", NULL, NULL)
.minsym
!= NULL)
{
sbrk_fn = find_function_in_inferior ("_sbrk", &sbrk_objf);
if (sbrk_fn == NULL)
{
sbrk_fn = find_function_in_inferior ("_sbrk", &sbrk_objf);
if (sbrk_fn == NULL)
@@
-428,8
+430,9
@@
gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
This BFD was synthesized from reading target memory,
we don't want to omit that. */
This BFD was synthesized from reading target memory,
we don't want to omit that. */
- if (((vaddr >= start && vaddr + size <= end)
- || (start >= vaddr && end <= vaddr + size))
+ if (objfile->separate_debug_objfile_backlink == NULL
+ && ((vaddr >= start && vaddr + size <= end)
+ || (start >= vaddr && end <= vaddr + size))
&& !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
{
flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS);
&& !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
{
flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS);
@@
-468,8
+471,9
@@
gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
return 0;
}
return 0;
}
-static int
-objfile_find_memory_regions (find_memory_region_ftype func, void *obfd)
+int
+objfile_find_memory_regions (struct target_ops *self,
+ find_memory_region_ftype func, void *obfd)
{
/* Use objfile data to create memory sections. */
struct objfile *objfile;
{
/* Use objfile data to create memory sections. */
struct objfile *objfile;
@@
-604,5
+608,4
@@
Save a core file with the current state of the debugged process.\n\
Argument is optional filename. Default filename is 'core.<process_id>'."));
add_com_alias ("gcore", "generate-core-file", class_files, 1);
Argument is optional filename. Default filename is 'core.<process_id>'."));
add_com_alias ("gcore", "generate-core-file", class_files, 1);
- exec_set_find_memory_regions (objfile_find_memory_regions);
}
}
This page took
0.025704 seconds
and
4
git commands to generate.