mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 12:24:19 +08:00
constify exec_file_attach
This constifies exec_file_attach and updates the rest of gdb. Insight will need some minor tweaks after this, though it's worth noting that I think all that hook stuff can actually just go away. I sent a patch to this effect once, but since the Insight source repository situation isn't currently resolved there wasn't a convenient way to test it. 2014-07-30 Tom Tromey <tromey@redhat.com> * corefile.c (hook_type, call_extra_exec_file_hooks) (specify_exec_file_hook): Constify. * exec.c (exec_file_attach): Make "filename" const. * gdbcore.h (deprecated_exec_file_display_hook) (specify_exec_file_hook, exec_file_attach): Constify. * main.c (captured_main): Use catch_command_errors_const.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2014-07-30 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* corefile.c (hook_type, call_extra_exec_file_hooks)
|
||||||
|
(specify_exec_file_hook): Constify.
|
||||||
|
* exec.c (exec_file_attach): Make "filename" const.
|
||||||
|
* gdbcore.h (deprecated_exec_file_display_hook)
|
||||||
|
(specify_exec_file_hook, exec_file_attach): Constify.
|
||||||
|
* main.c (captured_main): Use catch_command_errors_const.
|
||||||
|
|
||||||
2014-07-30 Tom Tromey <tromey@redhat.com>
|
2014-07-30 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* target.c (open_target): New function.
|
* target.c (open_target): New function.
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
/* Local function declarations. */
|
/* Local function declarations. */
|
||||||
|
|
||||||
extern void _initialize_core (void);
|
extern void _initialize_core (void);
|
||||||
static void call_extra_exec_file_hooks (char *filename);
|
|
||||||
|
|
||||||
/* You can have any number of hooks for `exec_file_command' command to
|
/* You can have any number of hooks for `exec_file_command' command to
|
||||||
call. If there's only one hook, it is set in exec_file_display
|
call. If there's only one hook, it is set in exec_file_display
|
||||||
@ -50,7 +49,7 @@ static void call_extra_exec_file_hooks (char *filename);
|
|||||||
only one hook could be set, and which called
|
only one hook could be set, and which called
|
||||||
deprecated_exec_file_display_hook directly. */
|
deprecated_exec_file_display_hook directly. */
|
||||||
|
|
||||||
typedef void (*hook_type) (char *);
|
typedef void (*hook_type) (const char *);
|
||||||
|
|
||||||
hook_type deprecated_exec_file_display_hook; /* The original hook. */
|
hook_type deprecated_exec_file_display_hook; /* The original hook. */
|
||||||
static hook_type *exec_file_extra_hooks; /* Array of additional
|
static hook_type *exec_file_extra_hooks; /* Array of additional
|
||||||
@ -87,7 +86,7 @@ core_file_command (char *filename, int from_tty)
|
|||||||
functions. */
|
functions. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call_extra_exec_file_hooks (char *filename)
|
call_extra_exec_file_hooks (const char *filename)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ call_extra_exec_file_hooks (char *filename)
|
|||||||
This is called from the x-window display code. */
|
This is called from the x-window display code. */
|
||||||
|
|
||||||
void
|
void
|
||||||
specify_exec_file_hook (void (*hook) (char *))
|
specify_exec_file_hook (void (*hook) (const char *))
|
||||||
{
|
{
|
||||||
hook_type *new_array;
|
hook_type *new_array;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ exec_file_clear (int from_tty)
|
|||||||
we're supplying the exec pathname late for good reason.) */
|
we're supplying the exec pathname late for good reason.) */
|
||||||
|
|
||||||
void
|
void
|
||||||
exec_file_attach (char *filename, int from_tty)
|
exec_file_attach (const char *filename, int from_tty)
|
||||||
{
|
{
|
||||||
struct cleanup *cleanups;
|
struct cleanup *cleanups;
|
||||||
|
|
||||||
|
@ -127,14 +127,14 @@ extern void write_memory_signed_integer (CORE_ADDR addr, int len,
|
|||||||
|
|
||||||
/* Hook for `exec_file_command' command to call. */
|
/* Hook for `exec_file_command' command to call. */
|
||||||
|
|
||||||
extern void (*deprecated_exec_file_display_hook) (char *filename);
|
extern void (*deprecated_exec_file_display_hook) (const char *filename);
|
||||||
|
|
||||||
/* Hook for "file_command", which is more useful than above
|
/* Hook for "file_command", which is more useful than above
|
||||||
(because it is invoked AFTER symbols are read, not before). */
|
(because it is invoked AFTER symbols are read, not before). */
|
||||||
|
|
||||||
extern void (*deprecated_file_changed_hook) (char *filename);
|
extern void (*deprecated_file_changed_hook) (char *filename);
|
||||||
|
|
||||||
extern void specify_exec_file_hook (void (*hook) (char *filename));
|
extern void specify_exec_file_hook (void (*hook) (const char *filename));
|
||||||
|
|
||||||
/* Binary File Diddler for the core file. */
|
/* Binary File Diddler for the core file. */
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ extern int write_files;
|
|||||||
|
|
||||||
extern void core_file_command (char *filename, int from_tty);
|
extern void core_file_command (char *filename, int from_tty);
|
||||||
|
|
||||||
extern void exec_file_attach (char *filename, int from_tty);
|
extern void exec_file_attach (const char *filename, int from_tty);
|
||||||
|
|
||||||
extern void exec_file_clear (int from_tty);
|
extern void exec_file_clear (int from_tty);
|
||||||
|
|
||||||
|
@ -1068,16 +1068,16 @@ captured_main (void *data)
|
|||||||
/* The exec file and the symbol-file are the same. If we can't
|
/* The exec file and the symbol-file are the same. If we can't
|
||||||
open it, better only print one error message.
|
open it, better only print one error message.
|
||||||
catch_command_errors returns non-zero on success! */
|
catch_command_errors returns non-zero on success! */
|
||||||
if (catch_command_errors (exec_file_attach, execarg,
|
if (catch_command_errors_const (exec_file_attach, execarg,
|
||||||
!batch_flag, RETURN_MASK_ALL))
|
!batch_flag, RETURN_MASK_ALL))
|
||||||
catch_command_errors_const (symbol_file_add_main, symarg,
|
catch_command_errors_const (symbol_file_add_main, symarg,
|
||||||
!batch_flag, RETURN_MASK_ALL);
|
!batch_flag, RETURN_MASK_ALL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (execarg != NULL)
|
if (execarg != NULL)
|
||||||
catch_command_errors (exec_file_attach, execarg,
|
catch_command_errors_const (exec_file_attach, execarg,
|
||||||
!batch_flag, RETURN_MASK_ALL);
|
!batch_flag, RETURN_MASK_ALL);
|
||||||
if (symarg != NULL)
|
if (symarg != NULL)
|
||||||
catch_command_errors_const (symbol_file_add_main, symarg,
|
catch_command_errors_const (symbol_file_add_main, symarg,
|
||||||
!batch_flag, RETURN_MASK_ALL);
|
!batch_flag, RETURN_MASK_ALL);
|
||||||
|
Reference in New Issue
Block a user