diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:36:23 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:46:02 -0500 |
commit | c583a2520616c2736cffc389c89a48b159366e6c (patch) | |
tree | b4925f26506fcee96c16119431c01760f05db95d /gdb/guile | |
parent | ca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff) | |
download | binutils-users/simark/clang-format.zip binutils-users/simark/clang-format.tar.gz binutils-users/simark/clang-format.tar.bz2 |
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
Diffstat (limited to 'gdb/guile')
-rw-r--r-- | gdb/guile/guile-internal.h | 175 | ||||
-rw-r--r-- | gdb/guile/guile.c | 210 | ||||
-rw-r--r-- | gdb/guile/scm-arch.c | 120 | ||||
-rw-r--r-- | gdb/guile/scm-auto-load.c | 14 | ||||
-rw-r--r-- | gdb/guile/scm-block.c | 120 | ||||
-rw-r--r-- | gdb/guile/scm-breakpoint.c | 294 | ||||
-rw-r--r-- | gdb/guile/scm-cmd.c | 157 | ||||
-rw-r--r-- | gdb/guile/scm-disasm.c | 72 | ||||
-rw-r--r-- | gdb/guile/scm-exception.c | 136 | ||||
-rw-r--r-- | gdb/guile/scm-frame.c | 184 | ||||
-rw-r--r-- | gdb/guile/scm-gsmob.c | 41 | ||||
-rw-r--r-- | gdb/guile/scm-iterator.c | 38 | ||||
-rw-r--r-- | gdb/guile/scm-lazy-string.c | 80 | ||||
-rw-r--r-- | gdb/guile/scm-math.c | 320 | ||||
-rw-r--r-- | gdb/guile/scm-objfile.c | 62 | ||||
-rw-r--r-- | gdb/guile/scm-param.c | 388 | ||||
-rw-r--r-- | gdb/guile/scm-ports.c | 213 | ||||
-rw-r--r-- | gdb/guile/scm-pretty-print.c | 190 | ||||
-rw-r--r-- | gdb/guile/scm-progspace.c | 64 | ||||
-rw-r--r-- | gdb/guile/scm-safe-call.c | 19 | ||||
-rw-r--r-- | gdb/guile/scm-string.c | 33 | ||||
-rw-r--r-- | gdb/guile/scm-symbol.c | 146 | ||||
-rw-r--r-- | gdb/guile/scm-symtab.c | 77 | ||||
-rw-r--r-- | gdb/guile/scm-type.c | 201 | ||||
-rw-r--r-- | gdb/guile/scm-utils.c | 102 | ||||
-rw-r--r-- | gdb/guile/scm-value.c | 490 |
26 files changed, 1748 insertions, 2198 deletions
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h index 42ecb3c..5200ce9 100644 --- a/gdb/guile/guile-internal.h +++ b/gdb/guile/guile-internal.h @@ -23,7 +23,6 @@ /* See README file in this directory for implementation notes, coding conventions, et.al. */ - #include "hashtab.h" #include "extension-priv.h" #include "symtab.h" @@ -50,7 +49,10 @@ struct scheme_variable /* End of scheme_variable table mark. */ -#define END_VARIABLES { NULL, SCM_BOOL_F, NULL } +#define END_VARIABLES \ + { \ + NULL, SCM_BOOL_F, NULL \ + } /* Although scm_t_subr is meant to hold a function pointer, at least in some versions of guile, it is actually a typedef to "void *". @@ -102,7 +104,10 @@ struct scheme_function /* End of scheme_function table mark. */ -#define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL } +#define END_FUNCTIONS \ + { \ + NULL, 0, 0, 0, NULL, NULL \ + } /* Useful for defining a set of constants. */ @@ -112,7 +117,10 @@ struct scheme_integer_constant int value; }; -#define END_INTEGER_CONSTANTS { NULL, 0 } +#define END_INTEGER_CONSTANTS \ + { \ + NULL, 0 \ + } /* Pass this instead of 0 to routines like SCM_ASSERT to indicate the value is not a function argument. */ @@ -174,7 +182,7 @@ extern SCM gdbscm_invalid_object_error_symbol; extern SCM gdbscm_map_string; extern SCM gdbscm_array_string; extern SCM gdbscm_string_string; - + /* scm-utils.c */ extern void gdbscm_define_variables (const scheme_variable *, int is_public); @@ -210,10 +218,10 @@ extern int gdbscm_is_procedure (SCM proc); extern char *gdbscm_gc_xstrdup (const char *); -extern const char * const *gdbscm_gc_dup_argv (char **argv); +extern const char *const *gdbscm_gc_dup_argv (char **argv); extern int gdbscm_guile_version_is_at_least (int major, int minor, int micro); - + /* GDB smobs, from scm-gsmob.c */ /* All gdb smobs must contain one of the following as the first member: @@ -237,8 +245,7 @@ extern int gdbscm_guile_version_is_at_least (int major, int minor, int micro); gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD to ensure this. */ -#define GDB_SMOB_HEAD \ - int empty_base_class; +#define GDB_SMOB_HEAD int empty_base_class; struct gdb_smob { @@ -290,15 +297,15 @@ extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, extern htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn, htab_eq eq_fn); -extern eqable_gdb_smob **gdbscm_find_eqable_gsmob_ptr_slot - (htab_t htab, eqable_gdb_smob *base); +extern eqable_gdb_smob ** +gdbscm_find_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base); extern void gdbscm_fill_eqable_gsmob_ptr_slot (eqable_gdb_smob **slot, eqable_gdb_smob *base); extern void gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base); - + /* Exceptions and calling out to Guile. */ /* scm-exception.c */ @@ -313,8 +320,8 @@ extern SCM gdbscm_exception_args (SCM excp); extern SCM gdbscm_make_exception_with_stack (SCM key, SCM args, SCM stack); -extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message, - SCM args, SCM data); +extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message, SCM args, + SCM data); extern SCM gdbscm_make_error (SCM key, const char *subr, const char *message, SCM args, SCM data); @@ -326,39 +333,38 @@ extern SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos, SCM bad_value, const char *error); extern void gdbscm_invalid_object_error (const char *subr, int arg_pos, - SCM bad_value, const char *error) - ATTRIBUTE_NORETURN; + SCM bad_value, + const char *error) ATTRIBUTE_NORETURN; extern SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos, SCM bad_value, const char *error); extern void gdbscm_out_of_range_error (const char *subr, int arg_pos, - SCM bad_value, const char *error) - ATTRIBUTE_NORETURN; + SCM bad_value, + const char *error) ATTRIBUTE_NORETURN; extern SCM gdbscm_make_misc_error (const char *subr, int arg_pos, SCM bad_value, const char *error); -extern void gdbscm_misc_error (const char *subr, int arg_pos, - SCM bad_value, const char *error) - ATTRIBUTE_NORETURN; +extern void gdbscm_misc_error (const char *subr, int arg_pos, SCM bad_value, + const char *error) ATTRIBUTE_NORETURN; extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN; struct gdbscm_gdb_exception; -extern SCM gdbscm_scm_from_gdb_exception - (const gdbscm_gdb_exception &exception); +extern SCM +gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception); -extern void gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception) - ATTRIBUTE_NORETURN; +extern void +gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception) ATTRIBUTE_NORETURN; -extern void gdbscm_print_exception_with_stack (SCM port, SCM stack, - SCM key, SCM args); +extern void gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, + SCM args); extern void gdbscm_print_gdb_exception (SCM port, SCM exception); -extern gdb::unique_xmalloc_ptr<char> gdbscm_exception_message_to_string - (SCM exception); +extern gdb::unique_xmalloc_ptr<char> +gdbscm_exception_message_to_string (SCM exception); extern excp_matcher_func gdbscm_memory_error_p; @@ -367,12 +373,13 @@ extern excp_matcher_func gdbscm_user_error_p; extern SCM gdbscm_make_memory_error (const char *subr, const char *msg, SCM args); -extern void gdbscm_memory_error (const char *subr, const char *msg, SCM args) - ATTRIBUTE_NORETURN; +extern void gdbscm_memory_error (const char *subr, const char *msg, + SCM args) ATTRIBUTE_NORETURN; /* scm-safe-call.c */ -extern const char *gdbscm_with_guile (const char *(*func) (void *), void *data); +extern const char *gdbscm_with_guile (const char *(*func) (void *), + void *data); extern SCM gdbscm_call_guile (SCM (*func) (void *), void *data, excp_matcher_func *ok_excps); @@ -389,22 +396,21 @@ extern SCM gdbscm_safe_call_3 (SCM proc, SCM arg0, SCM arg1, SCM arg2, excp_matcher_func *ok_excps); extern SCM gdbscm_safe_call_4 (SCM proc, SCM arg0, SCM arg1, SCM arg2, - SCM arg3, - excp_matcher_func *ok_excps); + SCM arg3, excp_matcher_func *ok_excps); extern SCM gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM args, excp_matcher_func *ok_excps); extern SCM gdbscm_unsafe_call_1 (SCM proc, SCM arg0); -extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_eval_string - (const char *string, int display_result); +extern gdb::unique_xmalloc_ptr<char> +gdbscm_safe_eval_string (const char *string, int display_result); -extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_source_script - (const char *filename); +extern gdb::unique_xmalloc_ptr<char> +gdbscm_safe_source_script (const char *filename); extern void gdbscm_enter_repl (void); - + /* Interface to various GDB objects, in alphabetical order. */ /* scm-arch.c */ @@ -423,8 +429,9 @@ extern SCM arscm_scm_from_arch (struct gdbarch *gdbarch); extern SCM bkscm_scm_from_block (const struct block *block, struct objfile *objfile); -extern const struct block *bkscm_scm_to_block - (SCM block_scm, int arg_pos, const char *func_name, SCM *excp); +extern const struct block *bkscm_scm_to_block (SCM block_scm, int arg_pos, + const char *func_name, + SCM *excp); /* scm-cmd.c */ @@ -482,14 +489,13 @@ extern int lsscm_is_lazy_string (SCM scm); extern SCM lsscm_make_lazy_string (CORE_ADDR address, int length, const char *encoding, struct type *type); -extern struct value *lsscm_safe_lazy_string_to_value (SCM string, - int arg_pos, +extern struct value *lsscm_safe_lazy_string_to_value (SCM string, int arg_pos, const char *func_name, SCM *except_scmp); -extern void lsscm_val_print_lazy_string - (SCM string, struct ui_file *stream, - const struct value_print_options *options); +extern void +lsscm_val_print_lazy_string (SCM string, struct ui_file *stream, + const struct value_print_options *options); /* scm-objfile.c */ @@ -520,16 +526,17 @@ extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_c_string (SCM string); extern SCM gdbscm_scm_from_c_string (const char *string); extern SCM gdbscm_scm_from_printf (const char *format, ...) - ATTRIBUTE_PRINTF (1, 2); + ATTRIBUTE_PRINTF (1, 2); -extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_string - (SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp); +extern gdb::unique_xmalloc_ptr<char> +gdbscm_scm_to_string (SCM string, size_t *lenp, const char *charset, + int strict, SCM *except_scmp); extern SCM gdbscm_scm_from_string (const char *string, size_t len, const char *charset, int strict); -extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_host_string - (SCM string, size_t *lenp, SCM *except); +extern gdb::unique_xmalloc_ptr<char> +gdbscm_scm_to_host_string (SCM string, size_t *lenp, SCM *except); extern SCM gdbscm_scm_from_host_string (const char *string, size_t len); @@ -539,8 +546,9 @@ extern int syscm_is_symbol (SCM scm); extern SCM syscm_scm_from_symbol (struct symbol *symbol); -extern struct symbol *syscm_get_valid_symbol_arg_unsafe - (SCM self, int arg_pos, const char *func_name); +extern struct symbol * +syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos, + const char *func_name); /* scm-symtab.c */ @@ -574,15 +582,15 @@ extern int vlscm_is_value (SCM scm); extern SCM vlscm_scm_from_value (struct value *value); extern SCM vlscm_scm_from_value_no_release (struct value *value); -extern struct value *vlscm_convert_typed_value_from_scheme - (const char *func_name, int obj_arg_pos, SCM obj, - int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp, - struct gdbarch *gdbarch, const struct language_defn *language); +extern struct value *vlscm_convert_typed_value_from_scheme ( + const char *func_name, int obj_arg_pos, SCM obj, int type_arg_pos, + SCM type_scm, struct type *type, SCM *except_scmp, struct gdbarch *gdbarch, + const struct language_defn *language); + +extern struct value *vlscm_convert_value_from_scheme ( + const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp, + struct gdbarch *gdbarch, const struct language_defn *language); -extern struct value *vlscm_convert_value_from_scheme - (const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp, - struct gdbarch *gdbarch, const struct language_defn *language); - /* stript_lang methods */ extern objfile_script_sourcer_func gdbscm_source_objfile_script; @@ -593,23 +601,23 @@ extern objfile_script_executor_func gdbscm_execute_objfile_script; extern bool gdbscm_auto_load_enabled (const struct extension_language_defn *); -extern void gdbscm_preserve_values - (const struct extension_language_defn *, - struct objfile *, htab_t copied_types); +extern void gdbscm_preserve_values (const struct extension_language_defn *, + struct objfile *, htab_t copied_types); -extern enum ext_lang_rc gdbscm_apply_val_pretty_printer - (const struct extension_language_defn *, - struct value *val, - struct ui_file *stream, int recurse, - const struct value_print_options *options, - const struct language_defn *language); +extern enum ext_lang_rc +gdbscm_apply_val_pretty_printer (const struct extension_language_defn *, + struct value *val, struct ui_file *stream, + int recurse, + const struct value_print_options *options, + const struct language_defn *language); extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *, struct breakpoint *b); -extern enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop - (const struct extension_language_defn *, struct breakpoint *b); - +extern enum ext_lang_bp_stop +gdbscm_breakpoint_cond_says_stop (const struct extension_language_defn *, + struct breakpoint *b); + /* Initializers for each piece of Scheme support, in alphabetical order. */ extern void gdbscm_initialize_arches (void); @@ -634,7 +642,6 @@ extern void gdbscm_initialize_symbols (void); extern void gdbscm_initialize_symtabs (void); extern void gdbscm_initialize_types (void); extern void gdbscm_initialize_values (void); - /* A complication with the Guile code is that we have two types of exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ @@ -675,14 +682,16 @@ unpack (const gdb_exception &exc) /* Use this after a TRY/CATCH to throw the appropriate Scheme exception if a GDB error occurred. */ -#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \ - do { \ - if (exception.reason < 0) \ - { \ - gdbscm_throw_gdb_exception (exception); \ - /*NOTREACHED */ \ - } \ - } while (0) +#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \ + do \ + { \ + if (exception.reason < 0) \ + { \ + gdbscm_throw_gdb_exception (exception); \ + /*NOTREACHED */ \ + } \ + } \ + while (0) /* Use this to wrap a callable to throw the appropriate Scheme exception if the callable throws a GDB error. ARGS are forwarded @@ -695,7 +704,7 @@ unpack (const gdb_exception &exc) template<typename Function, typename... Args> SCM -gdbscm_wrap (Function &&func, Args &&... args) +gdbscm_wrap (Function &&func, Args &&...args) { SCM result = SCM_BOOL_F; gdbscm_gdb_exception exc {}; diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 887b7fa..d3b7bcc 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -58,13 +58,9 @@ const char gdbscm_print_excp_full[] = "full"; const char gdbscm_print_excp_message[] = "message"; /* "set guile print-stack" choices. */ -static const char *const guile_print_excp_enums[] = - { - gdbscm_print_excp_none, - gdbscm_print_excp_full, - gdbscm_print_excp_message, - NULL - }; +static const char *const guile_print_excp_enums[] + = { gdbscm_print_excp_none, gdbscm_print_excp_full, + gdbscm_print_excp_message, NULL }; /* The exception printing variable. 'full' if we want to print the error message and stack, 'none' if we want to print nothing, and @@ -72,13 +68,13 @@ static const char *const guile_print_excp_enums[] = the default. */ const char *gdbscm_print_excp = gdbscm_print_excp_message; - #ifdef HAVE_GUILE static void gdbscm_initialize (const struct extension_language_defn *); static int gdbscm_initialized (const struct extension_language_defn *); -static void gdbscm_eval_from_control_command - (const struct extension_language_defn *, struct command_line *); +static void +gdbscm_eval_from_control_command (const struct extension_language_defn *, + struct command_line *); static script_sourcer_func gdbscm_source_script; static void gdbscm_set_backtrace (int enable); @@ -100,18 +96,13 @@ static const char boot_scm_filename[] = "boot.scm"; /* The interface between gdb proper and loading of python scripts. */ -static const struct extension_language_script_ops guile_extension_script_ops = -{ - gdbscm_source_script, - gdbscm_source_objfile_script, - gdbscm_execute_objfile_script, - gdbscm_auto_load_enabled -}; +static const struct extension_language_script_ops guile_extension_script_ops + = { gdbscm_source_script, gdbscm_source_objfile_script, + gdbscm_execute_objfile_script, gdbscm_auto_load_enabled }; /* The interface between gdb proper and guile scripting. */ -static const struct extension_language_ops guile_extension_ops = -{ +static const struct extension_language_ops guile_extension_ops = { gdbscm_initialize, gdbscm_initialized, @@ -141,25 +132,23 @@ static const struct extension_language_ops guile_extension_ops = /* The main struct describing GDB's interface to the Guile extension language. */ -extern const struct extension_language_defn extension_language_guile = -{ - EXT_LANG_GUILE, - "guile", - "Guile", +extern const struct extension_language_defn extension_language_guile + = { EXT_LANG_GUILE, + "guile", + "Guile", - ".scm", - "-gdb.scm", + ".scm", + "-gdb.scm", - guile_control, + guile_control, #ifdef HAVE_GUILE - &guile_extension_script_ops, - &guile_extension_ops + &guile_extension_script_ops, + &guile_extension_ops #else - NULL, - NULL + NULL, NULL #endif -}; + }; #ifdef HAVE_GUILE /* Implementation of the gdb "guile-repl" command. */ @@ -178,7 +167,7 @@ guile_repl_command (const char *arg, int from_tty) sort it out, we forbid arguments. */ if (arg && *arg) - error (_("guile-repl currently does not take any arguments.")); + error (_ ("guile-repl currently does not take any arguments.")); else { dont_repeat (); @@ -249,13 +238,13 @@ compute_scheme_string (struct command_line *l) This is the extension_language_ops.eval_from_control_command "method". */ static void -gdbscm_eval_from_control_command - (const struct extension_language_defn *extlang, struct command_line *cmd) +gdbscm_eval_from_control_command ( + const struct extension_language_defn *extlang, struct command_line *cmd) { char *script; if (cmd->body_list_1 != nullptr) - error (_("Invalid \"guile\" block structure.")); + error (_ ("Invalid \"guile\" block structure.")); script = compute_scheme_string (cmd->body_list_0.get ()); gdb::unique_xmalloc_ptr<char> msg = gdbscm_safe_eval_string (script, 0); @@ -279,7 +268,7 @@ gdbscm_source_script (const struct extension_language_defn *extlang, if (msg != NULL) gdb_printf (gdb_stderr, "%s\n", msg.get ()); } - + /* (execute string [#:from-tty boolean] [#:to-string boolean]) A Scheme function which evaluates a string using the gdb CLI. */ @@ -292,31 +281,28 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest) char *command; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt", - command_scm, &command, rest, - &from_tty_arg_pos, &from_tty, - &to_string_arg_pos, &to_string); + command_scm, &command, rest, &from_tty_arg_pos, + &from_tty, &to_string_arg_pos, &to_string); - return gdbscm_wrap ([=] - { - gdb::unique_xmalloc_ptr<char> command_holder (command); - std::string to_string_res; + return gdbscm_wrap ([=] { + gdb::unique_xmalloc_ptr<char> command_holder (command); + std::string to_string_res; - scoped_restore restore_async = make_scoped_restore (¤t_ui->async, - 0); + scoped_restore restore_async = make_scoped_restore (¤t_ui->async, 0); - scoped_restore preventer = prevent_dont_repeat (); - if (to_string) - execute_command_to_string (to_string_res, command, from_tty, false); - else - execute_command (command, from_tty); + scoped_restore preventer = prevent_dont_repeat (); + if (to_string) + execute_command_to_string (to_string_res, command, from_tty, false); + else + execute_command (command, from_tty); - /* Do any commands attached to breakpoint we stopped at. */ - bpstat_do_actions (); + /* Do any commands attached to breakpoint we stopped at. */ + bpstat_do_actions (); - if (to_string) - return gdbscm_scm_from_c_string (to_string_res.c_str ()); - return SCM_UNSPECIFIED; - }); + if (to_string) + return gdbscm_scm_from_c_string (to_string_res.c_str ()); + return SCM_UNSPECIFIED; + }); } /* (data-directory) -> string */ @@ -369,8 +355,8 @@ guile_repl_command (const char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) - error (_("guile-repl currently does not take any arguments.")); - error (_("Guile scripting is not supported in this copy of GDB.")); + error (_ ("guile-repl currently does not take any arguments.")); + error (_ ("Guile scripting is not supported in this copy of GDB.")); } static void @@ -378,7 +364,7 @@ guile_command (const char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) - error (_("Guile scripting is not supported in this copy of GDB.")); + error (_ ("Guile scripting is not supported in this copy of GDB.")); else { /* Even if Guile isn't enabled, we still have to slurp the @@ -390,22 +376,19 @@ guile_command (const char *arg, int from_tty) } #endif /* ! HAVE_GUILE */ - + /* Lists for 'set,show,info guile' commands. */ static struct cmd_list_element *set_guile_list; static struct cmd_list_element *show_guile_list; static struct cmd_list_element *info_guile_list; - /* Initialization. */ #ifdef HAVE_GUILE -static const scheme_function misc_guile_functions[] = -{ - { "execute", 1, 0, 1, as_a_scm_t_subr (gdbscm_execute_gdb_command), - "\ +static const scheme_function misc_guile_functions[] + = { { "execute", 1, 0, 1, as_a_scm_t_subr (gdbscm_execute_gdb_command), "\ Execute the given GDB command.\n\ \n\ Arguments: string [#:to-string boolean] [#:from-tty boolean]\n\ @@ -417,29 +400,23 @@ Execute the given GDB command.\n\ Returns: The result of the command if #:to-string is true.\n\ Otherwise returns unspecified." }, - { "data-directory", 0, 0, 0, as_a_scm_t_subr (gdbscm_data_directory), - "\ + { "data-directory", 0, 0, 0, as_a_scm_t_subr (gdbscm_data_directory), "\ Return the name of GDB's data directory." }, - { "guile-data-directory", 0, 0, 0, - as_a_scm_t_subr (gdbscm_guile_data_directory), - "\ + { "guile-data-directory", 0, 0, 0, + as_a_scm_t_subr (gdbscm_guile_data_directory), "\ Return the name of the Guile directory within GDB's data directory." }, - { "gdb-version", 0, 0, 0, as_a_scm_t_subr (gdbscm_gdb_version), - "\ + { "gdb-version", 0, 0, 0, as_a_scm_t_subr (gdbscm_gdb_version), "\ Return GDB's version string." }, - { "host-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_host_config), - "\ + { "host-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_host_config), "\ Return the name of the host configuration." }, - { "target-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_target_config), - "\ + { "target-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_target_config), "\ Return the name of the target configuration." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; /* Load BOOT_SCM_FILE, the first Scheme file that gets loaded. */ @@ -463,8 +440,7 @@ boot_guile_support (void *boot_scm_file) static int standard_throw_args_p (SCM args) { - if (gdbscm_is_true (scm_list_p (args)) - && scm_ilength (args) >= 3) + if (gdbscm_is_true (scm_list_p (args)) && scm_ilength (args) >= 3) { /* The function in which the error occurred. */ SCM arg0 = scm_list_ref (args, scm_from_int (0)); @@ -474,8 +450,7 @@ standard_throw_args_p (SCM args) SCM arg2 = scm_list_ref (args, scm_from_int (2)); if ((scm_is_string (arg0) || gdbscm_is_false (arg0)) - && scm_is_string (arg1) - && gdbscm_is_true (scm_list_p (arg2))) + && scm_is_string (arg1) && gdbscm_is_true (scm_list_p (arg2))) return 1; } @@ -497,9 +472,10 @@ print_standard_throw_error (SCM args) /* ARG0 is #f if no function was recorded. */ if (gdbscm_is_true (arg0)) { - scm_simple_format (scm_current_error_port (), - scm_from_latin1_string (_("Error in function ~s:~%")), - scm_list_1 (arg0)); + scm_simple_format ( + scm_current_error_port (), + scm_from_latin1_string (_ ("Error in function ~s:~%")), + scm_list_1 (arg0)); } scm_simple_format (scm_current_error_port (), arg1, arg2); } @@ -521,9 +497,10 @@ print_throw_error (SCM key, SCM args) print_standard_throw_error (args); else { - scm_simple_format (scm_current_error_port (), - scm_from_latin1_string (_("Throw to key `~a' with args `~s'.~%")), - scm_list_2 (key, args)); + scm_simple_format ( + scm_current_error_port (), + scm_from_latin1_string (_ ("Throw to key `~a' with args `~s'.~%")), + scm_list_2 (key, args)); } } @@ -537,10 +514,10 @@ handle_boot_error (void *boot_scm_file, SCM key, SCM args) print_throw_error (key, args); gdb_printf (gdb_stderr, "\n"); - warning (_("Could not complete Guile gdb module initialization from:\n" - "%s.\n" - "Limited Guile support is available.\n" - "Suggest passing --data-directory=/path/to/gdb/data-directory."), + warning (_ ("Could not complete Guile gdb module initialization from:\n" + "%s.\n" + "Limited Guile support is available.\n" + "Suggest passing --data-directory=/path/to/gdb/data-directory."), (const char *) boot_scm_file); return SCM_UNSPECIFIED; @@ -554,10 +531,10 @@ initialize_scheme_side (void) { char *boot_scm_path; - guile_datadir = concat (gdb_datadir.c_str (), SLASH_STRING, "guile", - (char *) NULL); - boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb", - SLASH_STRING, boot_scm_filename, (char *) NULL); + guile_datadir + = concat (gdb_datadir.c_str (), SLASH_STRING, "guile", (char *) NULL); + boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb", SLASH_STRING, + boot_scm_filename, (char *) NULL); scm_c_catch (SCM_BOOL_T, boot_guile_support, boot_scm_path, handle_boot_error, boot_scm_path, NULL, NULL); @@ -743,26 +720,26 @@ install_gdb_commands (void) cmd_list_element *guile_repl_cmd = add_com ("guile-repl", class_obscure, guile_repl_command, #ifdef HAVE_GUILE - _("\ + _ ("\ Start an interactive Guile prompt.\n\ \n\ To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\ prompt) or ,quit.") -#else /* HAVE_GUILE */ - _("\ +#else /* HAVE_GUILE */ + _ ("\ Start a Guile interactive prompt.\n\ \n\ Guile scripting is not supported in this copy of GDB.\n\ This command is only a placeholder.") #endif /* HAVE_GUILE */ - ); + ); add_com_alias ("gr", guile_repl_cmd, class_obscure, 1); /* Since "help guile" is easy to type, and intuitive, we add general help in using GDB+Guile to this command. */ guile_cmd_element = add_com ("guile", class_obscure, guile_command, #ifdef HAVE_GUILE - _("\ + _ ("\ Evaluate one or more Guile expressions.\n\ \n\ The expression(s) can be given as an argument, for instance:\n\ @@ -784,48 +761,49 @@ or if you want to import the (gdb) module with a prefix, use:\n\ The Guile interactive session, started with the \"guile-repl\"\n\ command, provides extensive help and apropos capabilities.\n\ Type \",help\" once in a Guile interactive session.") -#else /* HAVE_GUILE */ - _("\ +#else /* HAVE_GUILE */ + _ ("\ Evaluate a Guile expression.\n\ \n\ Guile scripting is not supported in this copy of GDB.\n\ This command is only a placeholder.") #endif /* HAVE_GUILE */ - ); + ); add_com_alias ("gu", guile_cmd_element, class_obscure, 1); set_show_commands setshow_guile_cmds - = add_setshow_prefix_cmd ("guile", class_obscure, - _("\ + = add_setshow_prefix_cmd ("guile", class_obscure, _ ("\ Prefix command for Guile preference settings."), - _("\ + _ ("\ Prefix command for Guile preference settings."), - &set_guile_list, &show_guile_list, - &setlist, &showlist); + &set_guile_list, &show_guile_list, &setlist, + &showlist); add_alias_cmd ("gu", setshow_guile_cmds.set, class_obscure, 1, &setlist); add_alias_cmd ("gu", setshow_guile_cmds.show, class_obscure, 1, &showlist); cmd_list_element *info_guile_cmd = add_basic_prefix_cmd ("guile", class_obscure, - _("Prefix command for Guile info displays."), + _ ("Prefix command for Guile info displays."), &info_guile_list, 0, &infolist); add_info_alias ("gu", info_guile_cmd, 1); /* The name "print-stack" is carried over from Python. A better name is "print-exception". */ add_setshow_enum_cmd ("print-stack", no_class, guile_print_excp_enums, - &gdbscm_print_excp, _("\ -Set mode for Guile exception printing on error."), _("\ -Show the mode of Guile exception printing on error."), _("\ + &gdbscm_print_excp, _ ("\ +Set mode for Guile exception printing on error."), + _ ("\ +Show the mode of Guile exception printing on error."), + _ ("\ none == no stack or message will be printed.\n\ full == a message and a stack will be printed.\n\ message == an error message without a stack will be printed."), - NULL, NULL, - &set_guile_list, &show_guile_list); + NULL, NULL, &set_guile_list, &show_guile_list); } void _initialize_guile (); + void _initialize_guile () { diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c index be66a18..c442b4b 100644 --- a/gdb/guile/scm-arch.c +++ b/gdb/guile/scm-arch.c @@ -44,10 +44,10 @@ static scm_t_bits arch_smob_tag; /* Use a 'void *' here because it isn't guaranteed that SCM is a pointer. */ static const registry<gdbarch>::key<void, gdb::noop_deleter<void>> - arch_object_data; + arch_object_data; static int arscm_is_arch (SCM); - + /* Administrivia for arch smobs. */ /* The smob "print" function for <gdb:arch>. */ @@ -73,8 +73,8 @@ arscm_print_arch_smob (SCM self, SCM port, scm_print_state *pstate) static SCM arscm_make_arch_smob (struct gdbarch *gdbarch) { - arch_smob *a_smob = (arch_smob *) - scm_gc_malloc (sizeof (arch_smob), arch_smob_name); + arch_smob *a_smob + = (arch_smob *) scm_gc_malloc (sizeof (arch_smob), arch_smob_name); SCM a_scm; a_smob->gdbarch = gdbarch; @@ -155,7 +155,7 @@ arscm_get_arch_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name) return a_smob; } - + /* Arch methods. */ /* (current-arch) -> <gdb:arch> @@ -190,7 +190,7 @@ static SCM gdbscm_arch_charset (SCM self) { arch_smob *a_smob - =arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); + = arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct gdbarch *gdbarch = a_smob->gdbarch; return gdbscm_scm_from_c_string (target_charset (gdbarch)); @@ -207,7 +207,7 @@ gdbscm_arch_wide_charset (SCM self) return gdbscm_scm_from_c_string (target_wide_charset (gdbarch)); } - + /* Builtin types. The order the types are defined here follows the order in @@ -232,8 +232,7 @@ gdbscm_arch_builtin_type (SCM self, const char *func_name) static SCM gdbscm_arch_void_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_void; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_void; return tyscm_scm_from_type (type); } @@ -243,8 +242,7 @@ gdbscm_arch_void_type (SCM self) static SCM gdbscm_arch_char_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_char; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_char; return tyscm_scm_from_type (type); } @@ -265,8 +263,7 @@ gdbscm_arch_short_type (SCM self) static SCM gdbscm_arch_int_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int; return tyscm_scm_from_type (type); } @@ -276,8 +273,7 @@ gdbscm_arch_int_type (SCM self) static SCM gdbscm_arch_long_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_long; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_long; return tyscm_scm_from_type (type); } @@ -375,8 +371,7 @@ gdbscm_arch_longdouble_type (SCM self) static SCM gdbscm_arch_bool_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_bool; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_bool; return tyscm_scm_from_type (type); } @@ -408,8 +403,7 @@ gdbscm_arch_ulonglong_type (SCM self) static SCM gdbscm_arch_int8_type (SCM self) { - struct type *type - = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int8; + struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int8; return tyscm_scm_from_type (type); } @@ -490,103 +484,84 @@ gdbscm_arch_uint64_type (SCM self) return tyscm_scm_from_type (type); } - + /* Initialize the Scheme architecture support. */ -static const scheme_function arch_functions[] = -{ - { "arch?", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_p), - "\ +static const scheme_function arch_functions[] = { + { "arch?", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_p), "\ Return #t if the object is a <gdb:arch> object." }, - { "current-arch", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_arch), - "\ + { "current-arch", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_arch), "\ Return the <gdb:arch> object representing the architecture of the\n\ currently selected stack frame, if there is one, or the architecture of the\n\ current target if there isn't.\n\ \n\ Arguments: none" }, - { "arch-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_name), - "\ + { "arch-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_name), "\ Return the name of the architecture." }, - { "arch-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_charset), - "\ + { "arch-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_charset), "\ Return name of target character set as a string." }, { "arch-wide-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_wide_charset), - "\ + "\ Return name of target wide character set as a string." }, - { "arch-void-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_void_type), - "\ + { "arch-void-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_void_type), "\ Return the <gdb:type> object for the \"void\" type\n\ of the architecture." }, - { "arch-char-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_char_type), - "\ + { "arch-char-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_char_type), "\ Return the <gdb:type> object for the \"char\" type\n\ of the architecture." }, - { "arch-short-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_short_type), - "\ + { "arch-short-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_short_type), "\ Return the <gdb:type> object for the \"short\" type\n\ of the architecture." }, - { "arch-int-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int_type), - "\ + { "arch-int-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int_type), "\ Return the <gdb:type> object for the \"int\" type\n\ of the architecture." }, - { "arch-long-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_long_type), - "\ + { "arch-long-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_long_type), "\ Return the <gdb:type> object for the \"long\" type\n\ of the architecture." }, - { "arch-schar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_schar_type), - "\ + { "arch-schar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_schar_type), "\ Return the <gdb:type> object for the \"signed char\" type\n\ of the architecture." }, - { "arch-uchar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uchar_type), - "\ + { "arch-uchar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uchar_type), "\ Return the <gdb:type> object for the \"unsigned char\" type\n\ of the architecture." }, - { "arch-ushort-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ushort_type), - "\ + { "arch-ushort-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ushort_type), "\ Return the <gdb:type> object for the \"unsigned short\" type\n\ of the architecture." }, - { "arch-uint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint_type), - "\ + { "arch-uint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint_type), "\ Return the <gdb:type> object for the \"unsigned int\" type\n\ of the architecture." }, - { "arch-ulong-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ulong_type), - "\ + { "arch-ulong-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ulong_type), "\ Return the <gdb:type> object for the \"unsigned long\" type\n\ of the architecture." }, - { "arch-float-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_float_type), - "\ + { "arch-float-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_float_type), "\ Return the <gdb:type> object for the \"float\" type\n\ of the architecture." }, - { "arch-double-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_double_type), - "\ + { "arch-double-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_double_type), "\ Return the <gdb:type> object for the \"double\" type\n\ of the architecture." }, { "arch-longdouble-type", 1, 0, 0, - as_a_scm_t_subr (gdbscm_arch_longdouble_type), - "\ + as_a_scm_t_subr (gdbscm_arch_longdouble_type), "\ Return the <gdb:type> object for the \"long double\" type\n\ of the architecture." }, - { "arch-bool-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_bool_type), - "\ + { "arch-bool-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_bool_type), "\ Return the <gdb:type> object for the \"bool\" type\n\ of the architecture." }, @@ -596,48 +571,39 @@ Return the <gdb:type> object for the \"long long\" type\n\ of the architecture." }, { "arch-ulonglong-type", 1, 0, 0, - as_a_scm_t_subr (gdbscm_arch_ulonglong_type), - "\ + as_a_scm_t_subr (gdbscm_arch_ulonglong_type), "\ Return the <gdb:type> object for the \"unsigned long long\" type\n\ of the architecture." }, - { "arch-int8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int8_type), - "\ + { "arch-int8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int8_type), "\ Return the <gdb:type> object for the \"int8\" type\n\ of the architecture." }, - { "arch-uint8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint8_type), - "\ + { "arch-uint8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint8_type), "\ Return the <gdb:type> object for the \"uint8\" type\n\ of the architecture." }, - { "arch-int16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int16_type), - "\ + { "arch-int16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int16_type), "\ Return the <gdb:type> object for the \"int16\" type\n\ of the architecture." }, - { "arch-uint16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint16_type), - "\ + { "arch-uint16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint16_type), "\ Return the <gdb:type> object for the \"uint16\" type\n\ of the architecture." }, - { "arch-int32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int32_type), - "\ + { "arch-int32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int32_type), "\ Return the <gdb:type> object for the \"int32\" type\n\ of the architecture." }, - { "arch-uint32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint32_type), - "\ + { "arch-uint32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint32_type), "\ Return the <gdb:type> object for the \"uint32\" type\n\ of the architecture." }, - { "arch-int64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int64_type), - "\ + { "arch-int64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int64_type), "\ Return the <gdb:type> object for the \"int64\" type\n\ of the architecture." }, - { "arch-uint64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint64_type), - "\ + { "arch-uint64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint64_type), "\ Return the <gdb:type> object for the \"uint64\" type\n\ of the architecture." }, diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c index fc98d99..a520fe5 100644 --- a/gdb/guile/scm-auto-load.c +++ b/gdb/guile/scm-auto-load.c @@ -38,7 +38,7 @@ static void show_auto_load_guile_scripts (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - gdb_printf (file, _("Auto-loading of Guile scripts is %s.\n"), value); + gdb_printf (file, _ ("Auto-loading of Guile scripts is %s.\n"), value); } /* See guile-internal.h. */ @@ -56,14 +56,16 @@ info_auto_load_guile_scripts (const char *pattern, int from_tty) { auto_load_info_scripts (pattern, from_tty, &extension_language_guile); } - + void gdbscm_initialize_auto_load (void) { add_setshow_boolean_cmd ("guile-scripts", class_support, - &auto_load_guile_scripts, _("\ -Set the debugger's behaviour regarding auto-loaded Guile scripts."), _("\ -Show the debugger's behaviour regarding auto-loaded Guile scripts."), _("\ + &auto_load_guile_scripts, _ ("\ +Set the debugger's behaviour regarding auto-loaded Guile scripts."), + _ ("\ +Show the debugger's behaviour regarding auto-loaded Guile scripts."), + _ ("\ If enabled, auto-loaded Guile scripts are loaded when the debugger reads\n\ an executable or shared library.\n\ This options has security implications for untrusted inferiors."), @@ -72,7 +74,7 @@ This options has security implications for untrusted inferiors."), auto_load_show_cmdlist_get ()); add_cmd ("guile-scripts", class_info, info_auto_load_guile_scripts, - _("Print the list of automatically loaded Guile scripts.\n\ + _ ("Print the list of automatically loaded Guile scripts.\n\ Usage: info auto-load guile-scripts [REGEXP]"), auto_load_info_cmdlist_get ()); } diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index 02cd3ff..dbbe65c 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -67,7 +67,8 @@ struct block_syms_progress_smob }; static const char block_smob_name[] = "gdb:block"; -static const char block_syms_progress_smob_name[] = "gdb:block-symbols-iterator"; +static const char block_syms_progress_smob_name[] + = "gdb:block-symbols-iterator"; /* The tag Guile knows the block smobs by. */ static scm_t_bits block_smob_tag; @@ -85,8 +86,7 @@ struct bkscm_deleter /* Helper function for bkscm_del_objfile_blocks to mark the block as invalid. */ - static int - bkscm_mark_block_invalid (void **slot, void *info) + static int bkscm_mark_block_invalid (void **slot, void *info) { block_smob *b_smob = (block_smob *) *slot; @@ -104,8 +104,8 @@ struct bkscm_deleter }; static const registry<objfile>::key<htab, bkscm_deleter> - bkscm_objfile_data_key; - + bkscm_objfile_data_key; + /* Administrivia for block smobs. */ /* Helper function to hash a block_smob. */ @@ -126,8 +126,7 @@ bkscm_eq_block_smob (const void *ap, const void *bp) const block_smob *a = (const block_smob *) ap; const block_smob *b = (const block_smob *) bp; - return (a->block == b->block - && a->block != NULL); + return (a->block == b->block && a->block != NULL); } /* Return the struct block pointer -> SCM mapping table. @@ -187,8 +186,8 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate) if (b->function () != NULL) gdbscm_printf (port, " %s", b->function ()->print_name ()); - gdbscm_printf (port, " %s-%s", - hex_string (b->start ()), hex_string (b->end ())); + gdbscm_printf (port, " %s-%s", hex_string (b->start ()), + hex_string (b->end ())); scm_puts (">", port); @@ -203,8 +202,8 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate) static SCM bkscm_make_block_smob (void) { - block_smob *b_smob = (block_smob *) - scm_gc_malloc (sizeof (block_smob), block_smob_name); + block_smob *b_smob + = (block_smob *) scm_gc_malloc (sizeof (block_smob), block_smob_name); SCM b_scm; b_smob->block = NULL; @@ -304,7 +303,7 @@ bkscm_get_valid_block_smob_arg_unsafe (SCM self, int arg_pos, if (!bkscm_is_valid (b_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:block>")); + _ ("<gdb:block>")); } return b_smob; @@ -321,8 +320,8 @@ bkscm_get_valid_block (SCM scm, int arg_pos, const char *func_name, SCM *excp) if (!bkscm_is_block (scm)) { - *excp = gdbscm_make_type_error (func_name, arg_pos, scm, - block_smob_name); + *excp + = gdbscm_make_type_error (func_name, arg_pos, scm, block_smob_name); return NULL; } @@ -330,7 +329,7 @@ bkscm_get_valid_block (SCM scm, int arg_pos, const char *func_name, SCM *excp) if (!bkscm_is_valid (b_smob)) { *excp = gdbscm_make_invalid_object_error (func_name, arg_pos, scm, - _("<gdb:block>")); + _ ("<gdb:block>")); return NULL; } @@ -354,7 +353,6 @@ bkscm_scm_to_block (SCM block_scm, int arg_pos, const char *func_name, return NULL; } - /* Block methods. */ /* (block-valid? <gdb:block>) -> boolean @@ -519,7 +517,7 @@ gdbscm_block_symbols (SCM self) return scm_reverse_x (result, SCM_EOL); } - + /* The <gdb:block-symbols-iterator> object, for iterating over all symbols in a block. */ @@ -543,17 +541,17 @@ bkscm_print_block_syms_progress_smob (SCM self, SCM port, { struct compunit_symtab *cust; - gdbscm_printf (port, " %s", - i_smob->iter.which == GLOBAL_BLOCK - ? "global" : "static"); + gdbscm_printf (port, " %s", + i_smob->iter.which == GLOBAL_BLOCK ? "global" + : "static"); if (i_smob->iter.idx != -1) gdbscm_printf (port, " @%d", i_smob->iter.idx); - cust = (i_smob->iter.idx == -1 - ? i_smob->iter.d.compunit_symtab - : i_smob->iter.d.compunit_symtab->includes[i_smob->iter.idx]); - gdbscm_printf (port, " %s", - symtab_to_filename_for_display - (cust->primary_filetab ())); + cust = (i_smob->iter.idx == -1 ? i_smob->iter.d.compunit_symtab + : i_smob->iter.d.compunit_symtab + ->includes[i_smob->iter.idx]); + gdbscm_printf ( + port, " %s", + symtab_to_filename_for_display (cust->primary_filetab ())); break; } case FIRST_LOCAL_BLOCK: @@ -641,15 +639,14 @@ gdbscm_block_next_symbol_x (SCM self) iter_smob = (iterator_smob *) SCM_SMOB_DATA (iter_scm); block_scm = itscm_iterator_smob_object (iter_smob); - b_smob = bkscm_get_valid_block_smob_arg_unsafe (block_scm, - SCM_ARG1, FUNC_NAME); + b_smob + = bkscm_get_valid_block_smob_arg_unsafe (block_scm, SCM_ARG1, FUNC_NAME); block = b_smob->block; progress = itscm_iterator_smob_progress (iter_smob); - SCM_ASSERT_TYPE (bkscm_is_block_syms_progress (progress), - progress, SCM_ARG1, FUNC_NAME, - block_syms_progress_smob_name); + SCM_ASSERT_TYPE (bkscm_is_block_syms_progress (progress), progress, SCM_ARG1, + FUNC_NAME, block_syms_progress_smob_name); p_smob = (block_syms_progress_smob *) SCM_SMOB_DATA (progress); if (!p_smob->initialized_p) @@ -665,7 +662,7 @@ gdbscm_block_next_symbol_x (SCM self) return syscm_scm_from_symbol (sym); } - + /* (lookup-block address) -> <gdb:block> Returns the innermost lexical block containing the specified pc value, or #f if there is none. */ @@ -696,83 +693,70 @@ gdbscm_lookup_block (SCM pc_scm) if (cust == NULL || cust->objfile () == NULL) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, pc_scm, - _("cannot locate object file for block")); + _ ("cannot locate object file for block")); } if (block != NULL) return bkscm_scm_from_block (block, cust->objfile ()); return SCM_BOOL_F; } - + /* Initialize the Scheme block support. */ -static const scheme_function block_functions[] = -{ - { "block?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_p), - "\ +static const scheme_function block_functions[] + = { { "block?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_p), "\ Return #t if the object is a <gdb:block> object." }, - { "block-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_valid_p), - "\ + { "block-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_valid_p), "\ Return #t if the block is valid.\n\ A block becomes invalid when its objfile is freed." }, - { "block-start", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_start), - "\ + { "block-start", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_start), "\ Return the start address of the block." }, - { "block-end", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_end), - "\ + { "block-end", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_end), "\ Return the end address of the block." }, - { "block-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_function), - "\ + { "block-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_function), "\ Return the gdb:symbol object of the function containing the block\n\ or #f if the block does not live in any function." }, - { "block-superblock", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_superblock), - "\ + { "block-superblock", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_superblock), + "\ Return the superblock (parent block) of the block." }, - { "block-global-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_block), - "\ + { "block-global-block", 1, 0, 0, + as_a_scm_t_subr (gdbscm_block_global_block), "\ Return the global block of the block." }, - { "block-static-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_block), - "\ + { "block-static-block", 1, 0, 0, + as_a_scm_t_subr (gdbscm_block_static_block), "\ Return the static block of the block." }, - { "block-global?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_p), - "\ + { "block-global?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_p), "\ Return #t if block is a global block." }, - { "block-static?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_p), - "\ + { "block-static?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_p), "\ Return #t if block is a static block." }, - { "block-symbols", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_symbols), - "\ + { "block-symbols", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_symbols), "\ Return a list of all symbols (as <gdb:symbol> objects) in the block." }, - { "make-block-symbols-iterator", 1, 0, 0, - as_a_scm_t_subr (gdbscm_make_block_syms_iter), - "\ + { "make-block-symbols-iterator", 1, 0, 0, + as_a_scm_t_subr (gdbscm_make_block_syms_iter), "\ Return a <gdb:iterator> object for iterating over all symbols in the block." }, - { "block-symbols-progress?", 1, 0, 0, - as_a_scm_t_subr (bkscm_block_syms_progress_p), - "\ + { "block-symbols-progress?", 1, 0, 0, + as_a_scm_t_subr (bkscm_block_syms_progress_p), "\ Return #t if the object is a <gdb:block-symbols-progress> object." }, - { "lookup-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_lookup_block), - "\ + { "lookup-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_lookup_block), "\ Return the innermost GDB block containing the address or #f if none found.\n\ \n\ Arguments:\n\ address: the address to lookup" }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_blocks (void) diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index a7e043d..7b61221 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -107,7 +107,7 @@ static SCM type_keyword; static SCM wp_class_keyword; static SCM internal_keyword; static SCM temporary_keyword; - + /* Administrivia for breakpoint smobs. */ /* The smob "free" function for <gdb:breakpoint>. */ @@ -136,14 +136,22 @@ bpscm_type_to_string (enum bptype type) { switch (type) { - case bp_none: return "BP_NONE"; - case bp_breakpoint: return "BP_BREAKPOINT"; - case bp_watchpoint: return "BP_WATCHPOINT"; - case bp_hardware_watchpoint: return "BP_HARDWARE_WATCHPOINT"; - case bp_read_watchpoint: return "BP_READ_WATCHPOINT"; - case bp_access_watchpoint: return "BP_ACCESS_WATCHPOINT"; - case bp_catchpoint: return "BP_CATCHPOINT"; - default: return "internal/other"; + case bp_none: + return "BP_NONE"; + case bp_breakpoint: + return "BP_BREAKPOINT"; + case bp_watchpoint: + return "BP_WATCHPOINT"; + case bp_hardware_watchpoint: + return "BP_HARDWARE_WATCHPOINT"; + case bp_read_watchpoint: + return "BP_READ_WATCHPOINT"; + case bp_access_watchpoint: + return "BP_ACCESS_WATCHPOINT"; + case bp_catchpoint: + return "BP_CATCHPOINT"; + default: + return "internal/other"; } } @@ -154,10 +162,14 @@ bpscm_enable_state_to_string (enum enable_state enable_state) { switch (enable_state) { - case bp_disabled: return "disabled"; - case bp_enabled: return "enabled"; - case bp_call_disabled: return "call_disabled"; - default: return "unknown"; + case bp_disabled: + return "disabled"; + case bp_enabled: + return "enabled"; + case bp_call_disabled: + return "call_disabled"; + default: + return "unknown"; } } @@ -179,8 +191,7 @@ bpscm_print_breakpoint_smob (SCM self, SCM port, scm_print_state *pstate) /* Careful, the breakpoint may be invalid. */ if (b != NULL) { - gdbscm_printf (port, " %s %s %s", - bpscm_type_to_string (b->type), + gdbscm_printf (port, " %s %s %s", bpscm_type_to_string (b->type), bpscm_enable_state_to_string (b->enable_state), b->silent ? "silent" : "noisy"); @@ -208,8 +219,9 @@ bpscm_print_breakpoint_smob (SCM self, SCM port, scm_print_state *pstate) static SCM bpscm_make_breakpoint_smob (void) { - breakpoint_smob *bp_smob = (breakpoint_smob *) - scm_gc_malloc (sizeof (breakpoint_smob), breakpoint_smob_name); + breakpoint_smob *bp_smob + = (breakpoint_smob *) scm_gc_malloc (sizeof (breakpoint_smob), + breakpoint_smob_name); SCM bp_scm; memset (bp_smob, 0, sizeof (*bp_smob)); @@ -234,12 +246,9 @@ bpscm_want_scm_wrapper_p (struct breakpoint *bp, int from_scheme) return 0; /* The others are not supported. */ - if (bp->type != bp_breakpoint - && bp->type != bp_watchpoint - && bp->type != bp_hardware_watchpoint - && bp->type != bp_read_watchpoint - && bp->type != bp_access_watchpoint - && bp->type != bp_catchpoint) + if (bp->type != bp_breakpoint && bp->type != bp_watchpoint + && bp->type != bp_hardware_watchpoint && bp->type != bp_read_watchpoint + && bp->type != bp_access_watchpoint && bp->type != bp_catchpoint) return 0; return 1; @@ -327,12 +336,12 @@ bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos, if (!bpscm_is_valid (bp_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:breakpoint>")); + _ ("<gdb:breakpoint>")); } return bp_smob; } - + /* Breakpoint methods. */ /* (make-breakpoint string [#:type integer] [#:wp-class integer] @@ -345,14 +354,12 @@ bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos, static SCM gdbscm_make_breakpoint (SCM location_scm, SCM rest) { - const SCM keywords[] = { - type_keyword, wp_class_keyword, internal_keyword, - temporary_keyword, SCM_BOOL_F - }; + const SCM keywords[] = { type_keyword, wp_class_keyword, internal_keyword, + temporary_keyword, SCM_BOOL_F }; char *s; char *location; - int type_arg_pos = -1, access_type_arg_pos = -1, - internal_arg_pos = -1, temporary_arg_pos = -1; + int type_arg_pos = -1, access_type_arg_pos = -1, internal_arg_pos = -1, + temporary_arg_pos = -1; int type = bp_breakpoint; int access_type = hw_write; int internal = 0; @@ -361,11 +368,10 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest) breakpoint_smob *bp_smob; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iitt", - location_scm, &location, rest, - &type_arg_pos, &type, - &access_type_arg_pos, &access_type, - &internal_arg_pos, &internal, - &temporary_arg_pos, &temporary); + location_scm, &location, rest, &type_arg_pos, + &type, &access_type_arg_pos, &access_type, + &internal_arg_pos, &internal, &temporary_arg_pos, + &temporary); result = bpscm_make_breakpoint_smob (); bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (result); @@ -381,7 +387,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest) { gdbscm_misc_error (FUNC_NAME, access_type_arg_pos, scm_from_int (access_type), - _("access type with breakpoint is not allowed")); + _ ("access type with breakpoint is not allowed")); } break; case bp_watchpoint: @@ -394,7 +400,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest) default: gdbscm_out_of_range_error (FUNC_NAME, access_type_arg_pos, scm_from_int (access_type), - _("invalid watchpoint class")); + _ ("invalid watchpoint class")); } break; case bp_none: @@ -406,13 +412,12 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest) const char *type_name = bpscm_type_to_string ((enum bptype) type); gdbscm_misc_error (FUNC_NAME, type_arg_pos, gdbscm_scm_from_c_string (type_name), - _("unsupported breakpoint type")); + _ ("unsupported breakpoint type")); } break; default: - gdbscm_out_of_range_error (FUNC_NAME, type_arg_pos, - scm_from_int (type), - _("invalid breakpoint type")); + gdbscm_out_of_range_error (FUNC_NAME, type_arg_pos, scm_from_int (type), + _ ("invalid breakpoint type")); } bp_smob->is_scheme_bkpt = 1; @@ -440,17 +445,17 @@ gdbscm_register_breakpoint_x (SCM self) /* We only support registering breakpoints created with make-breakpoint. */ if (!bp_smob->is_scheme_bkpt) - scm_misc_error (FUNC_NAME, _("not a Scheme breakpoint"), SCM_EOL); + scm_misc_error (FUNC_NAME, _ ("not a Scheme breakpoint"), SCM_EOL); if (bpscm_is_valid (bp_smob)) - scm_misc_error (FUNC_NAME, _("breakpoint is already registered"), SCM_EOL); + scm_misc_error (FUNC_NAME, _ ("breakpoint is already registered"), + SCM_EOL); pending_breakpoint_scm = self; location = bp_smob->spec.location; copy = skip_spaces (location); location_spec_up locspec - = string_to_location_spec_basic (©, - current_language, + = string_to_location_spec_basic (©, current_language, symbol_name_match_type::WILD); try @@ -462,16 +467,11 @@ gdbscm_register_breakpoint_x (SCM self) { case bp_breakpoint: { - const breakpoint_ops *ops = - breakpoint_ops_for_location_spec (locspec.get (), false); - create_breakpoint (get_current_arch (), - locspec.get (), NULL, -1, NULL, false, - 0, - temporary, bp_breakpoint, - 0, - AUTO_BOOLEAN_TRUE, - ops, - 0, 1, internal, 0); + const breakpoint_ops *ops + = breakpoint_ops_for_location_spec (locspec.get (), false); + create_breakpoint (get_current_arch (), locspec.get (), NULL, -1, + NULL, false, 0, temporary, bp_breakpoint, 0, + AUTO_BOOLEAN_TRUE, ops, 0, 1, internal, 0); break; } case bp_watchpoint: @@ -607,7 +607,7 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue) = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME, - _("boolean")); + _ ("boolean")); gdbscm_gdb_exception exc {}; try @@ -646,7 +646,7 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue) = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME, - _("boolean")); + _ ("boolean")); gdbscm_gdb_exception exc {}; try @@ -684,7 +684,7 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue) long value; SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX), - newvalue, SCM_ARG2, FUNC_NAME, _("integer")); + newvalue, SCM_ARG2, FUNC_NAME, _ ("integer")); value = scm_to_long (newvalue); if (value < 0) @@ -725,7 +725,7 @@ gdbscm_set_breakpoint_hit_count_x (SCM self, SCM newvalue) long value; SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX), - newvalue, SCM_ARG2, FUNC_NAME, _("integer")); + newvalue, SCM_ARG2, FUNC_NAME, _ ("integer")); value = scm_to_long (newvalue); if (value < 0) @@ -734,7 +734,7 @@ gdbscm_set_breakpoint_hit_count_x (SCM self, SCM newvalue) if (value != 0) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue, - _("hit-count must be zero")); + _ ("hit-count must be zero")); } bp_smob->bp->hit_count = 0; @@ -771,13 +771,13 @@ gdbscm_set_breakpoint_thread_x (SCM self, SCM newvalue) if (!valid_global_thread_id (id)) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue, - _("invalid thread id")); + _ ("invalid thread id")); } } else if (gdbscm_is_false (newvalue)) id = -1; else - SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f")); + SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _ ("integer or #f")); breakpoint_set_thread (bp_smob->bp, id); @@ -823,16 +823,16 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - if (! valid_id) + if (!valid_id) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue, - _("invalid task id")); + _ ("invalid task id")); } } else if (gdbscm_is_false (newvalue)) id = 0; else - SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f")); + SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _ ("integer or #f")); gdbscm_gdb_exception exc {}; try @@ -883,7 +883,7 @@ gdbscm_breakpoint_expression (SCM self) wp = (struct watchpoint *) bp_smob->bp; const char *str = wp->exp_string.get (); - if (! str) + if (!str) str = ""; return gdbscm_scm_from_c_string (str); @@ -899,7 +899,7 @@ gdbscm_breakpoint_condition (SCM self) char *str; str = bp_smob->bp->cond_string.get (); - if (! str) + if (!str) return SCM_BOOL_F; return gdbscm_scm_from_c_string (str); @@ -915,20 +915,17 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue) = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue), - newvalue, SCM_ARG2, FUNC_NAME, - _("string or #f")); + newvalue, SCM_ARG2, FUNC_NAME, _ ("string or #f")); - return gdbscm_wrap ([=] - { - gdb::unique_xmalloc_ptr<char> exp - = (gdbscm_is_false (newvalue) - ? nullptr - : gdbscm_scm_to_c_string (newvalue)); + return gdbscm_wrap ([=] { + gdb::unique_xmalloc_ptr<char> exp + = (gdbscm_is_false (newvalue) ? nullptr + : gdbscm_scm_to_c_string (newvalue)); - set_breakpoint_condition (bp_smob->bp, exp ? exp.get () : "", 0, false); + set_breakpoint_condition (bp_smob->bp, exp ? exp.get () : "", 0, false); - return SCM_UNSPECIFIED; - }); + return SCM_UNSPECIFIED; + }); } /* (breakpoint-stop <gdb:breakpoint>) -> procedure or #f */ @@ -953,9 +950,8 @@ gdbscm_set_breakpoint_stop_x (SCM self, SCM newvalue) const struct extension_language_defn *extlang = NULL; SCM_ASSERT_TYPE (gdbscm_is_procedure (newvalue) - || gdbscm_is_false (newvalue), - newvalue, SCM_ARG2, FUNC_NAME, - _("procedure or #f")); + || gdbscm_is_false (newvalue), + newvalue, SCM_ARG2, FUNC_NAME, _ ("procedure or #f")); if (bp_smob->bp->cond_string != NULL) extlang = get_ext_lang_defn (EXT_LANG_GDB); @@ -964,10 +960,11 @@ gdbscm_set_breakpoint_stop_x (SCM self, SCM newvalue) if (extlang != NULL) { char *error_text - = xstrprintf (_("Only one stop condition allowed. There is" - " currently a %s stop condition defined for" - " this breakpoint."), - ext_lang_capitalized_name (extlang)).release (); + = xstrprintf (_ ("Only one stop condition allowed. There is" + " currently a %s stop condition defined for" + " this breakpoint."), + ext_lang_capitalized_name (extlang)) + .release (); scm_dynwind_begin ((scm_t_dynwind_flags) 0); gdbscm_dynwind_xfree (error_text); @@ -1060,7 +1057,7 @@ gdbscm_breakpoint_temporary (SCM self) return scm_from_bool (bp_smob->bp->disposition == disp_del || bp_smob->bp->disposition == disp_del_at_next_stop); } - + /* Return TRUE if "stop" has been set for this breakpoint. This is the extension_language_ops.breakpoint_has_cond "method". */ @@ -1086,8 +1083,8 @@ gdbscm_breakpoint_has_cond (const struct extension_language_defn *extlang, This is the extension_language_ops.breakpoint_cond_says_stop "method". */ enum ext_lang_bp_stop -gdbscm_breakpoint_cond_says_stop - (const struct extension_language_defn *extlang, struct breakpoint *b) +gdbscm_breakpoint_cond_says_stop ( + const struct extension_language_defn *extlang, struct breakpoint *b) { breakpoint_smob *bp_smob = b->scm_bp_object; SCM predicate_result; @@ -1112,7 +1109,7 @@ gdbscm_breakpoint_cond_says_stop return stop ? EXT_LANG_BP_STOP_YES : EXT_LANG_BP_STOP_NO; } - + /* Event callback functions. */ /* Callback that is used when a breakpoint is created. @@ -1164,30 +1161,26 @@ bpscm_breakpoint_deleted (struct breakpoint *b) } } } - + /* Initialize the Scheme breakpoint code. */ -static const scheme_integer_constant breakpoint_integer_constants[] = -{ - { "BP_NONE", bp_none }, - { "BP_BREAKPOINT", bp_breakpoint }, - { "BP_WATCHPOINT", bp_watchpoint }, - { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint }, - { "BP_READ_WATCHPOINT", bp_read_watchpoint }, - { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint }, - { "BP_CATCHPOINT", bp_catchpoint }, - - { "WP_READ", hw_read }, - { "WP_WRITE", hw_write }, - { "WP_ACCESS", hw_access }, - - END_INTEGER_CONSTANTS -}; +static const scheme_integer_constant breakpoint_integer_constants[] + = { { "BP_NONE", bp_none }, + { "BP_BREAKPOINT", bp_breakpoint }, + { "BP_WATCHPOINT", bp_watchpoint }, + { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint }, + { "BP_READ_WATCHPOINT", bp_read_watchpoint }, + { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint }, + { "BP_CATCHPOINT", bp_catchpoint }, -static const scheme_function breakpoint_functions[] = -{ - { "make-breakpoint", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_breakpoint), - "\ + { "WP_READ", hw_read }, + { "WP_WRITE", hw_write }, + { "WP_ACCESS", hw_access }, + + END_INTEGER_CONSTANTS }; + +static const scheme_function breakpoint_functions[] = { + { "make-breakpoint", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_breakpoint), "\ Create a GDB breakpoint object.\n\ \n\ Arguments:\n\ @@ -1196,22 +1189,19 @@ Create a GDB breakpoint object.\n\ <gdb:breakpoint> object" }, { "register-breakpoint!", 1, 0, 0, - as_a_scm_t_subr (gdbscm_register_breakpoint_x), - "\ + as_a_scm_t_subr (gdbscm_register_breakpoint_x), "\ Register a <gdb:breakpoint> object with GDB." }, - { "delete-breakpoint!", 1, 0, 0, as_a_scm_t_subr (gdbscm_delete_breakpoint_x), - "\ + { "delete-breakpoint!", 1, 0, 0, + as_a_scm_t_subr (gdbscm_delete_breakpoint_x), "\ Delete the breakpoint from GDB." }, - { "breakpoints", 0, 0, 0, as_a_scm_t_subr (gdbscm_breakpoints), - "\ + { "breakpoints", 0, 0, 0, as_a_scm_t_subr (gdbscm_breakpoints), "\ Return a list of all GDB breakpoints.\n\ \n\ Arguments: none" }, - { "breakpoint?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_p), - "\ + { "breakpoint?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_p), "\ Return #t if the object is a <gdb:breakpoint> object." }, { "breakpoint-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_valid_p), @@ -1222,72 +1212,62 @@ Return #t if the breakpoint has not been deleted from GDB." }, "\ Return the breakpoint's number." }, - { "breakpoint-temporary?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_temporary), - "\ + { "breakpoint-temporary?", 1, 0, 0, + as_a_scm_t_subr (gdbscm_breakpoint_temporary), "\ Return #t if the breakpoint is a temporary breakpoint." }, - { "breakpoint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_type), - "\ + { "breakpoint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_type), "\ Return the type of the breakpoint." }, - { "breakpoint-visible?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_visible), - "\ + { "breakpoint-visible?", 1, 0, 0, + as_a_scm_t_subr (gdbscm_breakpoint_visible), "\ Return #t if the breakpoint is visible to the user." }, { "breakpoint-location", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_location), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_location), "\ Return the location of the breakpoint as specified by the user." }, { "breakpoint-expression", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_expression), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_expression), "\ Return the expression of the breakpoint as specified by the user.\n\ Valid for watchpoints only, returns #f for non-watchpoints." }, { "breakpoint-enabled?", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_enabled_p), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_enabled_p), "\ Return #t if the breakpoint is enabled." }, { "set-breakpoint-enabled!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_enabled_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_enabled_x), "\ Set the breakpoint's enabled state.\n\ \n\ Arguments: <gdb:breakpoint> boolean" }, - { "breakpoint-silent?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_silent_p), - "\ + { "breakpoint-silent?", 1, 0, 0, + as_a_scm_t_subr (gdbscm_breakpoint_silent_p), "\ Return #t if the breakpoint is silent." }, { "set-breakpoint-silent!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_silent_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_silent_x), "\ Set the breakpoint's silent state.\n\ \n\ Arguments: <gdb:breakpoint> boolean" }, { "breakpoint-ignore-count", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_ignore_count), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_ignore_count), "\ Return the breakpoint's \"ignore\" count." }, { "set-breakpoint-ignore-count!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_ignore_count_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_ignore_count_x), "\ Set the breakpoint's \"ignore\" count.\n\ \n\ Arguments: <gdb:breakpoint> count" }, { "breakpoint-hit-count", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_hit_count), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_hit_count), "\ Return the breakpoint's \"hit\" count." }, { "set-breakpoint-hit-count!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_hit_count_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_hit_count_x), "\ Set the breakpoint's \"hit\" count. The value must be zero.\n\ \n\ Arguments: <gdb:breakpoint> 0" }, @@ -1297,45 +1277,38 @@ Set the breakpoint's \"hit\" count. The value must be zero.\n\ Return the breakpoint's global thread id or #f if there isn't one." }, { "set-breakpoint-thread!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_thread_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_thread_x), "\ Set the global thread id for this breakpoint.\n\ \n\ Arguments: <gdb:breakpoint> global-thread-id" }, - { "breakpoint-task", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_task), - "\ + { "breakpoint-task", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_task), "\ Return the breakpoint's Ada task-id or #f if there isn't one." }, { "set-breakpoint-task!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_task_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_task_x), "\ Set the breakpoint's Ada task-id.\n\ \n\ Arguments: <gdb:breakpoint> task-id" }, { "breakpoint-condition", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_condition), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_condition), "\ Return the breakpoint's condition as specified by the user.\n\ Return #f if there isn't one." }, { "set-breakpoint-condition!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_condition_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_condition_x), "\ Set the breakpoint's condition.\n\ \n\ Arguments: <gdb:breakpoint> condition\n\ condition: a string" }, - { "breakpoint-stop", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_stop), - "\ + { "breakpoint-stop", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_stop), "\ Return the breakpoint's stop predicate.\n\ Return #f if there isn't one." }, { "set-breakpoint-stop!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_breakpoint_stop_x), - "\ + as_a_scm_t_subr (gdbscm_set_breakpoint_stop_x), "\ Set the breakpoint's stop predicate.\n\ \n\ Arguments: <gdb:breakpoint> procedure\n\ @@ -1343,8 +1316,7 @@ Set the breakpoint's stop predicate.\n\ Its result is true if program execution should stop." }, { "breakpoint-commands", 1, 0, 0, - as_a_scm_t_subr (gdbscm_breakpoint_commands), - "\ + as_a_scm_t_subr (gdbscm_breakpoint_commands), "\ Return the breakpoint's commands." }, END_FUNCTIONS diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c index 08a6136..8f07715 100644 --- a/gdb/guile/scm-cmd.c +++ b/gdb/guile/scm-cmd.c @@ -108,8 +108,7 @@ struct cmdscm_completer completer_ftype *completer; }; -static const struct cmdscm_completer cmdscm_completers[] = -{ +static const struct cmdscm_completer cmdscm_completers[] = { { "COMPLETE_NONE", noop_completer }, { "COMPLETE_FILENAME", filename_completer }, { "COMPLETE_LOCATION", location_completer }, @@ -118,11 +117,11 @@ static const struct cmdscm_completer cmdscm_completers[] = { "COMPLETE_EXPRESSION", expression_completer }, }; -#define N_COMPLETERS (sizeof (cmdscm_completers) \ - / sizeof (cmdscm_completers[0])) +#define N_COMPLETERS \ + (sizeof (cmdscm_completers) / sizeof (cmdscm_completers[0])) static int cmdscm_is_valid (command_smob *); - + /* Administrivia for command smobs. */ /* The smob "print" function for <gdb:command>. */ @@ -137,7 +136,7 @@ cmdscm_print_command_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, " %s", c_smob->name != NULL ? c_smob->name : "{unnamed}"); - if (! cmdscm_is_valid (c_smob)) + if (!cmdscm_is_valid (c_smob)) scm_puts (" {invalid}", port); scm_puts (">", port); @@ -155,8 +154,8 @@ cmdscm_print_command_smob (SCM self, SCM port, scm_print_state *pstate) static SCM cmdscm_make_command_smob (void) { - command_smob *c_smob = (command_smob *) - scm_gc_malloc (sizeof (command_smob), command_smob_name); + command_smob *c_smob = (command_smob *) scm_gc_malloc (sizeof (command_smob), + command_smob_name); SCM c_scm; memset (c_smob, 0, sizeof (*c_smob)); @@ -241,12 +240,12 @@ cmdscm_get_valid_command_smob_arg_unsafe (SCM self, int arg_pos, if (!cmdscm_is_valid (c_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:command>")); + _ ("<gdb:command>")); } return c_smob; } - + /* Scheme functions for GDB commands. */ /* (command-valid? <gdb:command>) -> boolean @@ -275,7 +274,7 @@ gdbscm_dont_repeat (SCM self) return SCM_UNSPECIFIED; } - + /* The make-command function. */ /* Called if the gdb cmd_list_element is destroyed. */ @@ -293,7 +292,7 @@ cmdscm_destroyer (struct cmd_list_element *self, void *context) static void cmdscm_function (const char *args, int from_tty, cmd_list_element *command) { - command_smob *c_smob/*obj*/ = (command_smob *) command->context (); + command_smob *c_smob /*obj*/ = (command_smob *) command->context (); SCM arg_scm, tty_scm, result; gdb_assert (c_smob != NULL); @@ -302,12 +301,12 @@ cmdscm_function (const char *args, int from_tty, cmd_list_element *command) args = ""; arg_scm = gdbscm_scm_from_string (args, strlen (args), host_charset (), 1); if (gdbscm_is_exception (arg_scm)) - error (_("Could not convert arguments to Scheme string.")); + error (_ ("Could not convert arguments to Scheme string.")); tty_scm = scm_from_bool (from_tty); - result = gdbscm_safe_call_3 (c_smob->invoke, c_smob->containing_scm, - arg_scm, tty_scm, gdbscm_user_error_p); + result = gdbscm_safe_call_3 (c_smob->invoke, c_smob->containing_scm, arg_scm, + tty_scm, gdbscm_user_error_p); if (gdbscm_is_exception (result)) { @@ -323,7 +322,7 @@ cmdscm_function (const char *args, int from_tty, cmd_list_element *command) else { gdbscm_print_gdb_exception (SCM_BOOL_F, result); - error (_("Error occurred in Scheme-implemented GDB command.")); + error (_ ("Error occurred in Scheme-implemented GDB command.")); } } } @@ -355,14 +354,13 @@ cmdscm_add_completion (SCM completion, completion_tracker &tracker) if (!scm_is_string (completion)) { /* Inform the user, but otherwise ignore the entire result. */ - cmdscm_bad_completion_result (_("Bad text from completer: "), + cmdscm_bad_completion_result (_ ("Bad text from completer: "), completion); return 0; } gdb::unique_xmalloc_ptr<char> item - = gdbscm_scm_to_string (completion, NULL, host_charset (), 1, - &except_scm); + = gdbscm_scm_to_string (completion, NULL, host_charset (), 1, &except_scm); if (item == NULL) { /* Inform the user, but otherwise ignore the entire result. */ @@ -379,28 +377,26 @@ cmdscm_add_completion (SCM completion, completion_tracker &tracker) static void cmdscm_completer (struct cmd_list_element *command, - completion_tracker &tracker, - const char *text, const char *word) + completion_tracker &tracker, const char *text, + const char *word) { - command_smob *c_smob/*obj*/ = (command_smob *) command->context (); + command_smob *c_smob /*obj*/ = (command_smob *) command->context (); SCM completer_result_scm; SCM text_scm, word_scm; gdb_assert (c_smob != NULL); gdb_assert (gdbscm_is_procedure (c_smob->complete)); - text_scm = gdbscm_scm_from_string (text, strlen (text), host_charset (), - 1); + text_scm = gdbscm_scm_from_string (text, strlen (text), host_charset (), 1); if (gdbscm_is_exception (text_scm)) - error (_("Could not convert \"text\" argument to Scheme string.")); - word_scm = gdbscm_scm_from_string (word, strlen (word), host_charset (), - 1); + error (_ ("Could not convert \"text\" argument to Scheme string.")); + word_scm = gdbscm_scm_from_string (word, strlen (word), host_charset (), 1); if (gdbscm_is_exception (word_scm)) - error (_("Could not convert \"word\" argument to Scheme string.")); + error (_ ("Could not convert \"word\" argument to Scheme string.")); completer_result_scm - = gdbscm_safe_call_3 (c_smob->complete, c_smob->containing_scm, - text_scm, word_scm, NULL); + = gdbscm_safe_call_3 (c_smob->complete, c_smob->containing_scm, text_scm, + word_scm, NULL); if (gdbscm_is_exception (completer_result_scm)) { @@ -446,7 +442,7 @@ cmdscm_completer (struct cmd_list_element *command, else { /* Inform the user, but otherwise ignore. */ - cmdscm_bad_completion_result (_("Bad completer result: "), + cmdscm_bad_completion_result (_ ("Bad completer result: "), completer_result_scm); } } @@ -467,9 +463,8 @@ cmdscm_completer (struct cmd_list_element *command, On error a Scheme exception is thrown. */ char * -gdbscm_parse_command_name (const char *name, - const char *func_name, int arg_pos, - struct cmd_list_element ***base_list, +gdbscm_parse_command_name (const char *name, const char *func_name, + int arg_pos, struct cmd_list_element ***base_list, struct cmd_list_element **start_list) { struct cmd_list_element *elt; @@ -484,7 +479,7 @@ gdbscm_parse_command_name (const char *name, { gdbscm_out_of_range_error (func_name, arg_pos, gdbscm_scm_from_c_string (name), - _("no command name found")); + _ ("no command name found")); } lastchar = i; @@ -512,8 +507,9 @@ gdbscm_parse_command_name (const char *name, elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, NULL, 1); if (elt == NULL || elt == CMD_LIST_AMBIGUOUS) { - msg = xstrprintf (_("could not find command prefix '%s'"), - prefix_text.get ()).release (); + msg = xstrprintf (_ ("could not find command prefix '%s'"), + prefix_text.get ()) + .release (); scm_dynwind_begin ((scm_t_dynwind_flags) 0); gdbscm_dynwind_xfree (msg); gdbscm_out_of_range_error (func_name, arg_pos, @@ -526,8 +522,8 @@ gdbscm_parse_command_name (const char *name, return result.release (); } - msg = xstrprintf (_("'%s' is not a prefix command"), - prefix_text.get ()).release (); + msg = xstrprintf (_ ("'%s' is not a prefix command"), prefix_text.get ()) + .release (); scm_dynwind_begin ((scm_t_dynwind_flags) 0); gdbscm_dynwind_xfree (msg); gdbscm_out_of_range_error (func_name, arg_pos, @@ -535,8 +531,7 @@ gdbscm_parse_command_name (const char *name, /* NOTREACHED */ } -static const scheme_integer_constant command_classes[] = -{ +static const scheme_integer_constant command_classes[] = { /* Note: alias and user are special; pseudo appears to be unused, and there is no reason to expose tui, I think. */ { "COMMAND_NONE", no_class }, @@ -647,10 +642,9 @@ gdbscm_canonicalize_command_name (const char *name, int want_trailing_space) static SCM gdbscm_make_command (SCM name_scm, SCM rest) { - const SCM keywords[] = { - invoke_keyword, command_class_keyword, completer_class_keyword, - prefix_p_keyword, doc_keyword, SCM_BOOL_F - }; + const SCM keywords[] + = { invoke_keyword, command_class_keyword, completer_class_keyword, + prefix_p_keyword, doc_keyword, SCM_BOOL_F }; int invoke_arg_pos = -1, command_class_arg_pos = 1; int completer_class_arg_pos = -1, is_prefix_arg_pos = -1; int doc_arg_pos = -1; @@ -665,15 +659,14 @@ gdbscm_make_command (SCM name_scm, SCM rest) command_smob *c_smob; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#OiOts", - name_scm, &name, rest, - &invoke_arg_pos, &invoke, + name_scm, &name, rest, &invoke_arg_pos, &invoke, &command_class_arg_pos, &command_class, &completer_class_arg_pos, &completer_class, - &is_prefix_arg_pos, &is_prefix, - &doc_arg_pos, &doc); + &is_prefix_arg_pos, &is_prefix, &doc_arg_pos, + &doc); if (doc == NULL) - doc = xstrdup (_("This command is not documented.")); + doc = xstrdup (_ ("This command is not documented.")); s = name; name = gdbscm_canonicalize_command_name (s, is_prefix); @@ -682,38 +675,36 @@ gdbscm_make_command (SCM name_scm, SCM rest) doc = gdbscm_gc_xstrdup (s); xfree (s); - if (is_prefix - ? name[0] == ' ' - : name[0] == '\0') + if (is_prefix ? name[0] == ' ' : name[0] == '\0') { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, name_scm, - _("no command name found")); + _ ("no command name found")); } if (gdbscm_is_true (invoke)) { - SCM_ASSERT_TYPE (gdbscm_is_procedure (invoke), invoke, - invoke_arg_pos, FUNC_NAME, _("procedure")); + SCM_ASSERT_TYPE (gdbscm_is_procedure (invoke), invoke, invoke_arg_pos, + FUNC_NAME, _ ("procedure")); } if (!gdbscm_valid_command_class_p (command_class)) { gdbscm_out_of_range_error (FUNC_NAME, command_class_arg_pos, scm_from_int (command_class), - _("invalid command class argument")); + _ ("invalid command class argument")); } SCM_ASSERT_TYPE (gdbscm_is_false (completer_class) - || scm_is_integer (completer_class) - || gdbscm_is_procedure (completer_class), + || scm_is_integer (completer_class) + || gdbscm_is_procedure (completer_class), completer_class, completer_class_arg_pos, FUNC_NAME, - _("integer or procedure")); + _ ("integer or procedure")); if (scm_is_integer (completer_class) && !scm_is_signed_integer (completer_class, 0, N_COMPLETERS - 1)) { gdbscm_out_of_range_error (FUNC_NAME, completer_class_arg_pos, completer_class, - _("invalid completion type argument")); + _ ("invalid completion type argument")); } c_scm = cmdscm_make_command_smob (); @@ -742,7 +733,7 @@ gdbscm_register_command_x (SCM self) struct cmd_list_element *cmd = NULL; if (cmdscm_is_valid (c_smob)) - scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL); + scm_misc_error (FUNC_NAME, _ ("command is already registered"), SCM_EOL); cmd_name = gdbscm_parse_command_name (c_smob->name, FUNC_NAME, SCM_ARG1, &cmd_list, &cmdlist); @@ -758,14 +749,14 @@ gdbscm_register_command_x (SCM self) sub-commands. */ int allow_unknown = gdbscm_is_true (c_smob->invoke); - cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class, - NULL, c_smob->doc, &c_smob->sub_list, - allow_unknown, cmd_list); + cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class, NULL, + c_smob->doc, &c_smob->sub_list, allow_unknown, + cmd_list); } else { - cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class, - c_smob->doc, cmd_list); + cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class, c_smob->doc, + cmd_list); } } catch (const gdb_exception &except) @@ -786,10 +777,10 @@ gdbscm_register_command_x (SCM self) if (gdbscm_is_true (c_smob->complete)) { - set_cmd_completer (cmd, - scm_is_integer (c_smob->complete) - ? cmdscm_completers[scm_to_int (c_smob->complete)].completer - : cmdscm_completer); + set_cmd_completer ( + cmd, scm_is_integer (c_smob->complete) + ? cmdscm_completers[scm_to_int (c_smob->complete)].completer + : cmdscm_completer); } /* The owner of this command is not in GC-controlled memory, so we need @@ -798,13 +789,11 @@ gdbscm_register_command_x (SCM self) return SCM_UNSPECIFIED; } - + /* Initialize the Scheme command support. */ -static const scheme_function command_functions[] = -{ - { "make-command", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_command), - "\ +static const scheme_function command_functions[] + = { { "make-command", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_command), "\ Make a GDB command object.\n\ \n\ Arguments: name [#:invoke lambda]\n\ @@ -824,27 +813,23 @@ Make a GDB command object.\n\ doc: The \"doc string\" of the command.\n\ Returns: <gdb:command> object" }, - { "register-command!", 1, 0, 0, as_a_scm_t_subr (gdbscm_register_command_x), - "\ + { "register-command!", 1, 0, 0, + as_a_scm_t_subr (gdbscm_register_command_x), "\ Register a <gdb:command> object with GDB." }, - { "command?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_p), - "\ + { "command?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_p), "\ Return #t if the object is a <gdb:command> object." }, - { "command-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_valid_p), - "\ + { "command-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_valid_p), "\ Return #t if the <gdb:command> object is valid." }, - { "dont-repeat", 1, 0, 0, as_a_scm_t_subr (gdbscm_dont_repeat), - "\ + { "dont-repeat", 1, 0, 0, as_a_scm_t_subr (gdbscm_dont_repeat), "\ Prevent command repetition when user enters an empty line.\n\ \n\ Arguments: <gdb:command>\n\ Returns: unspecified" }, - END_FUNCTIONS -}; + END_FUNCTIONS }; /* Initialize the 'commands' code. */ diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c index 58ccb4f..4206a12 100644 --- a/gdb/guile/scm-disasm.c +++ b/gdb/guile/scm-disasm.c @@ -40,8 +40,8 @@ static SCM length_symbol; class gdbscm_disassembler : public gdb_disassembler { public: - gdbscm_disassembler (struct gdbarch *gdbarch, - struct ui_file *stream, + + gdbscm_disassembler (struct gdbarch *gdbarch, struct ui_file *stream, SCM port, ULONGEST offset); SCM port; @@ -59,19 +59,17 @@ struct gdbscm_disasm_read_data unsigned int length; gdbscm_disassembler *dinfo; }; - + /* Subroutine of gdbscm_arch_disassemble to simplify it. Return the result for one instruction. */ static SCM dascm_make_insn (CORE_ADDR pc, const char *assembly, int insn_len) { - return scm_list_3 (scm_cons (address_symbol, - gdbscm_scm_from_ulongest (pc)), + return scm_list_3 (scm_cons (address_symbol, gdbscm_scm_from_ulongest (pc)), scm_cons (asm_symbol, gdbscm_scm_from_c_string (assembly)), - scm_cons (length_symbol, - scm_from_int (insn_len))); + scm_cons (length_symbol, scm_from_int (insn_len))); } /* Helper function for gdbscm_disasm_read_memory to safely read from a @@ -126,10 +124,11 @@ gdbscm_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, } gdbscm_disassembler::gdbscm_disassembler (struct gdbarch *gdbarch, - struct ui_file *stream, - SCM port_, ULONGEST offset_) + struct ui_file *stream, SCM port_, + ULONGEST offset_) : gdb_disassembler (gdbarch, stream, gdbscm_disasm_read_memory), - port (port_), offset (offset_) + port (port_), + offset (offset_) { } @@ -144,8 +143,8 @@ gdbscm_disassembler::gdbscm_disassembler (struct gdbarch *gdbarch, This is based on gdb_print_insn, see it for details. */ static int -gdbscm_print_insn_from_port (struct gdbarch *gdbarch, - SCM port, ULONGEST offset, CORE_ADDR memaddr, +gdbscm_print_insn_from_port (struct gdbarch *gdbarch, SCM port, + ULONGEST offset, CORE_ADDR memaddr, string_file *stream, int *branch_delay_insns) { gdbscm_disassembler di (gdbarch, stream, port, offset); @@ -176,9 +175,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) arch_smob *a_smob = arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct gdbarch *gdbarch = arscm_get_gdbarch (a_smob); - const SCM keywords[] = { - port_keyword, offset_keyword, size_keyword, count_keyword, SCM_BOOL_F - }; + const SCM keywords[] = { port_keyword, offset_keyword, size_keyword, + count_keyword, SCM_BOOL_F }; int port_arg_pos = -1, offset_arg_pos = -1; int size_arg_pos = -1, count_arg_pos = -1; SCM port = SCM_BOOL_F; @@ -193,11 +191,9 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) SCM result; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "U#OUuu", - start_scm, &start_arg, rest, - &port_arg_pos, &port, - &offset_arg_pos, &offset, - &size_arg_pos, &size, - &count_arg_pos, &count); + start_scm, &start_arg, rest, &port_arg_pos, + &port, &offset_arg_pos, &offset, &size_arg_pos, + &size, &count_arg_pos, &count); /* START is first stored in a ULONGEST because we don't have a format char for CORE_ADDR, and it's not really worth it to have one yet. */ start = start_arg; @@ -205,18 +201,16 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) if (port_arg_pos > 0) { SCM_ASSERT_TYPE (gdbscm_is_false (port) - || gdbscm_is_true (scm_input_port_p (port)), - port, port_arg_pos, FUNC_NAME, _("input port")); + || gdbscm_is_true (scm_input_port_p (port)), + port, port_arg_pos, FUNC_NAME, _ ("input port")); } using_port = gdbscm_is_true (port); - if (offset_arg_pos > 0 - && (port_arg_pos < 0 - || gdbscm_is_false (port))) + if (offset_arg_pos > 0 && (port_arg_pos < 0 || gdbscm_is_false (port))) { gdbscm_out_of_range_error (FUNC_NAME, offset_arg_pos, gdbscm_scm_from_ulongest (offset), - _("offset provided but port is missing")); + _ ("offset provided but port is missing")); } if (size_arg_pos > 0) @@ -227,10 +221,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) a nuisance we can relax things later. */ if (start + size < start) { - gdbscm_out_of_range_error (FUNC_NAME, 0, - scm_list_2 (gdbscm_scm_from_ulongest (start), - gdbscm_scm_from_ulongest (size)), - _("start+size overflows")); + gdbscm_out_of_range_error ( + FUNC_NAME, 0, + scm_list_2 (gdbscm_scm_from_ulongest (start), + gdbscm_scm_from_ulongest (size)), + _ ("start+size overflows")); } end = start + size - 1; } @@ -242,7 +237,7 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) result = SCM_EOL; - for (pc = start, i = 0; pc <= end && i < count; ) + for (pc = start, i = 0; pc <= end && i < count;) { int insn_len = 0; string_file buf; @@ -264,8 +259,7 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len), - result); + result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len), result); pc += insn_len; i++; @@ -273,13 +267,12 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest) return scm_reverse_x (result, SCM_EOL); } - + /* Initialize the Scheme architecture support. */ -static const scheme_function disasm_functions[] = -{ - { "arch-disassemble", 2, 0, 1, as_a_scm_t_subr (gdbscm_arch_disassemble), - "\ +static const scheme_function disasm_functions[] + = { { "arch-disassemble", 2, 0, 1, as_a_scm_t_subr (gdbscm_arch_disassemble), + "\ Return list of disassembled instructions in memory.\n\ \n\ Arguments: <gdb:arch> start-address\n\ @@ -299,8 +292,7 @@ Return list of disassembled instructions in memory.\n\ Each instruction in the result is an alist:\n\ (('address . address) ('asm . disassembly) ('length . length))." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_disasm (void) diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c index 529d2b3..18d334a 100644 --- a/gdb/guile/scm-exception.c +++ b/gdb/guile/scm-exception.c @@ -81,16 +81,16 @@ static SCM none_symbol; static SCM message_symbol; static SCM full_symbol; -static const char percent_print_exception_message_name[] = - "%print-exception-message"; +static const char percent_print_exception_message_name[] + = "%print-exception-message"; /* Variable containing %print-exception-message. It is not defined until late in initialization, after our init routine has run. Cope by looking it up lazily. */ static SCM percent_print_exception_message_var = SCM_BOOL_F; -static const char percent_print_exception_with_stack_name[] = - "%print-exception-with-stack"; +static const char percent_print_exception_with_stack_name[] + = "%print-exception-with-stack"; /* Variable containing %print-exception-with-stack. It is not defined until late in initialization, after our init routine @@ -100,7 +100,7 @@ static SCM percent_print_exception_with_stack_var = SCM_BOOL_F; /* Counter to keep track of the number of times we create a <gdb:exception> object, for performance monitoring purposes. */ static unsigned long gdbscm_exception_count = 0; - + /* Administrivia for exception smobs. */ /* The smob "print" function for <gdb:exception>. */ @@ -127,8 +127,9 @@ exscm_print_exception_smob (SCM self, SCM port, scm_print_state *pstate) SCM gdbscm_make_exception (SCM key, SCM args) { - exception_smob *e_smob = (exception_smob *) - scm_gc_malloc (sizeof (exception_smob), exception_smob_name); + exception_smob *e_smob + = (exception_smob *) scm_gc_malloc (sizeof (exception_smob), + exception_smob_name); SCM smob; e_smob->key = key; @@ -184,7 +185,7 @@ gdbscm_exception_args (SCM self) e_smob = (exception_smob *) SCM_SMOB_DATA (self); return e_smob->args; } - + /* Wrap an exception in a <gdb:exception> object that includes STACK. gdbscm_print_exception_with_stack knows how to unwrap it. */ @@ -217,14 +218,13 @@ gdbscm_make_error_scm (SCM key, SCM subr, SCM message, SCM args, SCM data) See gdbscm_make_error_scm for a description of the arguments. */ SCM -gdbscm_make_error (SCM key, const char *subr, const char *message, - SCM args, SCM data) -{ - return gdbscm_make_error_scm - (key, - subr == NULL ? SCM_BOOL_F : scm_from_latin1_string (subr), - message == NULL ? SCM_BOOL_F : scm_from_latin1_string (message), - args, data); +gdbscm_make_error (SCM key, const char *subr, const char *message, SCM args, + SCM data) +{ + return gdbscm_make_error_scm ( + key, subr == NULL ? SCM_BOOL_F : scm_from_latin1_string (subr), + message == NULL ? SCM_BOOL_F : scm_from_latin1_string (message), args, + data); } /* Version of SCM_ASSERT_TYPE/scm_wrong_type_arg_msg that creates a @@ -241,13 +241,13 @@ gdbscm_make_type_error (const char *subr, int arg_pos, SCM bad_value, { if (expected_type != NULL) { - msg = xstrprintf (_("Wrong type argument in position %d" - " (expecting %s): ~S"), + msg = xstrprintf (_ ("Wrong type argument in position %d" + " (expecting %s): ~S"), arg_pos, expected_type); } else { - msg = xstrprintf (_("Wrong type argument in position %d: ~S"), + msg = xstrprintf (_ ("Wrong type argument in position %d: ~S"), arg_pos); } } @@ -255,11 +255,11 @@ gdbscm_make_type_error (const char *subr, int arg_pos, SCM bad_value, { if (expected_type != NULL) { - msg = xstrprintf (_("Wrong type argument (expecting %s): ~S"), + msg = xstrprintf (_ ("Wrong type argument (expecting %s): ~S"), expected_type); } else - msg = xstrprintf (_("Wrong type argument: ~S")); + msg = xstrprintf (_ ("Wrong type argument: ~S")); } result = gdbscm_make_error (scm_arg_type_key, subr, msg.get (), @@ -285,18 +285,18 @@ gdbscm_make_arg_error (SCM key, const char *subr, int arg_pos, SCM bad_value, { if (arg_pos > 0) { - msg = xstrprintf (_("%s %s in position %d: ~S"), - error_prefix, error, arg_pos); + msg = xstrprintf (_ ("%s %s in position %d: ~S"), error_prefix, + error, arg_pos); } else - msg = xstrprintf (_("%s %s: ~S"), error_prefix, error); + msg = xstrprintf (_ ("%s %s: ~S"), error_prefix, error); } else { if (arg_pos > 0) - msg = xstrprintf (_("%s in position %d: ~S"), error, arg_pos); + msg = xstrprintf (_ ("%s in position %d: ~S"), error, arg_pos); else - msg = xstrprintf (_("%s: ~S"), error); + msg = xstrprintf (_ ("%s: ~S"), error); } result = gdbscm_make_error (key, subr, msg.get (), scm_list_1 (bad_value), @@ -311,9 +311,9 @@ SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos, SCM bad_value, const char *object) { - return gdbscm_make_arg_error (gdbscm_invalid_object_error_symbol, - subr, arg_pos, bad_value, - _("Invalid object:"), object); + return gdbscm_make_arg_error (gdbscm_invalid_object_error_symbol, subr, + arg_pos, bad_value, _ ("Invalid object:"), + object); } /* Throw an invalid-object error. @@ -335,9 +335,8 @@ SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos, SCM bad_value, const char *error) { - return gdbscm_make_arg_error (scm_out_of_range_key, - subr, arg_pos, bad_value, - _("Out of range:"), error); + return gdbscm_make_arg_error (scm_out_of_range_key, subr, arg_pos, bad_value, + _ ("Out of range:"), error); } /* Throw an out-of-range error. @@ -359,8 +358,8 @@ SCM gdbscm_make_misc_error (const char *subr, int arg_pos, SCM bad_value, const char *error) { - return gdbscm_make_arg_error (scm_misc_error_key, - subr, arg_pos, bad_value, NULL, error); + return gdbscm_make_arg_error (scm_misc_error_key, subr, arg_pos, bad_value, + NULL, error); } /* Throw a misc-error error. */ @@ -379,8 +378,7 @@ gdbscm_misc_error (const char *subr, int arg_pos, SCM bad_value, SCM gdbscm_make_memory_error (const char *subr, const char *msg, SCM args) { - return gdbscm_make_error (memory_error_symbol, subr, msg, args, - SCM_EOL); + return gdbscm_make_error (memory_error_symbol, subr, msg, args, SCM_EOL); } /* Throw a gdb:memory-error exception. */ @@ -433,7 +431,7 @@ gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception) if (exception.reason == RETURN_QUIT) { /* Handle this specially to be consistent with top-repl.scm. */ - return gdbscm_make_error (signal_symbol, NULL, _("User interrupt"), + return gdbscm_make_error (signal_symbol, NULL, _ ("User interrupt"), SCM_EOL, scm_list_1 (scm_from_int (SIGINT))); } @@ -442,10 +440,9 @@ gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception) else key = error_symbol; - return gdbscm_make_error (key, NULL, "~A", - scm_list_1 (gdbscm_scm_from_c_string - (exception.message)), - SCM_BOOL_F); + return gdbscm_make_error ( + key, NULL, "~A", scm_list_1 (gdbscm_scm_from_c_string (exception.message)), + SCM_BOOL_F); } /* Convert a GDB exception to the appropriate Scheme exception and throw it. @@ -489,8 +486,9 @@ gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args) that. */ if (gdbscm_is_false (percent_print_exception_message_var)) { - gdbscm_printf (port, _("Error in Scheme exception printing," - " can't find %s.\n"), + gdbscm_printf (port, + _ ("Error in Scheme exception printing," + " can't find %s.\n"), percent_print_exception_message_name); return; } @@ -503,7 +501,7 @@ gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args) But don't use the exception printing machinery! */ if (gdbscm_is_exception (status)) { - gdbscm_printf (port, _("Error in Scheme exception printing:\n")); + gdbscm_printf (port, _ ("Error in Scheme exception printing:\n")); scm_display (status, port); scm_newline (port); } @@ -540,8 +538,9 @@ gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args) that. */ if (gdbscm_is_false (percent_print_exception_with_stack_var)) { - gdbscm_printf (port, _("Error in Scheme exception printing," - " can't find %s.\n"), + gdbscm_printf (port, + _ ("Error in Scheme exception printing," + " can't find %s.\n"), percent_print_exception_with_stack_name); return; } @@ -554,7 +553,7 @@ gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args) But don't use the exception printing machinery! */ if (gdbscm_is_exception (status)) { - gdbscm_printf (port, _("Error in Scheme exception printing:\n")); + gdbscm_printf (port, _ ("Error in Scheme exception printing:\n")); scm_display (status, port); scm_newline (port); } @@ -590,8 +589,7 @@ gdbscm_exception_message_to_string (SCM exception) if (scm_is_eq (key, with_stack_error_symbol) /* Don't crash on a badly generated gdb:with-stack exception. */ - && scm_is_pair (args) - && scm_is_pair (scm_cdr (args))) + && scm_is_pair (args) && scm_is_pair (scm_cdr (args))) { key = scm_car (args); args = scm_cddr (args); @@ -627,54 +625,44 @@ gdbscm_percent_exception_count (void) { return scm_from_ulong (gdbscm_exception_count); } - + /* Initialize the Scheme exception support. */ -static const scheme_function exception_functions[] = -{ - { "make-exception", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_exception), - "\ +static const scheme_function exception_functions[] + = { { "make-exception", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_exception), "\ Create a <gdb:exception> object.\n\ \n\ Arguments: key args\n\ These are the standard key,args arguments of \"throw\"." }, - { "exception?", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_p), - "\ + { "exception?", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_p), "\ Return #t if the object is a <gdb:exception> object." }, - { "exception-key", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_key), - "\ + { "exception-key", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_key), "\ Return the exception's key." }, - { "exception-args", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_args), - "\ + { "exception-args", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_args), "\ Return the exception's arg list." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; -static const scheme_function private_exception_functions[] = -{ - { "%exception-print-style", 0, 0, 0, - as_a_scm_t_subr (gdbscm_percent_exception_print_style), - "\ +static const scheme_function private_exception_functions[] + = { { "%exception-print-style", 0, 0, 0, + as_a_scm_t_subr (gdbscm_percent_exception_print_style), "\ Return the value of the \"guile print-stack\" option." }, - { "%exception-count", 0, 0, 0, - as_a_scm_t_subr (gdbscm_percent_exception_count), - "\ + { "%exception-count", 0, 0, 0, + as_a_scm_t_subr (gdbscm_percent_exception_count), "\ Return a count of the number of <gdb:exception> objects created.\n\ This is for debugging purposes." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_exceptions (void) { - exception_smob_tag = gdbscm_make_smob_type (exception_smob_name, - sizeof (exception_smob)); + exception_smob_tag + = gdbscm_make_smob_type (exception_smob_name, sizeof (exception_smob)); scm_set_smob_print (exception_smob_tag, exscm_print_exception_smob); gdbscm_define_functions (exception_functions, 1); diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 45863c5..055558f 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -84,8 +84,7 @@ struct frscm_deleter /* Helper function for frscm_del_inferior_frames to mark the frame as invalid. */ - static int - frscm_mark_frame_invalid (void **slot, void *info) + static int frscm_mark_frame_invalid (void **slot, void *info) { frame_smob *f_smob = (frame_smob *) *slot; @@ -102,8 +101,8 @@ struct frscm_deleter }; static const registry<inferior>::key<htab, frscm_deleter> - frscm_inferior_data_key; - + frscm_inferior_data_key; + /* Administrivia for frame smobs. */ /* Helper function to hash a frame_smob. */ @@ -120,8 +119,8 @@ frscm_hash_frame_smob (const void *p) if (fid->code_addr_p) hash = iterative_hash (&fid->code_addr, sizeof (fid->code_addr), hash); if (fid->special_addr_p) - hash = iterative_hash (&fid->special_addr, sizeof (fid->special_addr), - hash); + hash + = iterative_hash (&fid->special_addr, sizeof (fid->special_addr), hash); return hash; } @@ -134,8 +133,7 @@ frscm_eq_frame_smob (const void *ap, const void *bp) const frame_smob *a = (const frame_smob *) ap; const frame_smob *b = (const frame_smob *) bp; - return (a->frame_id == b->frame_id - && a->inferior == b->inferior + return (a->frame_id == b->frame_id && a->inferior == b->inferior && a->inferior != NULL); } @@ -184,8 +182,7 @@ frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate) { frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self); - gdbscm_printf (port, "#<%s %s>", - frame_smob_name, + gdbscm_printf (port, "#<%s %s>", frame_smob_name, f_smob->frame_id.to_string ().c_str ()); scm_remember_upto_here_1 (self); @@ -198,8 +195,8 @@ frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate) static SCM frscm_make_frame_smob (void) { - frame_smob *f_smob = (frame_smob *) - scm_gc_malloc (sizeof (frame_smob), frame_smob_name); + frame_smob *f_smob + = (frame_smob *) scm_gc_malloc (sizeof (frame_smob), frame_smob_name); SCM f_scm; f_smob->frame_id = null_frame_id; @@ -346,11 +343,10 @@ frscm_get_frame_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name) if (f_smob->inferior == NULL) { - gdbscm_invalid_object_error (func_name, arg_pos, self, - _("inferior")); + gdbscm_invalid_object_error (func_name, arg_pos, self, _ ("inferior")); } if (f_smob->inferior != current_inferior ()) - scm_misc_error (func_name, _("inferior has changed"), SCM_EOL); + scm_misc_error (func_name, _ ("inferior has changed"), SCM_EOL); return f_smob; } @@ -374,7 +370,6 @@ frscm_frame_smob_to_frame (frame_smob *f_smob) return frame; } - /* Frame methods. */ /* (frame-valid? <gdb:frame>) -> bool @@ -438,7 +433,7 @@ gdbscm_frame_name (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } if (name != NULL) @@ -480,7 +475,7 @@ gdbscm_frame_type (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return scm_from_int (type); @@ -512,7 +507,7 @@ gdbscm_frame_arch (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return arscm_scm_from_arch (f_smob->gdbarch); @@ -549,7 +544,7 @@ gdbscm_frame_unwind_stop_reason (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return scm_from_int (stop_reason); @@ -586,7 +581,7 @@ gdbscm_frame_pc (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return gdbscm_scm_from_ulongest (pc); @@ -623,24 +618,22 @@ gdbscm_frame_block (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } - for (fn_block = block; - fn_block != NULL && fn_block->function () == NULL; + for (fn_block = block; fn_block != NULL && fn_block->function () == NULL; fn_block = fn_block->superblock ()) continue; if (block == NULL || fn_block == NULL || fn_block->function () == NULL) { - scm_misc_error (FUNC_NAME, _("cannot find block for frame"), + scm_misc_error (FUNC_NAME, _ ("cannot find block for frame"), scm_list_1 (self)); } if (block != NULL) { - return bkscm_scm_from_block - (block, fn_block->function ()->objfile ()); + return bkscm_scm_from_block (block, fn_block->function ()->objfile ()); } return SCM_BOOL_F; @@ -678,7 +671,7 @@ gdbscm_frame_function (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } if (sym != NULL) @@ -719,7 +712,7 @@ gdbscm_frame_older (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } if (prev != NULL) @@ -760,7 +753,7 @@ gdbscm_frame_newer (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } if (next != NULL) @@ -800,7 +793,7 @@ gdbscm_frame_sal (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return stscm_scm_from_sal (sal); @@ -818,8 +811,8 @@ gdbscm_frame_read_register (SCM self, SCM register_scm) frame_smob *f_smob; f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s", - register_scm, ®ister_str); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s", register_scm, + ®ister_str); gdbscm_gdb_exception except {}; @@ -849,13 +842,13 @@ gdbscm_frame_read_register (SCM self, SCM register_scm) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } if (value == NULL) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, register_scm, - _("unknown register")); + _ ("unknown register")); } return vlscm_scm_from_value (value); @@ -897,23 +890,23 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) if (frame == NULL) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG3, keywords, "#O", - rest, &block_arg_pos, &block_scm); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG3, keywords, "#O", rest, + &block_arg_pos, &block_scm); if (syscm_is_symbol (symbol_scm)) { - var = syscm_get_valid_symbol_arg_unsafe (symbol_scm, SCM_ARG2, - FUNC_NAME); + var + = syscm_get_valid_symbol_arg_unsafe (symbol_scm, SCM_ARG2, FUNC_NAME); SCM_ASSERT (SCM_UNBNDP (block_scm), block_scm, SCM_ARG3, FUNC_NAME); } else if (scm_is_string (symbol_scm)) { gdbscm_gdb_exception except {}; - if (! SCM_UNBNDP (block_scm)) + if (!SCM_UNBNDP (block_scm)) { SCM except_scm; @@ -925,8 +918,8 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) } { - gdb::unique_xmalloc_ptr<char> var_name - (gdbscm_scm_to_c_string (symbol_scm)); + gdb::unique_xmalloc_ptr<char> var_name ( + gdbscm_scm_to_c_string (symbol_scm)); /* N.B. Between here and the end of the scope, don't do anything to cause a Scheme exception. */ @@ -936,8 +929,8 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) if (block == NULL) block = get_frame_block (frame_info_ptr (frame), NULL); - lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN, - NULL); + lookup_sym + = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL); var = lookup_sym.symbol; block = lookup_sym.block; } @@ -951,13 +944,13 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) if (var == NULL) gdbscm_out_of_range_error (FUNC_NAME, 0, symbol_scm, - _("variable not found")); + _ ("variable not found")); } else { /* Use SCM_ASSERT_TYPE for more consistent error messages. */ SCM_ASSERT_TYPE (0, symbol_scm, SCM_ARG1, FUNC_NAME, - _("gdb:symbol or string")); + _ ("gdb:symbol or string")); } try @@ -1003,7 +996,7 @@ gdbscm_frame_select (SCM self) if (!found) { gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self, - _("<gdb:frame>")); + _ ("<gdb:frame>")); } return SCM_UNSPECIFIED; @@ -1042,7 +1035,7 @@ gdbscm_selected_frame (void) gdbscm_gdb_exception exc {}; try { - frame = get_selected_frame (_("No frame is currently selected")).get (); + frame = get_selected_frame (_ ("No frame is currently selected")).get (); } catch (const gdb_exception &except) { @@ -1062,8 +1055,8 @@ gdbscm_unwind_stop_reason_string (SCM reason_scm) int reason; const char *str; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", - reason_scm, &reason); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", reason_scm, + &reason); if (reason < UNWIND_FIRST || reason > UNWIND_LAST) scm_out_of_range (FUNC_NAME, reason_scm); @@ -1071,123 +1064,100 @@ gdbscm_unwind_stop_reason_string (SCM reason_scm) str = unwind_stop_reason_to_string ((enum unwind_stop_reason) reason); return gdbscm_scm_from_c_string (str); } - + /* Initialize the Scheme frame support. */ -static const scheme_integer_constant frame_integer_constants[] = -{ -#define ENTRY(X) { #X, X } - - ENTRY (NORMAL_FRAME), - ENTRY (DUMMY_FRAME), - ENTRY (INLINE_FRAME), - ENTRY (TAILCALL_FRAME), - ENTRY (SIGTRAMP_FRAME), - ENTRY (ARCH_FRAME), +static const scheme_integer_constant frame_integer_constants[] = { +#define ENTRY(X) \ + { \ +#X, X \ + } + + ENTRY (NORMAL_FRAME), ENTRY (DUMMY_FRAME), ENTRY (INLINE_FRAME), + ENTRY (TAILCALL_FRAME), ENTRY (SIGTRAMP_FRAME), ENTRY (ARCH_FRAME), ENTRY (SENTINEL_FRAME), #undef ENTRY -#define SET(name, description) \ - { "FRAME_" #name, name }, +#define SET(name, description) { "FRAME_" #name, name }, #include "unwind_stop_reasons.def" #undef SET END_INTEGER_CONSTANTS }; -static const scheme_function frame_functions[] = -{ - { "frame?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_p), - "\ +static const scheme_function frame_functions[] + = { { "frame?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_p), "\ Return #t if the object is a <gdb:frame> object." }, - { "frame-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_valid_p), - "\ + { "frame-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_valid_p), "\ Return #t if the object is a valid <gdb:frame> object.\n\ Frames become invalid when the inferior returns to its caller." }, - { "frame-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_name), - "\ + { "frame-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_name), "\ Return the name of the function corresponding to this frame,\n\ or #f if there is no function." }, - { "frame-arch", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_arch), - "\ + { "frame-arch", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_arch), "\ Return the frame's architecture as a <gdb:arch> object." }, - { "frame-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_type), - "\ + { "frame-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_type), "\ Return the frame type, namely one of the gdb:*_FRAME constants." }, - { "frame-unwind-stop-reason", 1, 0, 0, - as_a_scm_t_subr (gdbscm_frame_unwind_stop_reason), - "\ + { "frame-unwind-stop-reason", 1, 0, 0, + as_a_scm_t_subr (gdbscm_frame_unwind_stop_reason), "\ Return one of the gdb:FRAME_UNWIND_* constants explaining why\n\ it's not possible to find frames older than this." }, - { "frame-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_pc), - "\ + { "frame-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_pc), "\ Return the frame's resume address." }, - { "frame-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_block), - "\ + { "frame-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_block), "\ Return the frame's code block, or #f if one cannot be found." }, - { "frame-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_function), - "\ + { "frame-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_function), "\ Return the <gdb:symbol> for the function corresponding to this frame,\n\ or #f if there isn't one." }, - { "frame-older", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_older), - "\ + { "frame-older", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_older), "\ Return the frame immediately older (outer) to this frame,\n\ or #f if there isn't one." }, - { "frame-newer", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_newer), - "\ + { "frame-newer", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_newer), "\ Return the frame immediately newer (inner) to this frame,\n\ or #f if there isn't one." }, - { "frame-sal", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_sal), - "\ + { "frame-sal", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_sal), "\ Return the frame's symtab-and-line <gdb:sal> object." }, - { "frame-read-var", 2, 0, 1, as_a_scm_t_subr (gdbscm_frame_read_var), - "\ + { "frame-read-var", 2, 0, 1, as_a_scm_t_subr (gdbscm_frame_read_var), "\ Return the value of the symbol in the frame.\n\ \n\ Arguments: <gdb:frame> <gdb:symbol>\n\ Or: <gdb:frame> string [#:block <gdb:block>]" }, - { "frame-read-register", 2, 0, 0, - as_a_scm_t_subr (gdbscm_frame_read_register), - "\ + { "frame-read-register", 2, 0, 0, + as_a_scm_t_subr (gdbscm_frame_read_register), "\ Return the value of the register in the frame.\n\ \n\ Arguments: <gdb:frame> string" }, - { "frame-select", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_select), - "\ + { "frame-select", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_select), "\ Select this frame." }, - { "newest-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_newest_frame), - "\ + { "newest-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_newest_frame), "\ Return the newest frame." }, - { "selected-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_selected_frame), - "\ + { "selected-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_selected_frame), "\ Return the selected frame." }, - { "unwind-stop-reason-string", 1, 0, 0, - as_a_scm_t_subr (gdbscm_unwind_stop_reason_string), - "\ + { "unwind-stop-reason-string", 1, 0, 0, + as_a_scm_t_subr (gdbscm_unwind_stop_reason_string), "\ Return a string explaining the unwind stop reason.\n\ \n\ Arguments: integer (the result of frame-unwind-stop-reason)" }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_frames (void) diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c index a0724d8..e5884a6 100644 --- a/gdb/guile/scm-gsmob.c +++ b/gdb/guile/scm-gsmob.c @@ -91,8 +91,8 @@ gdbscm_is_gsmob (SCM scm) if (SCM_IMP (scm)) return 0; - slot = htab_find_slot (registered_gsmobs, (void *) SCM_TYP16 (scm), - NO_INSERT); + slot + = htab_find_slot (registered_gsmobs, (void *) SCM_TYP16 (scm), NO_INSERT); return slot != NULL; } @@ -109,19 +109,22 @@ gdbscm_make_smob_type (const char *name, size_t size) #if SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 0 /* Prior to Guile 2.1.0, smob classes were only exposed via exports from the (oop goops) module. */ - SCM bound_name = scm_string_append (scm_list_3 (scm_from_latin1_string ("<"), - scm_from_latin1_string (name), - scm_from_latin1_string (">"))); + SCM bound_name + = scm_string_append (scm_list_3 (scm_from_latin1_string ("<"), + scm_from_latin1_string (name), + scm_from_latin1_string (">"))); bound_name = scm_string_to_symbol (bound_name); - SCM smob_type = scm_public_ref (scm_list_2 (scm_from_latin1_symbol ("oop"), - scm_from_latin1_symbol ("goops")), - bound_name); -#elif SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 1 && SCM_MICRO_VERSION == 0 + SCM smob_type + = scm_public_ref (scm_list_2 (scm_from_latin1_symbol ("oop"), + scm_from_latin1_symbol ("goops")), + bound_name); +#elif SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 1 \ + && SCM_MICRO_VERSION == 0 /* Guile 2.1.0 doesn't provide any API for looking up smob classes. We could try allocating a fake instance and using scm_class_of, but it's probably not worth the trouble for the sake of a single development release. */ -# error "Unsupported Guile version" +#error "Unsupported Guile version" #else /* Guile 2.1.1 and above provides scm_smob_type_class. */ SCM smob_type = scm_smob_type_class (result); @@ -165,7 +168,6 @@ gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, SCM containing_scm) base->containing_scm = containing_scm; } - /* gsmob accessors */ /* Return the gsmob in SELF. @@ -175,7 +177,7 @@ static SCM gsscm_get_gsmob_arg_unsafe (SCM self, int arg_pos, const char *func_name) { SCM_ASSERT_TYPE (gdbscm_is_gsmob (self), self, arg_pos, func_name, - _("any gdb smob")); + _ ("any gdb smob")); return self; } @@ -201,7 +203,6 @@ gdbscm_gsmob_kind (SCM self) return result; } - /* When underlying gdb data structures are deleted, we need to update any smobs with references to them. There are several smobs that reference objfile-based data, so we provide helpers to manage this. */ @@ -212,8 +213,7 @@ gdbscm_gsmob_kind (SCM self) htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn, htab_eq eq_fn) { - htab_t htab = htab_create_alloc (7, hash_fn, eq_fn, - NULL, xcalloc, xfree); + htab_t htab = htab_create_alloc (7, hash_fn, eq_fn, NULL, xcalloc, xfree); return htab; } @@ -255,16 +255,14 @@ gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base) gdb_assert (slot != NULL); htab_clear_slot (htab, slot); } - + /* Initialize the Scheme gsmobs code. */ -static const scheme_function gsmob_functions[] = -{ +static const scheme_function gsmob_functions[] = { /* N.B. There is a general rule of not naming symbols in gdb-guile with a "gdb" prefix. This symbol does not violate this rule because it is to be read as "gdb-object-foo", not "gdb-foo". */ - { "gdb-object-kind", 1, 0, 0, as_a_scm_t_subr (gdbscm_gsmob_kind), - "\ + { "gdb-object-kind", 1, 0, 0, as_a_scm_t_subr (gdbscm_gsmob_kind), "\ Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." }, END_FUNCTIONS @@ -273,8 +271,7 @@ Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." }, void gdbscm_initialize_smobs (void) { - registered_gsmobs = htab_create_alloc (10, - hash_scm_t_bits, eq_scm_t_bits, + registered_gsmobs = htab_create_alloc (10, hash_scm_t_bits, eq_scm_t_bits, NULL, xcalloc, xfree); gdbscm_define_functions (gsmob_functions, 1); diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c index a26e0b7..249a070 100644 --- a/gdb/guile/scm-iterator.c +++ b/gdb/guile/scm-iterator.c @@ -106,7 +106,7 @@ itscm_set_iterator_smob_progress_x (iterator_smob *i_smob, SCM progress) { i_smob->progress = progress; } - + /* Administrivia for iterator smobs. */ /* The smob "print" function for <gdb:iterator>. */ @@ -137,8 +137,9 @@ itscm_print_iterator_smob (SCM self, SCM port, scm_print_state *pstate) static SCM itscm_make_iterator_smob (SCM object, SCM progress, SCM next) { - iterator_smob *i_smob = (iterator_smob *) - scm_gc_malloc (sizeof (iterator_smob), iterator_smob_name); + iterator_smob *i_smob + = (iterator_smob *) scm_gc_malloc (sizeof (iterator_smob), + iterator_smob_name); SCM i_scm; i_smob->object = object; @@ -158,7 +159,7 @@ gdbscm_make_iterator (SCM object, SCM progress, SCM next) SCM i_scm; SCM_ASSERT_TYPE (gdbscm_is_procedure (next), next, SCM_ARG3, FUNC_NAME, - _("procedure")); + _ ("procedure")); i_scm = itscm_make_iterator_smob (object, progress, next); @@ -220,7 +221,7 @@ itscm_safe_call_next_x (SCM iter, excp_matcher_func *ok_excps) i_smob = (iterator_smob *) SCM_SMOB_DATA (iter); return gdbscm_safe_call_1 (i_smob->next_x, iter, ok_excps); } - + /* Iterator methods. */ /* Returns the <gdb:iterator> smob in SELF. @@ -295,13 +296,11 @@ gdbscm_iterator_next_x (SCM self) return gdbscm_safe_call_1 (i_smob->next_x, self, NULL); } - + /* Initialize the Scheme iterator code. */ -static const scheme_function iterator_functions[] = -{ - { "make-iterator", 3, 0, 0, as_a_scm_t_subr (gdbscm_make_iterator), - "\ +static const scheme_function iterator_functions[] = { + { "make-iterator", 3, 0, 0, as_a_scm_t_subr (gdbscm_make_iterator), "\ Create a <gdb:iterator> object.\n\ \n\ Arguments: object progress next!\n\ @@ -313,12 +312,10 @@ Create a <gdb:iterator> object.\n\ By convention end-of-iteration should be marked with (end-of-iteration)\n\ from module (gdb iterator)." }, - { "iterator?", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_p), - "\ + { "iterator?", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_p), "\ Return #t if the object is a <gdb:iterator> object." }, - { "iterator-object", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_object), - "\ + { "iterator-object", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_object), "\ Return the object being iterated over." }, { "iterator-progress", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_progress), @@ -326,16 +323,13 @@ Return the object being iterated over." }, Return the progress object of the iterator." }, { "set-iterator-progress!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_iterator_progress_x), - "\ + as_a_scm_t_subr (gdbscm_set_iterator_progress_x), "\ Set the progress object of the iterator." }, - { "iterator-next!", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_next_x), - "\ + { "iterator-next!", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_next_x), "\ Invoke the next! procedure of the iterator and return its result." }, - { "end-of-iteration", 0, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration), - "\ + { "end-of-iteration", 0, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration), "\ Return the end-of-iteration marker." }, { "end-of-iteration?", 1, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration_p), @@ -348,8 +342,8 @@ Return #t if the object is the end-of-iteration marker." }, void gdbscm_initialize_iterators (void) { - iterator_smob_tag = gdbscm_make_smob_type (iterator_smob_name, - sizeof (iterator_smob)); + iterator_smob_tag + = gdbscm_make_smob_type (iterator_smob_name, sizeof (iterator_smob)); scm_set_smob_print (iterator_smob_tag, itscm_print_iterator_smob); gdbscm_define_functions (iterator_functions, 1); diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c index 7efbb44..ec21b1e 100644 --- a/gdb/guile/scm-lazy-string.c +++ b/gdb/guile/scm-lazy-string.c @@ -64,7 +64,7 @@ static const char lazy_string_smob_name[] = "gdb:lazy-string"; /* The tag Guile knows the lazy string smob by. */ static scm_t_bits lazy_string_smob_tag; - + /* Administrivia for lazy string smobs. */ /* The smob "free" function for <gdb:lazy-string>. */ @@ -110,8 +110,9 @@ static SCM lsscm_make_lazy_string_smob (CORE_ADDR address, int length, const char *encoding, struct type *type) { - lazy_string_smob *ls_smob = (lazy_string_smob *) - scm_gc_malloc (sizeof (lazy_string_smob), lazy_string_smob_name); + lazy_string_smob *ls_smob + = (lazy_string_smob *) scm_gc_malloc (sizeof (lazy_string_smob), + lazy_string_smob_name); SCM ls_scm; gdb_assert (length >= -1); @@ -152,28 +153,27 @@ gdbscm_lazy_string_p (SCM scm) If there's an error a <gdb:exception> object is returned. */ SCM -lsscm_make_lazy_string (CORE_ADDR address, int length, - const char *encoding, struct type *type) +lsscm_make_lazy_string (CORE_ADDR address, int length, const char *encoding, + struct type *type) { if (length < -1) { - return gdbscm_make_out_of_range_error (NULL, 0, - scm_from_int (length), - _("invalid length")); + return gdbscm_make_out_of_range_error (NULL, 0, scm_from_int (length), + _ ("invalid length")); } if (address == 0 && length != 0) { - return gdbscm_make_out_of_range_error - (NULL, 0, scm_from_int (length), - _("cannot create a lazy string with address 0x0," + return gdbscm_make_out_of_range_error ( + NULL, 0, scm_from_int (length), + _ ("cannot create a lazy string with address 0x0," " and a non-zero length")); } if (type == NULL) { - return gdbscm_make_out_of_range_error - (NULL, 0, scm_from_int (0), _("a lazy string's type cannot be NULL")); + return gdbscm_make_out_of_range_error ( + NULL, 0, scm_from_int (0), _ ("a lazy string's type cannot be NULL")); } return lsscm_make_lazy_string_smob (address, length, encoding, type); @@ -212,7 +212,7 @@ lsscm_elt_type (lazy_string_smob *ls_smob) return realtype; } } - + /* Lazy string methods. */ /* (lazy-string-address <gdb:lazy-string>) -> address */ @@ -303,9 +303,8 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos, if (ls_smob->address == 0) { - *except_scmp - = gdbscm_make_out_of_range_error (func_name, arg_pos, string, - _("cannot create a value from NULL")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, arg_pos, string, _ ("cannot create a value from NULL")); return NULL; } @@ -324,8 +323,8 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos, /* PR 20786: There's no way to specify an array of length zero. Record a length of [0,-1] which is how Ada does it. Anything we do is broken, but this one possible solution. */ - type = lookup_array_range_type (realtype->target_type (), - 0, ls_smob->length - 1); + type = lookup_array_range_type (realtype->target_type (), 0, + ls_smob->length - 1); value = value_at_lazy (type, ls_smob->address); } else @@ -360,52 +359,45 @@ lsscm_val_print_lazy_string (SCM string, struct ui_file *stream, ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (string); elt_type = lsscm_elt_type (ls_smob); - val_print_string (elt_type, ls_smob->encoding, - ls_smob->address, ls_smob->length, - stream, options); + val_print_string (elt_type, ls_smob->encoding, ls_smob->address, + ls_smob->length, stream, options); } - + /* Initialize the Scheme lazy-strings code. */ -static const scheme_function lazy_string_functions[] = -{ - { "lazy-string?", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_p), - "\ +static const scheme_function lazy_string_functions[] + = { { "lazy-string?", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_p), "\ Return #t if the object is a <gdb:lazy-string> object." }, - { "lazy-string-address", 1, 0, 0, - as_a_scm_t_subr (gdbscm_lazy_string_address), - "\ + { "lazy-string-address", 1, 0, 0, + as_a_scm_t_subr (gdbscm_lazy_string_address), "\ Return the address of the lazy-string." }, - { "lazy-string-length", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_length), - "\ + { "lazy-string-length", 1, 0, 0, + as_a_scm_t_subr (gdbscm_lazy_string_length), "\ Return the length of the lazy-string.\n\ If the length is -1 then the length is determined by the first null\n\ of appropriate width." }, - { "lazy-string-encoding", 1, 0, 0, - as_a_scm_t_subr (gdbscm_lazy_string_encoding), - "\ + { "lazy-string-encoding", 1, 0, 0, + as_a_scm_t_subr (gdbscm_lazy_string_encoding), "\ Return the encoding of the lazy-string." }, - { "lazy-string-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_type), - "\ + { "lazy-string-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_type), + "\ Return the <gdb:type> of the lazy-string." }, - { "lazy-string->value", 1, 0, 0, - as_a_scm_t_subr (gdbscm_lazy_string_to_value), - "\ + { "lazy-string->value", 1, 0, 0, + as_a_scm_t_subr (gdbscm_lazy_string_to_value), "\ Return the <gdb:value> representation of the lazy-string." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_lazy_strings (void) { - lazy_string_smob_tag = gdbscm_make_smob_type (lazy_string_smob_name, - sizeof (lazy_string_smob)); + lazy_string_smob_tag + = gdbscm_make_smob_type (lazy_string_smob_name, sizeof (lazy_string_smob)); scm_set_smob_free (lazy_string_smob_tag, lsscm_free_lazy_string_smob); scm_set_smob_print (lazy_string_smob_tag, lsscm_print_lazy_string_smob); diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c index 26019b4..228afeb 100644 --- a/gdb/guile/scm-math.c +++ b/gdb/guile/scm-math.c @@ -80,9 +80,9 @@ vlscm_unop_gdbthrow (enum valscm_unary_opcode opcode, SCM x, scoped_value_mark free_values; SCM except_scm; - value *arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, - &except_scm, gdbarch, - language); + value *arg1 + = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm, + gdbarch, language); if (arg1 == NULL) return except_scm; @@ -96,8 +96,7 @@ vlscm_unop_gdbthrow (enum valscm_unary_opcode opcode, SCM x, { struct type *type = language_bool_type (language, gdbarch); res_val - = value_from_longest (type, - (LONGEST) value_logical_not (arg1)); + = value_from_longest (type, (LONGEST) value_logical_not (arg1)); } break; case VALSCM_NEG: @@ -146,13 +145,13 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y, scoped_value_mark free_values; - arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, - &except_scm, gdbarch, language); + arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm, + gdbarch, language); if (arg1 == NULL) return except_scm; - arg2 = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, - &except_scm, gdbarch, language); + arg2 = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, &except_scm, + gdbarch, language); if (arg2 == NULL) return except_scm; @@ -168,11 +167,9 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y, rtype = check_typedef (rtype); rtype = STRIP_REFERENCE (rtype); - if (ltype->code () == TYPE_CODE_PTR - && is_integral_type (rtype)) + if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) res_val = value_ptradd (arg1, value_as_long (arg2)); - else if (rtype->code () == TYPE_CODE_PTR - && is_integral_type (ltype)) + else if (rtype->code () == TYPE_CODE_PTR && is_integral_type (ltype)) res_val = value_ptradd (arg2, value_as_long (arg1)); else res_val = value_binop (arg1, arg2, BINOP_ADD); @@ -188,17 +185,14 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y, rtype = check_typedef (rtype); rtype = STRIP_REFERENCE (rtype); - if (ltype->code () == TYPE_CODE_PTR - && rtype->code () == TYPE_CODE_PTR) + if (ltype->code () == TYPE_CODE_PTR && rtype->code () == TYPE_CODE_PTR) { /* A ptrdiff_t for the target would be preferable here. */ - res_val - = value_from_longest (builtin_type (gdbarch)->builtin_long, - value_ptrdiff (arg1, arg2)); + res_val = value_from_longest (builtin_type (gdbarch)->builtin_long, + value_ptrdiff (arg1, arg2)); } - else if (ltype->code () == TYPE_CODE_PTR - && is_integral_type (rtype)) - res_val = value_ptradd (arg1, - value_as_long (arg2)); + else if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype)) + res_val = value_ptradd (arg1, -value_as_long (arg2)); else res_val = value_binop (arg1, arg2, BINOP_SUB); } @@ -416,53 +410,50 @@ gdbscm_value_logxor (SCM x, SCM y) static SCM vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name) { - return gdbscm_wrap ([=] - { - struct gdbarch *gdbarch = get_current_arch (); - const struct language_defn *language = current_language; - SCM except_scm; - - scoped_value_mark free_values; - - value *v1 - = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, - &except_scm, gdbarch, language); - if (v1 == NULL) - return except_scm; - - value *v2 - = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, - &except_scm, gdbarch, language); - if (v2 == NULL) - return except_scm; - - int result; - switch (op) - { - case BINOP_LESS: - result = value_less (v1, v2); - break; - case BINOP_LEQ: - result = (value_less (v1, v2) - || value_equal (v1, v2)); - break; - case BINOP_EQUAL: - result = value_equal (v1, v2); - break; - case BINOP_NOTEQUAL: - gdb_assert_not_reached ("not-equal not implemented"); - case BINOP_GTR: - result = value_less (v2, v1); - break; - case BINOP_GEQ: - result = (value_less (v2, v1) - || value_equal (v1, v2)); - break; - default: - gdb_assert_not_reached ("invalid <gdb:value> comparison"); - } - return scm_from_bool (result); - }); + return gdbscm_wrap ([=] { + struct gdbarch *gdbarch = get_current_arch (); + const struct language_defn *language = current_language; + SCM except_scm; + + scoped_value_mark free_values; + + value *v1 + = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm, + gdbarch, language); + if (v1 == NULL) + return except_scm; + + value *v2 + = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, &except_scm, + gdbarch, language); + if (v2 == NULL) + return except_scm; + + int result; + switch (op) + { + case BINOP_LESS: + result = value_less (v1, v2); + break; + case BINOP_LEQ: + result = (value_less (v1, v2) || value_equal (v1, v2)); + break; + case BINOP_EQUAL: + result = value_equal (v1, v2); + break; + case BINOP_NOTEQUAL: + gdb_assert_not_reached ("not-equal not implemented"); + case BINOP_GTR: + result = value_less (v2, v1); + break; + case BINOP_GEQ: + result = (value_less (v2, v1) || value_equal (v1, v2)); + break; + default: + gdb_assert_not_reached ("invalid <gdb:value> comparison"); + } + return scm_from_bool (result); + }); } /* (value=? x y) -> boolean @@ -506,7 +497,7 @@ gdbscm_value_ge_p (SCM x, SCM y) { return vlscm_rich_compare (BINOP_GEQ, x, y, FUNC_NAME); } - + /* Subroutine of vlscm_convert_typed_value_from_scheme to simplify it. Convert OBJ, a Scheme number, to a <gdb:value> object. OBJ_ARG_POS is its position in the argument list, used in exception text. @@ -531,10 +522,9 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, ULONGEST max = get_unsigned_type_max (type); if (!scm_is_unsigned_integer (obj, 0, max)) { - *except_scmp - = gdbscm_make_out_of_range_error - (func_name, obj_arg_pos, obj, - _("value out of range for type")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, obj_arg_pos, obj, + _ ("value out of range for type")); return NULL; } return value_from_longest (type, gdbscm_scm_to_ulongest (obj)); @@ -546,10 +536,9 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, get_signed_type_minmax (type, &min, &max); if (!scm_is_signed_integer (obj, min, max)) { - *except_scmp - = gdbscm_make_out_of_range_error - (func_name, obj_arg_pos, obj, - _("value out of range for type")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, obj_arg_pos, obj, + _ ("value out of range for type")); return NULL; } return value_from_longest (type, gdbscm_scm_to_longest (obj)); @@ -560,10 +549,8 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, CORE_ADDR max = get_pointer_type_max (type); if (!scm_is_unsigned_integer (obj, 0, max)) { - *except_scmp - = gdbscm_make_out_of_range_error - (func_name, obj_arg_pos, obj, - _("value out of range for type")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, obj_arg_pos, obj, _ ("value out of range for type")); return NULL; } return value_from_pointer (type, gdbscm_scm_to_ulongest (obj)); @@ -572,8 +559,8 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj, return value_from_host_double (type, scm_to_double (obj)); else { - *except_scmp = gdbscm_make_type_error (func_name, obj_arg_pos, obj, - NULL); + *except_scmp + = gdbscm_make_type_error (func_name, obj_arg_pos, obj, NULL); return NULL; } } @@ -650,8 +637,9 @@ vlscm_convert_number (const char *func_name, int obj_arg_pos, SCM obj, else if (scm_is_real (obj)) return value_from_host_double (bt->builtin_double, scm_to_double (obj)); - *except_scmp = gdbscm_make_out_of_range_error (func_name, obj_arg_pos, obj, - _("value not a number representable on the target")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, obj_arg_pos, obj, + _ ("value not a number representable on the target")); return NULL; } @@ -667,9 +655,9 @@ vlscm_convert_number (const char *func_name, int obj_arg_pos, SCM obj, object is stored in *EXCEPT_SCMP, and NULL is returned. */ static struct value * -vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm, - int arg_pos, const char *func_name, - SCM *except_scmp, struct gdbarch *gdbarch) +vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm, int arg_pos, + const char *func_name, SCM *except_scmp, + struct gdbarch *gdbarch) { LONGEST length = SCM_BYTEVECTOR_LENGTH (bv); struct value *value; @@ -683,14 +671,14 @@ vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm, type = check_typedef (type); if (type->length () != length) { - *except_scmp = gdbscm_make_out_of_range_error (func_name, arg_pos, - type_scm, - _("size of type does not match size of bytevector")); + *except_scmp = gdbscm_make_out_of_range_error ( + func_name, arg_pos, type_scm, + _ ("size of type does not match size of bytevector")); return NULL; } - value = value_from_contents (type, - (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (bv)); + value + = value_from_contents (type, (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (bv)); return value; } @@ -713,11 +701,9 @@ vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm, Otherwise the new value is returned, added to the all_values chain. */ struct value * -vlscm_convert_typed_value_from_scheme (const char *func_name, - int obj_arg_pos, SCM obj, - int type_arg_pos, SCM type_scm, - struct type *type, - SCM *except_scmp, +vlscm_convert_typed_value_from_scheme (const char *func_name, int obj_arg_pos, + SCM obj, int type_arg_pos, SCM type_scm, + struct type *type, SCM *except_scmp, struct gdbarch *gdbarch, const struct language_defn *language) { @@ -738,9 +724,9 @@ vlscm_convert_typed_value_from_scheme (const char *func_name, { if (type != NULL) { - except_scm = gdbscm_make_misc_error (func_name, type_arg_pos, - type_scm, - _("No type allowed")); + except_scm + = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm, + _ ("No type allowed")); value = NULL; } else @@ -748,24 +734,21 @@ vlscm_convert_typed_value_from_scheme (const char *func_name, } else if (gdbscm_is_true (scm_bytevector_p (obj))) { - value = vlscm_convert_bytevector (obj, type, type_scm, - obj_arg_pos, func_name, - &except_scm, gdbarch); + value = vlscm_convert_bytevector (obj, type, type_scm, obj_arg_pos, + func_name, &except_scm, gdbarch); } - else if (gdbscm_is_bool (obj)) + else if (gdbscm_is_bool (obj)) { - if (type != NULL - && !is_integral_type (type)) + if (type != NULL && !is_integral_type (type)) { except_scm = gdbscm_make_type_error (func_name, type_arg_pos, type_scm, NULL); } else { - value = value_from_longest (type - ? type - : language_bool_type (language, - gdbarch), + value = value_from_longest (type ? type + : language_bool_type (language, + gdbarch), gdbscm_is_true (obj)); } } @@ -789,19 +772,17 @@ vlscm_convert_typed_value_from_scheme (const char *func_name, if (type != NULL) { - except_scm = gdbscm_make_misc_error (func_name, type_arg_pos, - type_scm, - _("No type allowed")); + except_scm + = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm, + _ ("No type allowed")); value = NULL; } else { /* TODO: Provide option to specify conversion strategy. */ gdb::unique_xmalloc_ptr<char> s - = gdbscm_scm_to_string (obj, &len, - target_charset (gdbarch), - 0 /*non-strict*/, - &except_scm); + = gdbscm_scm_to_string (obj, &len, target_charset (gdbarch), + 0 /*non-strict*/, &except_scm); if (s != NULL) value = value_cstring (s.get (), len, language_string_char_type (language, @@ -814,22 +795,21 @@ vlscm_convert_typed_value_from_scheme (const char *func_name, { if (type != NULL) { - except_scm = gdbscm_make_misc_error (func_name, type_arg_pos, - type_scm, - _("No type allowed")); + except_scm + = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm, + _ ("No type allowed")); value = NULL; } else { value = lsscm_safe_lazy_string_to_value (obj, obj_arg_pos, - func_name, - &except_scm); + func_name, &except_scm); } } else /* OBJ isn't anything we support. */ { - except_scm = gdbscm_make_type_error (func_name, obj_arg_pos, obj, - NULL); + except_scm + = gdbscm_make_type_error (func_name, obj_arg_pos, obj, NULL); value = NULL; } } @@ -852,119 +832,93 @@ vlscm_convert_typed_value_from_scheme (const char *func_name, details. */ struct value * -vlscm_convert_value_from_scheme (const char *func_name, - int obj_arg_pos, SCM obj, - SCM *except_scmp, struct gdbarch *gdbarch, +vlscm_convert_value_from_scheme (const char *func_name, int obj_arg_pos, + SCM obj, SCM *except_scmp, + struct gdbarch *gdbarch, const struct language_defn *language) { return vlscm_convert_typed_value_from_scheme (func_name, obj_arg_pos, obj, -1, SCM_UNDEFINED, NULL, - except_scmp, - gdbarch, language); + except_scmp, gdbarch, + language); } - + /* Initialize value math support. */ -static const scheme_function math_functions[] = -{ - { "value-add", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_add), - "\ +static const scheme_function math_functions[] + = { { "value-add", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_add), "\ Return a + b." }, - { "value-sub", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_sub), - "\ + { "value-sub", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_sub), "\ Return a - b." }, - { "value-mul", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mul), - "\ + { "value-mul", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mul), "\ Return a * b." }, - { "value-div", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_div), - "\ + { "value-div", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_div), "\ Return a / b." }, - { "value-rem", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rem), - "\ + { "value-rem", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rem), "\ Return a % b." }, - { "value-mod", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mod), - "\ + { "value-mod", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mod), "\ Return a mod b. See Knuth 1.2.4." }, - { "value-pow", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_pow), - "\ + { "value-pow", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_pow), "\ Return pow (x, y)." }, - { "value-not", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_not), - "\ + { "value-not", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_not), "\ Return !a." }, - { "value-neg", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_neg), - "\ + { "value-neg", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_neg), "\ Return -a." }, - { "value-pos", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_pos), - "\ + { "value-pos", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_pos), "\ Return a." }, - { "value-abs", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_abs), - "\ + { "value-abs", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_abs), "\ Return abs (a)." }, - { "value-lsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lsh), - "\ + { "value-lsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lsh), "\ Return a << b." }, - { "value-rsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rsh), - "\ + { "value-rsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rsh), "\ Return a >> b." }, - { "value-min", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_min), - "\ + { "value-min", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_min), "\ Return min (a, b)." }, - { "value-max", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_max), - "\ + { "value-max", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_max), "\ Return max (a, b)." }, - { "value-lognot", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lognot), - "\ + { "value-lognot", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lognot), "\ Return ~a." }, - { "value-logand", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logand), - "\ + { "value-logand", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logand), "\ Return a & b." }, - { "value-logior", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logior), - "\ + { "value-logior", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logior), "\ Return a | b." }, - { "value-logxor", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logxor), - "\ + { "value-logxor", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logxor), "\ Return a ^ b." }, - { "value=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_eq_p), - "\ + { "value=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_eq_p), "\ Return a == b." }, - { "value<?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lt_p), - "\ + { "value<?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lt_p), "\ Return a < b." }, - { "value<=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_le_p), - "\ + { "value<=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_le_p), "\ Return a <= b." }, - { "value>?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_gt_p), - "\ + { "value>?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_gt_p), "\ Return a > b." }, - { "value>=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_ge_p), - "\ + { "value>=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_ge_p), "\ Return a >= b." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_math (void) diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c index 9a7e3a3..1c258ec 100644 --- a/gdb/guile/scm-objfile.c +++ b/gdb/guile/scm-objfile.c @@ -60,7 +60,7 @@ struct ofscm_deleter }; static const registry<objfile>::key<objfile_smob, ofscm_deleter> - ofscm_objfile_data_key; + ofscm_objfile_data_key; /* Return the list of pretty-printers registered with O_SMOB. */ @@ -69,7 +69,7 @@ ofscm_objfile_smob_pretty_printers (objfile_smob *o_smob) { return o_smob->pretty_printers; } - + /* Administrivia for objfile smobs. */ /* The smob "print" function for <gdb:objfile>. */ @@ -81,9 +81,8 @@ ofscm_print_objfile_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, "#<%s ", objfile_smob_name); gdbscm_printf (port, "%s", - o_smob->objfile != NULL - ? objfile_name (o_smob->objfile) - : "{invalid}"); + o_smob->objfile != NULL ? objfile_name (o_smob->objfile) + : "{invalid}"); scm_puts (">", port); scm_remember_upto_here_1 (self); @@ -99,8 +98,8 @@ ofscm_print_objfile_smob (SCM self, SCM port, scm_print_state *pstate) static SCM ofscm_make_objfile_smob (void) { - objfile_smob *o_smob = (objfile_smob *) - scm_gc_malloc (sizeof (objfile_smob), objfile_smob_name); + objfile_smob *o_smob = (objfile_smob *) scm_gc_malloc (sizeof (objfile_smob), + objfile_smob_name); SCM o_scm; o_smob->objfile = NULL; @@ -208,12 +207,12 @@ ofscm_get_valid_objfile_smob_arg_unsafe (SCM self, int arg_pos, if (!ofscm_is_valid (o_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:objfile>")); + _ ("<gdb:objfile>")); } return o_smob; } - + /* Objfile methods. */ /* (objfile-valid? <gdb:objfile>) -> boolean @@ -275,14 +274,14 @@ gdbscm_set_objfile_pretty_printers_x (SCM self, SCM printers) objfile_smob *o_smob = ofscm_get_objfile_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, - SCM_ARG2, FUNC_NAME, _("list")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG2, + FUNC_NAME, _ ("list")); o_smob->pretty_printers = printers; return SCM_UNSPECIFIED; } - + /* The "current" objfile. This is set when gdb detects that a new objfile has been loaded. It is only set for the duration of a call to gdbscm_source_objfile_script and gdbscm_execute_objfile_script; it is NULL @@ -363,47 +362,40 @@ gdbscm_objfiles (void) return scm_reverse_x (result, SCM_EOL); } - + /* Initialize the Scheme objfile support. */ -static const scheme_function objfile_functions[] = -{ - { "objfile?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_p), - "\ +static const scheme_function objfile_functions[] + = { { "objfile?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_p), "\ Return #t if the object is a <gdb:objfile> object." }, - { "objfile-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_valid_p), - "\ + { "objfile-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_valid_p), "\ Return #t if the objfile is valid (hasn't been deleted from gdb)." }, - { "objfile-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_filename), - "\ + { "objfile-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_filename), + "\ Return the file name of the objfile." }, - { "objfile-progspace", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_progspace), - "\ + { "objfile-progspace", 1, 0, 0, + as_a_scm_t_subr (gdbscm_objfile_progspace), "\ Return the progspace that the objfile lives in." }, - { "objfile-pretty-printers", 1, 0, 0, - as_a_scm_t_subr (gdbscm_objfile_pretty_printers), - "\ + { "objfile-pretty-printers", 1, 0, 0, + as_a_scm_t_subr (gdbscm_objfile_pretty_printers), "\ Return a list of pretty-printers of the objfile." }, - { "set-objfile-pretty-printers!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_objfile_pretty_printers_x), - "\ + { "set-objfile-pretty-printers!", 2, 0, 0, + as_a_scm_t_subr (gdbscm_set_objfile_pretty_printers_x), "\ Set the list of pretty-printers of the objfile." }, - { "current-objfile", 0, 0, 0, as_a_scm_t_subr (gdbscm_get_current_objfile), - "\ + { "current-objfile", 0, 0, 0, + as_a_scm_t_subr (gdbscm_get_current_objfile), "\ Return the current objfile if there is one or #f if there isn't one." }, - { "objfiles", 0, 0, 0, as_a_scm_t_subr (gdbscm_objfiles), - "\ + { "objfiles", 0, 0, 0, as_a_scm_t_subr (gdbscm_objfiles), "\ Return a list of all objfiles in the current program space." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_objfiles (void) diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index 0bb87b0..5a54216 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -99,7 +99,7 @@ struct param_smob /* For an enum parameter, the possible values. The vector lives in GC space, it will be freed with the smob. */ - const char * const *enumeration; + const char *const *enumeration; /* The set_func funcion or #f if not specified. This function is called *after* the parameter is set. @@ -143,21 +143,17 @@ static const struct /* Extra literals, such as `unlimited', accepted in lieu of a number. */ const literal_def *extra_literals; -} -param_to_var[] = -{ - { var_boolean }, - { var_auto_boolean }, - { var_integer }, - { var_uinteger, uinteger_unlimited_literals }, - { var_uinteger }, - { var_pinteger, pinteger_unlimited_literals }, - { var_string }, - { var_string_noescape }, - { var_optional_filename }, - { var_filename }, - { var_enum } -}; +} param_to_var[] = { { var_boolean }, + { var_auto_boolean }, + { var_integer }, + { var_uinteger, uinteger_unlimited_literals }, + { var_uinteger }, + { var_pinteger, pinteger_unlimited_literals }, + { var_string }, + { var_string_noescape }, + { var_optional_filename }, + { var_filename }, + { var_enum } }; /* Wraps a setting around an existing param_smob. This abstraction is used to manipulate the value in S->VALUE in a type safe manner using @@ -205,7 +201,7 @@ static int pascm_is_valid (param_smob *); static const char *pascm_param_type_name (enum param_types type); static SCM pascm_param_value (const setting &var, int arg_pos, const char *func_name); - + /* Administrivia for parameter smobs. */ static int @@ -218,7 +214,7 @@ pascm_print_param_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, " %s", p_smob->name); - if (! pascm_is_valid (p_smob)) + if (!pascm_is_valid (p_smob)) scm_puts (" {invalid}", port); gdbscm_printf (port, " %s ", p_smob->pname); @@ -239,8 +235,8 @@ pascm_print_param_smob (SCM self, SCM port, scm_print_state *pstate) static SCM pascm_make_param_smob (void) { - param_smob *p_smob = (param_smob *) - scm_gc_malloc (sizeof (param_smob), param_smob_name); + param_smob *p_smob + = (param_smob *) scm_gc_malloc (sizeof (param_smob), param_smob_name); SCM p_scm; memset (p_smob, 0, sizeof (*p_smob)); @@ -302,14 +298,14 @@ pascm_is_valid (param_smob *p_smob) { return p_smob->commands.set != nullptr; } - + /* A helper function which return the default documentation string for a parameter (which is to say that it's undocumented). */ static char * get_doc_string (void) { - return xstrdup (_("This command is not documented.")); + return xstrdup (_ ("This command is not documented.")); } /* Subroutine of pascm_set_func, pascm_show_func to simplify them. @@ -354,18 +350,18 @@ pascm_set_func (const char *args, int from_tty, struct cmd_list_element *c) if (gdbscm_is_exception (result)) { pascm_signal_setshow_error (result, - _("Error occurred setting parameter.")); + _ ("Error occurred setting parameter.")); } if (!scm_is_string (result)) - error (_("Result of %s set-func is not a string."), p_smob->name); + error (_ ("Result of %s set-func is not a string."), p_smob->name); - gdb::unique_xmalloc_ptr<char> msg = gdbscm_scm_to_host_string (result, NULL, - &exception); + gdb::unique_xmalloc_ptr<char> msg + = gdbscm_scm_to_host_string (result, NULL, &exception); if (msg == NULL) { gdbscm_print_gdb_exception (SCM_BOOL_F, exception); - error (_("Error converting show text to host string.")); + error (_ ("Error converting show text to host string.")); } /* GDB is usually silent when a parameter is set. */ @@ -390,7 +386,7 @@ pascm_show_func (struct ui_file *file, int from_tty, value_scm = gdbscm_scm_from_host_string (value, strlen (value)); if (gdbscm_is_exception (value_scm)) { - error (_("Error converting parameter value \"%s\" to Scheme string."), + error (_ ("Error converting parameter value \"%s\" to Scheme string."), value); } self = p_smob->containing_scm; @@ -401,15 +397,15 @@ pascm_show_func (struct ui_file *file, int from_tty, if (gdbscm_is_exception (result)) { pascm_signal_setshow_error (result, - _("Error occurred showing parameter.")); + _ ("Error occurred showing parameter.")); } - gdb::unique_xmalloc_ptr<char> msg = gdbscm_scm_to_host_string (result, NULL, - &exception); + gdb::unique_xmalloc_ptr<char> msg + = gdbscm_scm_to_host_string (result, NULL, &exception); if (msg == NULL) { gdbscm_print_gdb_exception (SCM_BOOL_F, exception); - error (_("Error converting show text to host string.")); + error (_ ("Error converting show text to host string.")); } gdb_printf (file, "%s\n", msg.get ()); @@ -421,10 +417,9 @@ pascm_show_func (struct ui_file *file, int from_tty, static set_show_commands add_setshow_generic (enum var_types param_type, const literal_def *extra_literals, - enum command_class cmd_class, - char *cmd_name, param_smob *self, - char *set_doc, char *show_doc, char *help_doc, - cmd_func_ftype *set_func, + enum command_class cmd_class, char *cmd_name, + param_smob *self, char *set_doc, char *show_doc, + char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list) @@ -434,73 +429,72 @@ add_setshow_generic (enum var_types param_type, switch (param_type) { case var_boolean: - commands = add_setshow_boolean_cmd (cmd_name, cmd_class, - &self->value.boolval, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_boolean_cmd (cmd_name, cmd_class, &self->value.boolval, + set_doc, show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_auto_boolean: - commands = add_setshow_auto_boolean_cmd (cmd_name, cmd_class, - &self->value.autoboolval, - set_doc, show_doc, help_doc, - set_func, show_func, set_list, - show_list); + commands + = add_setshow_auto_boolean_cmd (cmd_name, cmd_class, + &self->value.autoboolval, set_doc, + show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_uinteger: - commands = add_setshow_uinteger_cmd (cmd_name, cmd_class, - &self->value.uintval, - extra_literals, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_uinteger_cmd (cmd_name, cmd_class, &self->value.uintval, + extra_literals, set_doc, show_doc, + help_doc, set_func, show_func, set_list, + show_list); break; case var_integer: - commands = add_setshow_integer_cmd (cmd_name, cmd_class, - &self->value.intval, - extra_literals, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_integer_cmd (cmd_name, cmd_class, &self->value.intval, + extra_literals, set_doc, show_doc, help_doc, + set_func, show_func, set_list, show_list); break; case var_pinteger: - commands = add_setshow_pinteger_cmd (cmd_name, cmd_class, - &self->value.intval, - extra_literals, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_pinteger_cmd (cmd_name, cmd_class, &self->value.intval, + extra_literals, set_doc, show_doc, + help_doc, set_func, show_func, set_list, + show_list); break; case var_string: - commands = add_setshow_string_cmd (cmd_name, cmd_class, - self->value.stringval, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_string_cmd (cmd_name, cmd_class, self->value.stringval, + set_doc, show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_string_noescape: - commands = add_setshow_string_noescape_cmd (cmd_name, cmd_class, - self->value.stringval, - set_doc, show_doc, help_doc, - set_func, show_func, set_list, - show_list); + commands + = add_setshow_string_noescape_cmd (cmd_name, cmd_class, + self->value.stringval, set_doc, + show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_optional_filename: - commands = add_setshow_optional_filename_cmd (cmd_name, cmd_class, - self->value.stringval, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list); + commands + = add_setshow_optional_filename_cmd (cmd_name, cmd_class, + self->value.stringval, set_doc, + show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_filename: - commands = add_setshow_filename_cmd (cmd_name, cmd_class, - self->value.stringval, set_doc, - show_doc, help_doc, set_func, - show_func, set_list, show_list); + commands + = add_setshow_filename_cmd (cmd_name, cmd_class, self->value.stringval, + set_doc, show_doc, help_doc, set_func, + show_func, set_list, show_list); break; case var_enum: @@ -529,21 +523,21 @@ add_setshow_generic (enum var_types param_type, Throws an exception if there's a problem with the values. Space for the result is allocated from the GC heap. */ -static const char * const * +static const char *const * compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name) { long i, size; char **enum_values; - const char * const *result; + const char *const *result; SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (enum_values_scm)), - enum_values_scm, arg_pos, func_name, _("list")); + enum_values_scm, arg_pos, func_name, _ ("list")); size = scm_ilength (enum_values_scm); if (size == 0) { gdbscm_out_of_range_error (FUNC_NAME, arg_pos, enum_values_scm, - _("enumeration list is empty")); + _ ("enumeration list is empty")); } enum_values = XCNEWVEC (char *, size + 1); @@ -557,10 +551,10 @@ compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name) if (!scm_is_string (value)) { freeargv (enum_values); - SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _("string")); + SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _ ("string")); } - enum_values[i] = gdbscm_scm_to_host_string (value, NULL, - &exception).release (); + enum_values[i] + = gdbscm_scm_to_host_string (value, NULL, &exception).release (); if (enum_values[i] == NULL) { freeargv (enum_values); @@ -576,22 +570,20 @@ compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name) return result; } -static const scheme_integer_constant parameter_types[] = -{ - { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */ - { "PARAM_AUTO_BOOLEAN", param_auto_boolean }, - { "PARAM_ZINTEGER", param_zinteger }, - { "PARAM_UINTEGER", param_uinteger }, - { "PARAM_ZUINTEGER", param_zuinteger }, - { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited }, - { "PARAM_STRING", param_string }, - { "PARAM_STRING_NOESCAPE", param_string_noescape }, - { "PARAM_OPTIONAL_FILENAME", param_optional_filename }, - { "PARAM_FILENAME", param_filename }, - { "PARAM_ENUM", param_enum }, - - END_INTEGER_CONSTANTS -}; +static const scheme_integer_constant parameter_types[] + = { { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */ + { "PARAM_AUTO_BOOLEAN", param_auto_boolean }, + { "PARAM_ZINTEGER", param_zinteger }, + { "PARAM_UINTEGER", param_uinteger }, + { "PARAM_ZUINTEGER", param_zuinteger }, + { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited }, + { "PARAM_STRING", param_string }, + { "PARAM_STRING_NOESCAPE", param_string_noescape }, + { "PARAM_OPTIONAL_FILENAME", param_optional_filename }, + { "PARAM_FILENAME", param_filename }, + { "PARAM_ENUM", param_enum }, + + END_INTEGER_CONSTANTS }; /* Return non-zero if PARAM_TYPE is a valid parameter type. */ @@ -675,15 +667,13 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name) case var_integer: case var_pinteger: { - LONGEST value - = (var.type () == var_uinteger - ? static_cast<LONGEST> (var.get<unsigned int> ()) - : static_cast<LONGEST> (var.get<int> ())); + LONGEST value = (var.type () == var_uinteger + ? static_cast<LONGEST> (var.get<unsigned int> ()) + : static_cast<LONGEST> (var.get<int> ())); if (var.extra_literals () != nullptr) for (const literal_def *l = var.extra_literals (); - l->literal != nullptr; - l++) + l->literal != nullptr; l++) if (value == l->use) return scm_from_latin1_keyword (l->literal); if (var.type () == var_pinteger) @@ -701,7 +691,7 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name) return gdbscm_make_out_of_range_error (func_name, arg_pos, scm_from_int (var.type ()), - _("program error: unhandled type")); + _ ("program error: unhandled type")); } /* Set the value of a parameter of type P_SMOB->TYPE in P_SMOB->VAR from VALUE. @@ -709,8 +699,7 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name) Throws a Scheme exception if VALUE_SCM is invalid for TYPE. */ static void -pascm_set_param_value_x (param_smob *p_smob, - const char * const *enumeration, +pascm_set_param_value_x (param_smob *p_smob, const char *const *enumeration, SCM value, int arg_pos, const char *func_name) { setting var = make_setting (p_smob); @@ -722,10 +711,10 @@ pascm_set_param_value_x (param_smob *p_smob, case var_optional_filename: case var_filename: SCM_ASSERT_TYPE (scm_is_string (value) - || (var.type () != var_filename - && gdbscm_is_false (value)), + || (var.type () != var_filename + && gdbscm_is_false (value)), value, arg_pos, func_name, - _("string or #f for non-PARAM_FILENAME parameters")); + _ ("string or #f for non-PARAM_FILENAME parameters")); if (gdbscm_is_false (value)) var.set<std::string> (""); else @@ -746,7 +735,7 @@ pascm_set_param_value_x (param_smob *p_smob, SCM exception; SCM_ASSERT_TYPE (scm_is_string (value), value, arg_pos, func_name, - _("string")); + _ ("string")); gdb::unique_xmalloc_ptr<char> str = gdbscm_scm_to_host_string (value, nullptr, &exception); if (str == nullptr) @@ -759,7 +748,7 @@ pascm_set_param_value_x (param_smob *p_smob, if (enumeration[i] == nullptr) { gdbscm_out_of_range_error (func_name, arg_pos, value, - _("not member of enumeration")); + _ ("not member of enumeration")); } var.set<const char *> (enumeration[i]); break; @@ -767,15 +756,14 @@ pascm_set_param_value_x (param_smob *p_smob, case var_boolean: SCM_ASSERT_TYPE (gdbscm_is_bool (value), value, arg_pos, func_name, - _("boolean")); + _ ("boolean")); var.set<bool> (gdbscm_is_true (value)); break; case var_auto_boolean: SCM_ASSERT_TYPE (gdbscm_is_bool (value) - || scm_is_eq (value, auto_keyword), - value, arg_pos, func_name, - _("boolean or #:auto")); + || scm_is_eq (value, auto_keyword), + value, arg_pos, func_name, _ ("boolean or #:auto")); if (scm_is_eq (value, auto_keyword)) var.set<enum auto_boolean> (AUTO_BOOLEAN_AUTO); else if (gdbscm_is_true (value)) @@ -798,17 +786,14 @@ pascm_set_param_value_x (param_smob *p_smob, LONGEST val; if (extra_literals != nullptr) - for (const literal_def *l = extra_literals; - l->literal != nullptr; + for (const literal_def *l = extra_literals; l->literal != nullptr; l++, count++) { if (count != 0) buffer += ", "; buffer = buffer + "#:" + l->literal; - if (keyword - && allowed == TRIBOOL_UNKNOWN - && scm_is_eq (value, - scm_from_latin1_keyword (l->literal))) + if (keyword && allowed == TRIBOOL_UNKNOWN + && scm_is_eq (value, scm_from_latin1_keyword (l->literal))) { val = l->use; allowed = TRIBOOL_TRUE; @@ -819,24 +804,24 @@ pascm_set_param_value_x (param_smob *p_smob, { if (extra_literals == nullptr) SCM_ASSERT_TYPE (integer, value, arg_pos, func_name, - _("integer")); + _ ("integer")); else if (count > 1) SCM_ASSERT_TYPE (integer, value, arg_pos, func_name, - string_printf (_("integer or one of: %s"), - buffer.c_str ()).c_str ()); + string_printf (_ ("integer or one of: %s"), + buffer.c_str ()) + .c_str ()); else - SCM_ASSERT_TYPE (integer, value, arg_pos, func_name, - string_printf (_("integer or %s"), - buffer.c_str ()).c_str ()); + SCM_ASSERT_TYPE ( + integer, value, arg_pos, func_name, + string_printf (_ ("integer or %s"), buffer.c_str ()).c_str ()); val = (var_type == var_uinteger - ? static_cast<LONGEST> (scm_to_uint (value)) - : static_cast<LONGEST> (scm_to_int (value))); + ? static_cast<LONGEST> (scm_to_uint (value)) + : static_cast<LONGEST> (scm_to_int (value))); if (extra_literals != nullptr) for (const literal_def *l = extra_literals; - l->literal != nullptr; - l++) + l->literal != nullptr; l++) { if (l->val.has_value () && val == *l->val) { @@ -847,7 +832,7 @@ pascm_set_param_value_x (param_smob *p_smob, else if (val == l->use) allowed = TRIBOOL_FALSE; } - } + } if (allowed == TRIBOOL_UNKNOWN) { @@ -860,7 +845,7 @@ pascm_set_param_value_x (param_smob *p_smob, } if (allowed == TRIBOOL_FALSE) gdbscm_out_of_range_error (func_name, arg_pos, value, - _("integer out of range")); + _ ("integer out of range")); if (var_type == var_uinteger) var.set<unsigned int> (static_cast<unsigned int> (val)); @@ -889,7 +874,7 @@ pascm_free_parameter_smob (SCM self) return 0; } - + /* Parameter Scheme functions. */ /* (make-parameter name @@ -932,12 +917,11 @@ pascm_free_parameter_smob (SCM self) static SCM gdbscm_make_parameter (SCM name_scm, SCM rest) { - const SCM keywords[] = { - command_class_keyword, parameter_type_keyword, enum_list_keyword, - set_func_keyword, show_func_keyword, - doc_keyword, set_doc_keyword, show_doc_keyword, - initial_value_keyword, SCM_BOOL_F - }; + const SCM keywords[] = { command_class_keyword, parameter_type_keyword, + enum_list_keyword, set_func_keyword, + show_func_keyword, doc_keyword, + set_doc_keyword, show_doc_keyword, + initial_value_keyword, SCM_BOOL_F }; int cmd_class_arg_pos = -1, param_type_arg_pos = -1; int enum_list_arg_pos = -1, set_func_arg_pos = -1, show_func_arg_pos = -1; int doc_arg_pos = -1, set_doc_arg_pos = -1, show_doc_arg_pos = -1; @@ -950,20 +934,17 @@ gdbscm_make_parameter (SCM name_scm, SCM rest) SCM set_func = SCM_BOOL_F, show_func = SCM_BOOL_F; char *doc = NULL, *set_doc = NULL, *show_doc = NULL; SCM initial_value_scm = SCM_BOOL_F; - const char * const *enum_list = NULL; + const char *const *enum_list = NULL; SCM p_scm; param_smob *p_smob; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iiOOOsssO", - name_scm, &name, rest, - &cmd_class_arg_pos, &cmd_class, - ¶m_type_arg_pos, ¶m_type, + name_scm, &name, rest, &cmd_class_arg_pos, + &cmd_class, ¶m_type_arg_pos, ¶m_type, &enum_list_arg_pos, &enum_list_scm, - &set_func_arg_pos, &set_func, - &show_func_arg_pos, &show_func, - &doc_arg_pos, &doc, - &set_doc_arg_pos, &set_doc, - &show_doc_arg_pos, &show_doc, + &set_func_arg_pos, &set_func, &show_func_arg_pos, + &show_func, &doc_arg_pos, &doc, &set_doc_arg_pos, + &set_doc, &show_doc_arg_pos, &show_doc, &initial_value_arg_pos, &initial_value_scm); /* If doc is NULL, leave it NULL. See add_setshow_cmd_full. */ @@ -992,40 +973,41 @@ gdbscm_make_parameter (SCM name_scm, SCM rest) { gdbscm_out_of_range_error (FUNC_NAME, cmd_class_arg_pos, scm_from_int (cmd_class), - _("invalid command class argument")); + _ ("invalid command class argument")); } if (!pascm_valid_parameter_type_p (param_type)) { gdbscm_out_of_range_error (FUNC_NAME, param_type_arg_pos, scm_from_int (param_type), - _("invalid parameter type argument")); + _ ("invalid parameter type argument")); } if (enum_list_arg_pos > 0 && param_type != param_enum) { - gdbscm_misc_error (FUNC_NAME, enum_list_arg_pos, enum_list_scm, - _("#:enum-values can only be provided with PARAM_ENUM")); + gdbscm_misc_error ( + FUNC_NAME, enum_list_arg_pos, enum_list_scm, + _ ("#:enum-values can only be provided with PARAM_ENUM")); } if (enum_list_arg_pos < 0 && param_type == param_enum) { gdbscm_misc_error (FUNC_NAME, GDBSCM_ARG_NONE, SCM_BOOL_F, - _("PARAM_ENUM requires an enum-values argument")); + _ ("PARAM_ENUM requires an enum-values argument")); } if (set_func_arg_pos > 0) { SCM_ASSERT_TYPE (gdbscm_is_procedure (set_func), set_func, - set_func_arg_pos, FUNC_NAME, _("procedure")); + set_func_arg_pos, FUNC_NAME, _ ("procedure")); } if (show_func_arg_pos > 0) { SCM_ASSERT_TYPE (gdbscm_is_procedure (show_func), show_func, - show_func_arg_pos, FUNC_NAME, _("procedure")); + show_func_arg_pos, FUNC_NAME, _ ("procedure")); } if (param_type == param_enum) { /* Note: enum_list lives in GC space, so we don't have to worry about freeing it if we later throw an exception. */ - enum_list = compute_enum_list (enum_list_scm, enum_list_arg_pos, - FUNC_NAME); + enum_list + = compute_enum_list (enum_list_scm, enum_list_arg_pos, FUNC_NAME); } /* If initial-value is a function, we need the parameter object constructed @@ -1056,13 +1038,13 @@ gdbscm_make_parameter (SCM name_scm, SCM rest) { if (gdbscm_is_procedure (initial_value_scm)) { - initial_value_scm = gdbscm_safe_call_1 (initial_value_scm, - p_smob->containing_scm, NULL); + initial_value_scm + = gdbscm_safe_call_1 (initial_value_scm, p_smob->containing_scm, + NULL); if (gdbscm_is_exception (initial_value_scm)) gdbscm_throw (initial_value_scm); } - pascm_set_param_value_x (p_smob, enum_list, - initial_value_scm, + pascm_set_param_value_x (p_smob, enum_list, initial_value_scm, initial_value_arg_pos, FUNC_NAME); } @@ -1096,7 +1078,7 @@ gdbscm_register_parameter_x (SCM self) struct cmd_list_element **set_list, **show_list; if (pascm_is_valid (p_smob)) - scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL); + scm_misc_error (FUNC_NAME, _ ("parameter is already registered"), SCM_EOL); cmd_name = gdbscm_parse_command_name (p_smob->name, FUNC_NAME, SCM_ARG1, &set_list, &setlist); @@ -1108,25 +1090,27 @@ gdbscm_register_parameter_x (SCM self) if (pascm_parameter_defined_p (p_smob->cmd_name, *set_list)) { - gdbscm_misc_error (FUNC_NAME, SCM_ARG1, self, - _("parameter exists, \"set\" command is already defined")); + gdbscm_misc_error ( + FUNC_NAME, SCM_ARG1, self, + _ ("parameter exists, \"set\" command is already defined")); } if (pascm_parameter_defined_p (p_smob->cmd_name, *show_list)) { - gdbscm_misc_error (FUNC_NAME, SCM_ARG1, self, - _("parameter exists, \"show\" command is already defined")); + gdbscm_misc_error ( + FUNC_NAME, SCM_ARG1, self, + _ ("parameter exists, \"show\" command is already defined")); } gdbscm_gdb_exception exc {}; try { - p_smob->commands = add_setshow_generic - (p_smob->type, p_smob->extra_literals, - p_smob->cmd_class, p_smob->cmd_name, p_smob, - p_smob->set_doc, p_smob->show_doc, p_smob->doc, - (gdbscm_is_procedure (p_smob->set_func) ? pascm_set_func : NULL), - (gdbscm_is_procedure (p_smob->show_func) ? pascm_show_func : NULL), - set_list, show_list); + p_smob->commands = add_setshow_generic ( + p_smob->type, p_smob->extra_literals, p_smob->cmd_class, + p_smob->cmd_name, p_smob, p_smob->set_doc, p_smob->show_doc, + p_smob->doc, + (gdbscm_is_procedure (p_smob->set_func) ? pascm_set_func : NULL), + (gdbscm_is_procedure (p_smob->show_func) ? pascm_show_func : NULL), + set_list, show_list); } catch (const gdb_exception &except) { @@ -1150,13 +1134,13 @@ gdbscm_register_parameter_x (SCM self) static SCM gdbscm_parameter_value (SCM self) { - SCM_ASSERT_TYPE (pascm_is_parameter (self) || scm_is_string (self), - self, SCM_ARG1, FUNC_NAME, _("<gdb:parameter> or string")); + SCM_ASSERT_TYPE (pascm_is_parameter (self) || scm_is_string (self), self, + SCM_ARG1, FUNC_NAME, _ ("<gdb:parameter> or string")); if (pascm_is_parameter (self)) { - param_smob *p_smob = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, - FUNC_NAME); + param_smob *p_smob + = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); return pascm_param_value (make_setting (p_smob), SCM_ARG1, FUNC_NAME); } @@ -1187,13 +1171,13 @@ gdbscm_parameter_value (SCM self) if (!found) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _("parameter not found")); + _ ("parameter not found")); } if (!cmd->var.has_value ()) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _("not a parameter")); + _ ("not a parameter")); } return pascm_param_value (*cmd->var, SCM_ARG1, FUNC_NAME); @@ -1205,21 +1189,19 @@ gdbscm_parameter_value (SCM self) static SCM gdbscm_set_parameter_value_x (SCM self, SCM value) { - param_smob *p_smob = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, - FUNC_NAME); + param_smob *p_smob + = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - pascm_set_param_value_x (p_smob, p_smob->enumeration, - value, SCM_ARG2, FUNC_NAME); + pascm_set_param_value_x (p_smob, p_smob->enumeration, value, SCM_ARG2, + FUNC_NAME); return SCM_UNSPECIFIED; } - + /* Initialize the Scheme parameter support. */ -static const scheme_function parameter_functions[] = -{ - { "make-parameter", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_parameter), - "\ +static const scheme_function parameter_functions[] + = { { "make-parameter", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_parameter), "\ Make a GDB parameter object.\n\ \n\ Arguments: name\n\ @@ -1250,29 +1232,25 @@ Make a GDB parameter object.\n\ show-doc: The \"doc string\" when showing the parameter.\n\ initial-value: The initial value of the parameter." }, - { "register-parameter!", 1, 0, 0, - as_a_scm_t_subr (gdbscm_register_parameter_x), - "\ + { "register-parameter!", 1, 0, 0, + as_a_scm_t_subr (gdbscm_register_parameter_x), "\ Register a <gdb:parameter> object with GDB." }, - { "parameter?", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_p), - "\ + { "parameter?", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_p), "\ Return #t if the object is a <gdb:parameter> object." }, - { "parameter-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_value), - "\ + { "parameter-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_value), + "\ Return the value of a <gdb:parameter> object\n\ or any gdb parameter if param is a string naming the parameter." }, - { "set-parameter-value!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_parameter_value_x), - "\ + { "set-parameter-value!", 2, 0, 0, + as_a_scm_t_subr (gdbscm_set_parameter_value_x), "\ Set the value of a <gdb:parameter> object.\n\ \n\ Arguments: <gdb:parameter> value" }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_parameters (void) diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c index 48b6075..94f7226 100644 --- a/gdb/guile/scm-ports.c +++ b/gdb/guile/scm-ports.c @@ -29,24 +29,24 @@ #include "gdbsupport/gdb_optional.h" #ifdef HAVE_POLL -#if defined (HAVE_POLL_H) +#if defined(HAVE_POLL_H) #include <poll.h> -#elif defined (HAVE_SYS_POLL_H) +#elif defined(HAVE_SYS_POLL_H) #include <sys/poll.h> #endif #endif /* Whether we're using Guile < 2.2 and its clumsy port API. */ -#define USING_GUILE_BEFORE_2_2 \ +#define USING_GUILE_BEFORE_2_2 \ (SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 0) - /* A ui-file for sending output to Guile. */ class ioscm_file_port : public ui_file { public: + /* Return a ui_file that writes to PORT. */ explicit ioscm_file_port (SCM port); @@ -54,6 +54,7 @@ public: void write (const char *buf, long length_buf) override; private: + SCM m_port; }; @@ -111,7 +112,11 @@ static SCM output_port_scm; static SCM error_port_scm; /* Internal enum for specifying output port. */ -enum oport { GDB_STDOUT, GDB_STDERR }; +enum oport +{ + GDB_STDOUT, + GDB_STDERR +}; /* This is the memory port descriptor, scm_ptob_descriptor. */ #if USING_GUILE_BEFORE_2_2 @@ -152,7 +157,7 @@ static const unsigned natural_buf_size = 16; static SCM mode_keyword; static SCM start_keyword; static SCM size_keyword; - + /* Helper to do the low level work of opening a port. */ #if USING_GUILE_BEFORE_2_2 @@ -188,7 +193,6 @@ ioscm_open_port (scm_t_port_type *port_type, long mode_bits, scm_t_bits stream) #endif - /* Support for connecting Guile's stdio ports to GDB's stdio ports. */ /* Print a string S, length SIZE, but don't escape characters, except @@ -218,7 +222,7 @@ ioscm_input_waiting (SCM port) { int fdes = 0; - if (! scm_is_eq (port, input_port_scm)) + if (!scm_is_eq (port, input_port_scm)) return 0; #ifdef HAVE_POLL @@ -262,9 +266,8 @@ ioscm_input_waiting (SCM port) FD_ZERO (&input_fds); FD_SET (fdes, &input_fds); - num_found = interruptible_select (num_fds, - &input_fds, NULL, NULL, - &timeout); + num_found + = interruptible_select (num_fds, &input_fds, NULL, NULL, &timeout); if (num_found < 0) { /* Guile doesn't export SIGINT hooks like Python does. @@ -285,7 +288,7 @@ ioscm_fill_input (SCM port) scm_t_port *pt = SCM_PTAB_ENTRY (port); /* If we're called on stdout,stderr, punt. */ - if (! scm_is_eq (port, input_port_scm)) + if (!scm_is_eq (port, input_port_scm)) return (scm_t_wchar) EOF; /* Set errno and return -1? */ gdb_flush (gdb_stdout); @@ -307,7 +310,6 @@ ioscm_fill_input (SCM port) static void ioscm_write (SCM port, const void *data, size_t size) { - /* If we're called on stdin, punt. */ if (scm_is_eq (port, input_port_scm)) return; @@ -354,7 +356,7 @@ ioscm_read_from_port (SCM port, SCM dst, size_t start, size_t count) char *read_buf; /* If we're called on stdout,stderr, punt. */ - if (! scm_is_eq (port, input_port_scm)) + if (!scm_is_eq (port, input_port_scm)) return 0; gdb_flush (gdb_stdout); @@ -534,7 +536,7 @@ gdbscm_stdio_port_p (SCM scm) && (SCM_PORT_TYPE (scm) == stdio_port_desc)); #endif } - + /* GDB's ports are accessed via functions to keep them read-only. */ /* (input-port) -> port */ @@ -560,12 +562,13 @@ gdbscm_error_port (void) { return error_port_scm; } - + /* Support for sending GDB I/O to Guile ports. */ ioscm_file_port::ioscm_file_port (SCM port) : m_port (port) -{} +{ +} void ioscm_file_port::flush () @@ -578,7 +581,6 @@ ioscm_file_port::write (const char *buffer, long length_buffer) scm_c_write (m_port, buffer, length_buffer); } - /* Helper routine for with-{output,error}-to-port. */ static SCM @@ -587,10 +589,10 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport, { SCM result; - SCM_ASSERT_TYPE (gdbscm_is_true (scm_output_port_p (port)), port, - SCM_ARG1, func_name, _("output port")); - SCM_ASSERT_TYPE (gdbscm_is_true (scm_thunk_p (thunk)), thunk, - SCM_ARG2, func_name, _("thunk")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_output_port_p (port)), port, SCM_ARG1, + func_name, _ ("output port")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_thunk_p (thunk)), thunk, SCM_ARG2, + func_name, _ ("thunk")); set_batch_flag_and_restore_page_info save_page_info; @@ -598,8 +600,8 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport, ui_file_up port_file (new ioscm_file_port (port)); - scoped_restore save_file = make_scoped_restore (oport == GDB_STDERR - ? &gdb_stderr : &gdb_stdout); + scoped_restore save_file + = make_scoped_restore (oport == GDB_STDERR ? &gdb_stderr : &gdb_stdout); { gdb::optional<ui_out_redirect_pop> redirect_popper; @@ -650,7 +652,7 @@ gdbscm_percent_with_gdb_error_to_port (SCM port, SCM thunk) { return ioscm_with_output_to_port_worker (port, thunk, GDB_STDERR, FUNC_NAME); } - + /* Support for r/w memory via ports. */ /* Perform an "lseek" to OFFSET,WHENCE on memory port IOMEM. @@ -715,9 +717,9 @@ gdbscm_memory_port_fill_input (SCM port) if (to_read > iomem->size - iomem->current) to_read = iomem->size - iomem->current; - if (target_read_memory (iomem->start + iomem->current, pt->read_buf, - to_read) != 0) - gdbscm_memory_error (FUNC_NAME, _("error reading memory"), SCM_EOL); + if (target_read_memory (iomem->start + iomem->current, pt->read_buf, to_read) + != 0) + gdbscm_memory_error (FUNC_NAME, _ ("error reading memory"), SCM_EOL); iomem->current += to_read; pt->read_pos = pt->read_buf; @@ -740,7 +742,7 @@ gdbscm_memory_port_end_input (SCM port, int offset) || (offset > 0 && remaining + offset < remaining)) { gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset), - _("overflow in offset calculation")); + _ ("overflow in offset calculation")); } offset += remaining; @@ -752,7 +754,7 @@ gdbscm_memory_port_end_input (SCM port, int offset) if (!ioscm_lseek_address (iomem, -offset, SEEK_CUR)) { gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset), - _("bad offset")); + _ ("bad offset")); } } @@ -777,12 +779,13 @@ gdbscm_memory_port_flush (SCM port) { gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_ulongest (to_write), - _("writing beyond end of memory range")); + _ ("writing beyond end of memory range")); } if (target_write_memory (iomem->start + iomem->current, pt->write_buf, - to_write) != 0) - gdbscm_memory_error (FUNC_NAME, _("error writing memory"), SCM_EOL); + to_write) + != 0) + gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL); iomem->current += to_write; pt->write_pos = pt->write_buf; @@ -815,8 +818,7 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence) CORE_ADDR current = iomem->current; size_t delta = pt->write_pos - pt->write_buf; - if (current + delta < current - || current + delta > iomem->size) + if (current + delta < current || current + delta > iomem->size) rc = 0; else { @@ -871,7 +873,7 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence) { gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_longest (offset), - _("bad seek")); + _ ("bad seek")); } /* TODO: The Guile API doesn't support 32x64. We can't fix that here, @@ -895,14 +897,14 @@ gdbscm_memory_port_write (SCM port, const void *void_data, size_t size) if (size > iomem->size - iomem->current) { gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_ulongest (size), - _("writing beyond end of memory range")); + _ ("writing beyond end of memory range")); } if (pt->write_buf == &pt->shortbuf) { /* Unbuffered port. */ if (target_write_memory (iomem->start + iomem->current, data, size) != 0) - gdbscm_memory_error (FUNC_NAME, _("error writing memory"), SCM_EOL); + gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL); iomem->current += size; return; } @@ -933,8 +935,9 @@ gdbscm_memory_port_write (SCM port, const void *void_data, size_t size) if (remaining >= pt->write_buf_size) { if (target_write_memory (iomem->start + iomem->current, ptr, - remaining) != 0) - gdbscm_memory_error (FUNC_NAME, _("error writing memory"), + remaining) + != 0) + gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL); iomem->current += remaining; } @@ -1002,23 +1005,21 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size, if (pt->read_buf == &pt->shortbuf) { gdb_assert (pt->write_buf == &pt->shortbuf); - scm_misc_error (func_name, _("port is unbuffered: ~a"), + scm_misc_error (func_name, _ ("port is unbuffered: ~a"), scm_list_1 (port)); } /* Next check if anything is buffered. */ - if (read_buf_size != pt->read_buf_size - && pt->read_end != pt->read_buf) + if (read_buf_size != pt->read_buf_size && pt->read_end != pt->read_buf) { - scm_misc_error (func_name, _("read buffer not empty: ~a"), + scm_misc_error (func_name, _ ("read buffer not empty: ~a"), scm_list_1 (port)); } - if (write_buf_size != pt->write_buf_size - && pt->write_pos != pt->write_buf) + if (write_buf_size != pt->write_buf_size && pt->write_pos != pt->write_buf) { - scm_misc_error (func_name, _("write buffer not empty: ~a"), + scm_misc_error (func_name, _ ("write buffer not empty: ~a"), scm_list_1 (port)); } @@ -1080,9 +1081,8 @@ gdbscm_memory_port_read (SCM port, SCM dst, size_t start, size_t count) count = iomem->size - iomem->current; read_buf = (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (dst) + start; - if (target_read_memory (iomem->start + iomem->current, read_buf, - count) != 0) - gdbscm_memory_error (FUNC_NAME, _("error reading memory"), SCM_EOL); + if (target_read_memory (iomem->start + iomem->current, read_buf, count) != 0) + gdbscm_memory_error (FUNC_NAME, _ ("error reading memory"), SCM_EOL); iomem->current += count; return count; @@ -1092,19 +1092,17 @@ static size_t gdbscm_memory_port_write (SCM port, SCM src, size_t start, size_t count) { ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (port); - const gdb_byte *data = - (const gdb_byte *) SCM_BYTEVECTOR_CONTENTS (src) + start; + const gdb_byte *data + = (const gdb_byte *) SCM_BYTEVECTOR_CONTENTS (src) + start; /* If the request goes past the end of the port's memory range, flag an error. */ if (count > iomem->size - iomem->current) gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_size_t (count), - _("writing beyond end of memory range")); + _ ("writing beyond end of memory range")); - if (target_write_memory (iomem->start + iomem->current, data, - count) != 0) - gdbscm_memory_error (FUNC_NAME, _("error writing memory"), - SCM_EOL); + if (target_write_memory (iomem->start + iomem->current, data, count) != 0) + gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL); iomem->current += count; @@ -1119,9 +1117,8 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence) rc = ioscm_lseek_address (iomem, offset, whence); if (rc == 0) - gdbscm_out_of_range_error (FUNC_NAME, 0, - gdbscm_scm_from_longest (offset), - _("bad seek")); + gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_longest (offset), + _ ("bad seek")); /* TODO: The Guile API doesn't support 32x64. We can't fix that here, and there's no need to throw an error if the new address can't be @@ -1193,9 +1190,8 @@ ioscm_parse_mode_bits (const char *func_name, const char *mode) if (*mode != 'r' && *mode != 'w') { - gdbscm_out_of_range_error (func_name, 0, - gdbscm_scm_from_c_string (mode), - _("bad mode string")); + gdbscm_out_of_range_error (func_name, 0, gdbscm_scm_from_c_string (mode), + _ ("bad mode string")); } for (p = mode + 1; *p != '\0'; ++p) { @@ -1208,7 +1204,7 @@ ioscm_parse_mode_bits (const char *func_name, const char *mode) default: gdbscm_out_of_range_error (func_name, 0, gdbscm_scm_from_c_string (mode), - _("bad mode string")); + _ ("bad mode string")); } } @@ -1314,9 +1310,8 @@ ioscm_init_memory_port_buffers (SCM port) static SCM gdbscm_open_memory (SCM rest) { - const SCM keywords[] = { - mode_keyword, start_keyword, size_keyword, SCM_BOOL_F - }; + const SCM keywords[] + = { mode_keyword, start_keyword, size_keyword, SCM_BOOL_F }; char *mode = NULL; CORE_ADDR start = 0; CORE_ADDR end; @@ -1326,8 +1321,7 @@ gdbscm_open_memory (SCM rest) long mode_bits; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "#sUU", rest, - &mode_arg_pos, &mode, - &start_arg_pos, &start, + &mode_arg_pos, &mode, &start_arg_pos, &start, &size_arg_pos, &size); scm_dynwind_begin ((scm_t_dynwind_flags) 0); @@ -1342,10 +1336,11 @@ gdbscm_open_memory (SCM rest) a nuisance we can relax things later. */ if (start + size < start) { - gdbscm_out_of_range_error (FUNC_NAME, 0, - scm_list_2 (gdbscm_scm_from_ulongest (start), - gdbscm_scm_from_ulongest (size)), - _("start+size overflows")); + gdbscm_out_of_range_error ( + FUNC_NAME, 0, + scm_list_2 (gdbscm_scm_from_ulongest (start), + gdbscm_scm_from_ulongest (size)), + _ ("start+size overflows")); } end = start + size; } @@ -1361,8 +1356,7 @@ gdbscm_open_memory (SCM rest) mode_bits |= SCM_BUF0; auto stream = ioscm_init_memory_port_stream (start, end); - port = ioscm_open_port (memory_port_desc, mode_bits, - (scm_t_bits) stream); + port = ioscm_open_port (memory_port_desc, mode_bits, (scm_t_bits) stream); #if USING_GUILE_BEFORE_2_2 ioscm_init_memory_port_buffers (port); @@ -1440,7 +1434,7 @@ gdbscm_set_memory_port_read_buffer_size_x (SCM port, SCM size) SCM_ASSERT_TYPE (gdbscm_is_memory_port (port), port, SCM_ARG1, FUNC_NAME, memory_port_desc_name); SCM_ASSERT_TYPE (scm_is_integer (size), size, SCM_ARG2, FUNC_NAME, - _("integer")); + _ ("integer")); if (!scm_is_unsigned_integer (size, min_memory_port_buf_size, max_memory_port_buf_size)) @@ -1490,7 +1484,7 @@ gdbscm_set_memory_port_write_buffer_size_x (SCM port, SCM size) SCM_ASSERT_TYPE (gdbscm_is_memory_port (port), port, SCM_ARG1, FUNC_NAME, memory_port_desc_name); SCM_ASSERT_TYPE (scm_is_integer (size), size, SCM_ARG2, FUNC_NAME, - _("integer")); + _ ("integer")); if (!scm_is_unsigned_integer (size, min_memory_port_buf_size, max_memory_port_buf_size)) @@ -1508,73 +1502,60 @@ gdbscm_set_memory_port_write_buffer_size_x (SCM port, SCM size) return scm_setvbuf (port, scm_from_utf8_symbol ("block"), size); #endif } - + /* Initialize gdb ports. */ -static const scheme_function port_functions[] = -{ - { "input-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_input_port), - "\ +static const scheme_function port_functions[] + = { { "input-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_input_port), "\ Return gdb's input port." }, - { "output-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_output_port), - "\ + { "output-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_output_port), "\ Return gdb's output port." }, - { "error-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_error_port), - "\ + { "error-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_error_port), "\ Return gdb's error port." }, - { "stdio-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_stdio_port_p), - "\ + { "stdio-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_stdio_port_p), "\ Return #t if the object is a gdb:stdio-port." }, - { "open-memory", 0, 0, 1, as_a_scm_t_subr (gdbscm_open_memory), - "\ + { "open-memory", 0, 0, 1, as_a_scm_t_subr (gdbscm_open_memory), "\ Return a port that can be used for reading/writing inferior memory.\n\ \n\ Arguments: [#:mode string] [#:start address] [#:size integer]\n\ Returns: A port object." }, - { "memory-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_p), - "\ + { "memory-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_p), "\ Return #t if the object is a memory port." }, - { "memory-port-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_range), - "\ + { "memory-port-range", 1, 0, 0, + as_a_scm_t_subr (gdbscm_memory_port_range), "\ Return the memory range of the port as (start end)." }, - { "memory-port-read-buffer-size", 1, 0, 0, - as_a_scm_t_subr (gdbscm_memory_port_read_buffer_size), - "\ + { "memory-port-read-buffer-size", 1, 0, 0, + as_a_scm_t_subr (gdbscm_memory_port_read_buffer_size), "\ Return the size of the read buffer for the memory port." }, - { "set-memory-port-read-buffer-size!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_memory_port_read_buffer_size_x), - "\ + { "set-memory-port-read-buffer-size!", 2, 0, 0, + as_a_scm_t_subr (gdbscm_set_memory_port_read_buffer_size_x), "\ Set the size of the read buffer for the memory port.\n\ \n\ Arguments: port integer\n\ Returns: unspecified." }, - { "memory-port-write-buffer-size", 1, 0, 0, - as_a_scm_t_subr (gdbscm_memory_port_write_buffer_size), - "\ + { "memory-port-write-buffer-size", 1, 0, 0, + as_a_scm_t_subr (gdbscm_memory_port_write_buffer_size), "\ Return the size of the write buffer for the memory port." }, - { "set-memory-port-write-buffer-size!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_memory_port_write_buffer_size_x), - "\ + { "set-memory-port-write-buffer-size!", 2, 0, 0, + as_a_scm_t_subr (gdbscm_set_memory_port_write_buffer_size_x), "\ Set the size of the write buffer for the memory port.\n\ \n\ Arguments: port integer\n\ Returns: unspecified." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; -static const scheme_function private_port_functions[] = -{ +static const scheme_function private_port_functions[] = { #if 0 /* TODO */ { "%with-gdb-input-from-port", 2, 0, 0, as_a_scm_t_subr (gdbscm_percent_with_gdb_input_from_port), @@ -1588,8 +1569,7 @@ This procedure is experimental." }, #endif { "%with-gdb-output-to-port", 2, 0, 0, - as_a_scm_t_subr (gdbscm_percent_with_gdb_output_to_port), - "\ + as_a_scm_t_subr (gdbscm_percent_with_gdb_output_to_port), "\ Temporarily set GDB's output port to PORT and then invoke THUNK.\n\ \n\ Arguments: port thunk\n\ @@ -1598,8 +1578,7 @@ Temporarily set GDB's output port to PORT and then invoke THUNK.\n\ This procedure is experimental." }, { "%with-gdb-error-to-port", 2, 0, 0, - as_a_scm_t_subr (gdbscm_percent_with_gdb_error_to_port), - "\ + as_a_scm_t_subr (gdbscm_percent_with_gdb_error_to_port), "\ Temporarily set GDB's error port to PORT and then invoke THUNK.\n\ \n\ Arguments: port thunk\n\ @@ -1644,8 +1623,8 @@ gdbscm_initialize_ports (void) #if USING_GUILE_BEFORE_2_2 /* Error message text for "out of range" memory port buffer sizes. */ - out_of_range_buf_size = xstrprintf ("size not between %u - %u", - min_memory_port_buf_size, - max_memory_port_buf_size); + out_of_range_buf_size + = xstrprintf ("size not between %u - %u", min_memory_port_buf_size, + max_memory_port_buf_size); #endif } diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index cb6677c..a96591c 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -73,7 +73,7 @@ struct pretty_printer_smob /* A procedure called to look up the printer for the given value. The procedure is called as (lookup gdb:pretty-printer value). The result should either be a gdb:pretty-printer object that will print - the value, or #f if the value is not recognized. */ + the value, or #f if the value is not recognized. */ SCM lookup; /* Note: Attaching subprinters to this smob is left to Scheme. */ @@ -101,10 +101,9 @@ struct pretty_printer_worker_smob SCM children; }; -static const char pretty_printer_smob_name[] = - "gdb:pretty-printer"; -static const char pretty_printer_worker_smob_name[] = - "gdb:pretty-printer-worker"; +static const char pretty_printer_smob_name[] = "gdb:pretty-printer"; +static const char pretty_printer_worker_smob_name[] + = "gdb:pretty-printer-worker"; /* The tag Guile knows the pretty-printer smobs by. */ static scm_t_bits pretty_printer_smob_tag; @@ -120,7 +119,7 @@ static SCM pp_type_error_symbol; static SCM ppscm_map_string; static SCM ppscm_array_string; static SCM ppscm_string_string; - + /* Administrivia for pretty-printer matcher smobs. */ /* The smob "print" function for <gdb:pretty-printer>. */ @@ -147,15 +146,15 @@ ppscm_print_pretty_printer_smob (SCM self, SCM port, scm_print_state *pstate) static SCM gdbscm_make_pretty_printer (SCM name, SCM lookup) { - pretty_printer_smob *pp_smob = (pretty_printer_smob *) - scm_gc_malloc (sizeof (pretty_printer_smob), - pretty_printer_smob_name); + pretty_printer_smob *pp_smob + = (pretty_printer_smob *) scm_gc_malloc (sizeof (pretty_printer_smob), + pretty_printer_smob_name); SCM smob; SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, FUNC_NAME, - _("string")); + _ ("string")); SCM_ASSERT_TYPE (gdbscm_is_procedure (lookup), lookup, SCM_ARG2, FUNC_NAME, - _("procedure")); + _ ("procedure")); pp_smob->name = name; pp_smob->lookup = lookup; @@ -208,7 +207,7 @@ ppscm_get_pretty_printer_smob_arg_unsafe (SCM self, int arg_pos, return pp_smob; } - + /* Pretty-printer methods. */ /* (pretty-printer-enabled? <gdb:pretty-printer>) -> boolean */ @@ -251,14 +250,14 @@ gdbscm_pretty_printers (void) static SCM gdbscm_set_pretty_printers_x (SCM printers) { - SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, - SCM_ARG1, FUNC_NAME, _("list")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG1, + FUNC_NAME, _ ("list")); pretty_printer_list = printers; return SCM_UNSPECIFIED; } - + /* Administrivia for pretty-printer-worker smobs. These are created when a matcher recognizes a value. */ @@ -320,7 +319,7 @@ gdbscm_pretty_printer_worker_p (SCM scm) { return scm_from_bool (ppscm_is_pretty_printer_worker (scm)); } - + /* Helper function to create a <gdb:exception> object indicating that the type of some value returned from a pretty-printer is invalid. */ @@ -328,9 +327,9 @@ static SCM ppscm_make_pp_type_error_exception (const char *message, SCM object) { std::string msg = string_printf ("%s: ~S", message); - return gdbscm_make_error (pp_type_error_symbol, - NULL /* func */, msg.c_str (), - scm_list_1 (object), scm_list_1 (object)); + return gdbscm_make_error (pp_type_error_symbol, NULL /* func */, + msg.c_str (), scm_list_1 (object), + scm_list_1 (object)); } /* Print MESSAGE as an exception (meaning it is controlled by @@ -366,11 +365,11 @@ ppscm_search_pp_list (SCM list, SCM value) return SCM_BOOL_F; if (gdbscm_is_false (scm_list_p (list))) /* scm_is_pair? */ { - return ppscm_make_pp_type_error_exception - (_("pretty-printer list is not a list"), list); + return ppscm_make_pp_type_error_exception ( + _ ("pretty-printer list is not a list"), list); } - for ( ; scm_is_pair (list); list = scm_cdr (list)) + for (; scm_is_pair (list); list = scm_cdr (list)) { SCM matcher = scm_car (list); SCM worker; @@ -378,9 +377,9 @@ ppscm_search_pp_list (SCM list, SCM value) if (!ppscm_is_pretty_printer (matcher)) { - return ppscm_make_pp_type_error_exception - (_("pretty-printer list contains non-pretty-printer object"), - matcher); + return ppscm_make_pp_type_error_exception ( + _ ("pretty-printer list contains non-pretty-printer object"), + matcher); } pp_smob = (pretty_printer_smob *) SCM_SMOB_DATA (matcher); @@ -391,28 +390,28 @@ ppscm_search_pp_list (SCM list, SCM value) if (!gdbscm_is_procedure (pp_smob->lookup)) { - return ppscm_make_pp_type_error_exception - (_("invalid lookup object in pretty-printer matcher"), - pp_smob->lookup); + return ppscm_make_pp_type_error_exception ( + _ ("invalid lookup object in pretty-printer matcher"), + pp_smob->lookup); } - worker = gdbscm_safe_call_2 (pp_smob->lookup, matcher, - value, gdbscm_memory_error_p); + worker = gdbscm_safe_call_2 (pp_smob->lookup, matcher, value, + gdbscm_memory_error_p); if (!gdbscm_is_false (worker)) { if (gdbscm_is_exception (worker)) return worker; if (ppscm_is_pretty_printer_worker (worker)) return worker; - return ppscm_make_pp_type_error_exception - (_("invalid result from pretty-printer lookup"), worker); + return ppscm_make_pp_type_error_exception ( + _ ("invalid result from pretty-printer lookup"), worker); } } if (!scm_is_null (list)) { - return ppscm_make_pp_type_error_exception - (_("pretty-printer list is not a list"), orig_list); + return ppscm_make_pp_type_error_exception ( + _ ("pretty-printer list is not a list"), orig_list); } return SCM_BOOL_F; @@ -533,8 +532,7 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value, gdbscm_memory_error_p); if (gdbscm_is_false (result)) ; /* Done. */ - else if (scm_is_string (result) - || lsscm_is_lazy_string (result)) + else if (scm_is_string (result) || lsscm_is_lazy_string (result)) ; /* Done. */ else if (vlscm_is_value (result)) { @@ -542,8 +540,8 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value, *out_value = vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE, - result, &except_scm, - gdbarch, language); + result, &except_scm, gdbarch, + language); if (*out_value != NULL) result = SCM_BOOL_T; else @@ -554,8 +552,8 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value, else { /* Invalid result from to-string. */ - result = ppscm_make_pp_type_error_exception - (_("invalid result from pretty-printer to-string"), result); + result = ppscm_make_pp_type_error_exception ( + _ ("invalid result from pretty-printer to-string"), result); } } catch (const gdb_exception &except) @@ -568,7 +566,7 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value, /* Return the display hint for PRINTER as a Scheme object. The caller is responsible for ensuring PRINTER is a <gdb:pretty-printer-worker> object. */ - + static SCM ppscm_get_display_hint_scm (SCM printer) { @@ -617,7 +615,7 @@ ppscm_print_exception_unless_memory_error (SCM exception, /* This "shouldn't happen", but play it safe. */ if (msg == NULL || msg.get ()[0] == '\0') - gdb_printf (stream, _("<error reading variable>")); + gdb_printf (stream, _ ("<error reading variable>")); else { /* Remove the trailing newline. We could instead call a special @@ -628,7 +626,7 @@ ppscm_print_exception_unless_memory_error (SCM exception, if (msg_text[len - 1] == '\n') msg_text[len - 1] = '\0'; - gdb_printf (stream, _("<error reading variable: %s>"), msg_text); + gdb_printf (stream, _ ("<error reading variable: %s>"), msg_text); } } else @@ -649,8 +647,8 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint, SCM str_scm; enum guile_string_repr_result result = STRING_REPR_ERROR; - str_scm = ppscm_pretty_print_one_value (printer, &replacement, - gdbarch, language); + str_scm + = ppscm_pretty_print_one_value (printer, &replacement, gdbarch, language); if (gdbscm_is_false (str_scm)) { result = STRING_REPR_NONE; @@ -668,15 +666,15 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint, { size_t length; gdb::unique_xmalloc_ptr<char> string - = gdbscm_scm_to_string (str_scm, &length, - target_charset (gdbarch), 0 /*!strict*/, NULL); + = gdbscm_scm_to_string (str_scm, &length, target_charset (gdbarch), + 0 /*!strict*/, NULL); if (hint == HINT_STRING) { struct type *type = builtin_type (gdbarch)->builtin_char; - - language->printstr (stream, type, (gdb_byte *) string.get (), - length, NULL, 0, options); + + language->printstr (stream, type, (gdb_byte *) string.get (), length, + NULL, 0, options); } else { @@ -737,9 +735,9 @@ ppscm_print_children (SCM printer, enum display_hint hint, return; if (!gdbscm_is_procedure (w_smob->children)) { - ppscm_print_pp_type_error - (_("pretty-printer \"children\" object is not a procedure or #f"), - w_smob->children); + ppscm_print_pp_type_error ( + _ ("pretty-printer \"children\" object is not a procedure or #f"), + w_smob->children); return; } @@ -747,8 +745,8 @@ ppscm_print_children (SCM printer, enum display_hint hint, is_map = hint == HINT_MAP; is_array = hint == HINT_ARRAY; - children = gdbscm_safe_call_1 (w_smob->children, printer, - gdbscm_memory_error_p); + children + = gdbscm_safe_call_1 (w_smob->children, printer, gdbscm_memory_error_p); if (gdbscm_is_exception (children)) { ppscm_print_exception_unless_memory_error (children, stream); @@ -760,9 +758,10 @@ ppscm_print_children (SCM printer, enum display_hint hint, children iterated over. */ if (!itscm_is_iterator (children)) { - ppscm_print_pp_type_error - (_("result of pretty-printer \"children\" procedure is not" - " a <gdb:iterator> object"), children); + ppscm_print_pp_type_error ( + _ ("result of pretty-printer \"children\" procedure is not" + " a <gdb:iterator> object"), + children); goto done; } iter = children; @@ -798,25 +797,25 @@ ppscm_print_children (SCM printer, enum display_hint hint, break; } - if (! scm_is_pair (item)) + if (!scm_is_pair (item)) { - ppscm_print_pp_type_error - (_("result of pretty-printer children iterator is not a pair" + ppscm_print_pp_type_error ( + _ ("result of pretty-printer children iterator is not a pair" " or (end-of-iteration)"), - item); + item); continue; } scm_name = scm_car (item); v_scm = scm_cdr (item); if (!scm_is_string (scm_name)) { - ppscm_print_pp_type_error - (_("first element of pretty-printer children iterator is not" - " a string"), item); + ppscm_print_pp_type_error ( + _ ("first element of pretty-printer children iterator is not" + " a string"), + item); continue; } - gdb::unique_xmalloc_ptr<char> name - = gdbscm_scm_to_c_string (scm_name); + gdb::unique_xmalloc_ptr<char> name = gdbscm_scm_to_c_string (scm_name); /* Print initial "=" to separate print_string_repr output and children. For other elements, there are three cases: @@ -828,7 +827,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, if (!printed_nothing) gdb_puts (" = ", stream); } - else if (! is_map || i % 2 == 0) + else if (!is_map || i % 2 == 0) gdb_puts (pretty ? "," : ", ", stream); /* Skip printing children if max_depth has been reached. This check @@ -853,7 +852,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, break; } - if (! is_map || i % 2 == 0) + if (!is_map || i % 2 == 0) { if (pretty) { @@ -861,7 +860,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, print_spaces (2 + 2 * recurse, stream); } else - stream->wrap_here (2 + 2 *recurse); + stream->wrap_here (2 + 2 * recurse); } if (is_map && i % 2 == 0) @@ -873,7 +872,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, if (options->print_array_indexes) gdb_printf (stream, "[%d] = ", i); } - else if (! is_map) + else if (!is_map) { gdb_puts (name.get (), stream); gdb_puts (" = ", stream); @@ -897,8 +896,8 @@ ppscm_print_children (SCM printer, enum display_hint hint, SCM except_scm; struct value *value = vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE, - v_scm, &except_scm, - gdbarch, language); + v_scm, &except_scm, gdbarch, + language); if (value == NULL) { @@ -911,8 +910,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, level of depth. This means the key will print before the value does. */ struct value_print_options opt = *options; - if (is_map && i % 2 == 0 - && opt.max_depth != -1 + if (is_map && i % 2 == 0 && opt.max_depth != -1 && opt.max_depth < INT_MAX) ++opt.max_depth; common_val_print (value, stream, recurse + 1, &opt, language); @@ -942,7 +940,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, gdb_puts ("}", stream); } - done: +done: /* Play it safe, make sure ITER doesn't get GC'd. */ scm_remember_upto_here_1 (iter); } @@ -951,8 +949,8 @@ ppscm_print_children (SCM printer, enum display_hint hint, enum ext_lang_rc gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang, - struct value *value, - struct ui_file *stream, int recurse, + struct value *value, struct ui_file *stream, + int recurse, const struct value_print_options *options, const struct language_defn *language) { @@ -1016,26 +1014,23 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang, options, gdbarch, language); if (print_result != STRING_REPR_ERROR) { - ppscm_print_children (printer, hint, stream, recurse, options, - gdbarch, language, - print_result == STRING_REPR_NONE); + ppscm_print_children (printer, hint, stream, recurse, options, gdbarch, + language, print_result == STRING_REPR_NONE); } result = EXT_LANG_RC_OK; - done: +done: if (gdbscm_is_exception (exception)) ppscm_print_exception_unless_memory_error (exception, stream); return result; } - + /* Initialize the Scheme pretty-printer code. */ -static const scheme_function pretty_printer_functions[] = -{ +static const scheme_function pretty_printer_functions[] = { { "make-pretty-printer", 2, 0, 0, - as_a_scm_t_subr (gdbscm_make_pretty_printer), - "\ + as_a_scm_t_subr (gdbscm_make_pretty_printer), "\ Create a <gdb:pretty-printer> object.\n\ \n\ Arguments: name lookup\n\ @@ -1043,24 +1038,20 @@ Create a <gdb:pretty-printer> object.\n\ lookup: a procedure:\n\ (pretty-printer <gdb:value>) -> <gdb:pretty-printer-worker> | #f." }, - { "pretty-printer?", 1, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printer_p), - "\ + { "pretty-printer?", 1, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printer_p), "\ Return #t if the object is a <gdb:pretty-printer> object." }, { "pretty-printer-enabled?", 1, 0, 0, - as_a_scm_t_subr (gdbscm_pretty_printer_enabled_p), - "\ + as_a_scm_t_subr (gdbscm_pretty_printer_enabled_p), "\ Return #t if the pretty-printer is enabled." }, { "set-pretty-printer-enabled!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_pretty_printer_enabled_x), - "\ + as_a_scm_t_subr (gdbscm_set_pretty_printer_enabled_x), "\ Set the enabled flag of the pretty-printer.\n\ Returns \"unspecified\"." }, { "make-pretty-printer-worker", 3, 0, 0, - as_a_scm_t_subr (gdbscm_make_pretty_printer_worker), - "\ + as_a_scm_t_subr (gdbscm_make_pretty_printer_worker), "\ Create a <gdb:pretty-printer-worker> object.\n\ \n\ Arguments: display-hint to-string children\n\ @@ -1071,17 +1062,14 @@ Create a <gdb:pretty-printer-worker> object.\n\ (pretty-printer) -> <gdb:iterator>" }, { "pretty-printer-worker?", 1, 0, 0, - as_a_scm_t_subr (gdbscm_pretty_printer_worker_p), - "\ + as_a_scm_t_subr (gdbscm_pretty_printer_worker_p), "\ Return #t if the object is a <gdb:pretty-printer-worker> object." }, - { "pretty-printers", 0, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printers), - "\ + { "pretty-printers", 0, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printers), "\ Return the list of global pretty-printers." }, { "set-pretty-printers!", 1, 0, 0, - as_a_scm_t_subr (gdbscm_set_pretty_printers_x), - "\ + as_a_scm_t_subr (gdbscm_set_pretty_printers_x), "\ Set the list of global pretty-printers." }, END_FUNCTIONS diff --git a/gdb/guile/scm-progspace.c b/gdb/guile/scm-progspace.c index 99f7938..129720a 100644 --- a/gdb/guile/scm-progspace.c +++ b/gdb/guile/scm-progspace.c @@ -63,7 +63,7 @@ struct psscm_deleter }; static const registry<program_space>::key<pspace_smob, psscm_deleter> - psscm_pspace_data_key; + psscm_pspace_data_key; /* Return the list of pretty-printers registered with P_SMOB. */ @@ -72,7 +72,7 @@ psscm_pspace_smob_pretty_printers (const pspace_smob *p_smob) { return p_smob->pretty_printers; } - + /* Administrivia for progspace smobs. */ /* The smob "print" function for <gdb:progspace>. */ @@ -88,9 +88,8 @@ psscm_print_pspace_smob (SCM self, SCM port, scm_print_state *pstate) struct objfile *objfile = p_smob->pspace->symfile_object_file; gdbscm_printf (port, "%s", - objfile != NULL - ? objfile_name (objfile) - : "{no symfile}"); + objfile != NULL ? objfile_name (objfile) + : "{no symfile}"); } else scm_puts ("{invalid}", port); @@ -109,8 +108,8 @@ psscm_print_pspace_smob (SCM self, SCM port, scm_print_state *pstate) static SCM psscm_make_pspace_smob (void) { - pspace_smob *p_smob = (pspace_smob *) - scm_gc_malloc (sizeof (pspace_smob), pspace_smob_name); + pspace_smob *p_smob + = (pspace_smob *) scm_gc_malloc (sizeof (pspace_smob), pspace_smob_name); SCM p_scm; p_smob->pspace = NULL; @@ -188,8 +187,7 @@ psscm_get_pspace_arg_unsafe (SCM self, int arg_pos, const char *func_name) Throws an exception if SELF is not a <gdb:progspace> object. */ static pspace_smob * -psscm_get_pspace_smob_arg_unsafe (SCM self, int arg_pos, - const char *func_name) +psscm_get_pspace_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name) { SCM p_scm = psscm_get_pspace_arg_unsafe (self, arg_pos, func_name); pspace_smob *p_smob = (pspace_smob *) SCM_SMOB_DATA (p_scm); @@ -219,12 +217,12 @@ psscm_get_valid_pspace_smob_arg_unsafe (SCM self, int arg_pos, if (!psscm_is_valid (p_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:progspace>")); + _ ("<gdb:progspace>")); } return p_smob; } - + /* Program space methods. */ /* (progspace-valid? <gdb:progspace>) -> boolean @@ -315,8 +313,8 @@ gdbscm_set_progspace_pretty_printers_x (SCM self, SCM printers) pspace_smob *p_smob = psscm_get_pspace_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, - SCM_ARG2, FUNC_NAME, _("list")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG2, + FUNC_NAME, _ ("list")); p_smob->pretty_printers = printers; @@ -355,49 +353,43 @@ gdbscm_progspaces (void) return scm_reverse_x (result, SCM_EOL); } - + /* Initialize the Scheme program space support. */ -static const scheme_function pspace_functions[] = -{ - { "progspace?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_p), - "\ +static const scheme_function pspace_functions[] + = { { "progspace?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_p), "\ Return #t if the object is a <gdb:objfile> object." }, - { "progspace-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_valid_p), - "\ + { "progspace-valid?", 1, 0, 0, + as_a_scm_t_subr (gdbscm_progspace_valid_p), "\ Return #t if the progspace is valid (hasn't been deleted from gdb)." }, - { "progspace-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_filename), - "\ + { "progspace-filename", 1, 0, 0, + as_a_scm_t_subr (gdbscm_progspace_filename), "\ Return the name of the main symbol file of the progspace." }, - { "progspace-objfiles", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_objfiles), - "\ + { "progspace-objfiles", 1, 0, 0, + as_a_scm_t_subr (gdbscm_progspace_objfiles), "\ Return the list of objfiles associated with the progspace.\n\ Objfiles that are separate debug objfiles are not included in the result.\n\ The order of appearance of objfiles in the result is arbitrary." }, - { "progspace-pretty-printers", 1, 0, 0, - as_a_scm_t_subr (gdbscm_progspace_pretty_printers), - "\ + { "progspace-pretty-printers", 1, 0, 0, + as_a_scm_t_subr (gdbscm_progspace_pretty_printers), "\ Return a list of pretty-printers of the progspace." }, - { "set-progspace-pretty-printers!", 2, 0, 0, - as_a_scm_t_subr (gdbscm_set_progspace_pretty_printers_x), - "\ + { "set-progspace-pretty-printers!", 2, 0, 0, + as_a_scm_t_subr (gdbscm_set_progspace_pretty_printers_x), "\ Set the list of pretty-printers of the progspace." }, - { "current-progspace", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_progspace), - "\ + { "current-progspace", 0, 0, 0, + as_a_scm_t_subr (gdbscm_current_progspace), "\ Return the current program space if there is one or #f if there isn't one." }, - { "progspaces", 0, 0, 0, as_a_scm_t_subr (gdbscm_progspaces), - "\ + { "progspaces", 0, 0, 0, as_a_scm_t_subr (gdbscm_progspaces), "\ Return a list of all program spaces." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_pspaces (void) diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c index 46551be..04bde13 100644 --- a/gdb/guile/scm-safe-call.c +++ b/gdb/guile/scm-safe-call.c @@ -151,9 +151,7 @@ gdbscm_with_catch (void *data) struct with_catch_data *d = (struct with_catch_data *) data; d->catch_result - = scm_c_catch (SCM_BOOL_T, - d->func, d->data, - d->unwind_handler, d, + = scm_c_catch (SCM_BOOL_T, d->func, d->data, d->unwind_handler, d, d->pre_unwind_handler, d); #if HAVE_GUILE_MANUAL_FINALIZATION @@ -177,7 +175,7 @@ gdbscm_with_guile (const char *(*func) (void *), void *data) c_data.func = func; c_data.data = data; /* Set this now in case an exception is thrown. */ - c_data.result = _("Error while executing Scheme code."); + c_data.result = _ ("Error while executing Scheme code."); catch_data.func = scscm_safe_call_body; catch_data.data = &c_data; @@ -219,7 +217,7 @@ gdbscm_call_guile (SCM (*func) (void *), void *data, return catch_data.catch_result; } - + /* Utilities to safely call Scheme code, catching all exceptions, and preventing continuation capture. The result is the result of calling the function, or if an exception occurs @@ -335,7 +333,7 @@ gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM rest, excp_matcher_func *ok_excps) return gdbscm_call_guile (scscm_apply_1_body, args, ok_excps); } - + /* Utilities to call Scheme code, not catching exceptions, and not preventing continuation capture. The result is the result of calling the function. @@ -358,7 +356,7 @@ gdbscm_unsafe_call_1 (SCM proc, SCM arg0) { return scm_call_1 (proc, arg0); } - + /* Utilities for safely evaluating a Scheme expression string. */ struct eval_scheme_string_data @@ -407,7 +405,7 @@ gdbscm_safe_eval_string (const char *string, int display_result) return make_unique_xstrdup (result); return NULL; } - + /* Utilities for safely loading Scheme scripts. */ /* Helper function for gdbscm_safe_source_scheme_script. */ @@ -448,14 +446,13 @@ gdbscm_safe_source_script (const char *filename) filename = abs_filename.get (); } - result = gdbscm_with_guile (scscm_source_scheme_script, - (void *) filename); + result = gdbscm_with_guile (scscm_source_scheme_script, (void *) filename); if (result != NULL) return make_unique_xstrdup (result); return NULL; } - + /* Utility for entering an interactive Guile repl. */ void diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c index f8e03dd..7e92757 100644 --- a/gdb/guile/scm-string.c +++ b/gdb/guile/scm-string.c @@ -114,8 +114,8 @@ gdbscm_call_scm_to_stringn (void *datap) It is an error to call this if STRING is not a string. */ gdb::unique_xmalloc_ptr<char> -gdbscm_scm_to_string (SCM string, size_t *lenp, - const char *charset, int strict, SCM *except_scmp) +gdbscm_scm_to_string (SCM string, size_t *lenp, const char *charset, + int strict, SCM *except_scmp) { struct scm_to_stringn_data data; SCM scm_result; @@ -123,9 +123,8 @@ gdbscm_scm_to_string (SCM string, size_t *lenp, data.string = string; data.lenp = lenp; data.charset = charset; - data.conversion_kind = (strict - ? SCM_FAILED_CONVERSION_ERROR - : SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE); + data.conversion_kind = (strict ? SCM_FAILED_CONVERSION_ERROR + : SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE); data.result = NULL; scm_result = gdbscm_call_guile (gdbscm_call_scm_to_stringn, &data, NULL); @@ -174,8 +173,8 @@ gdbscm_call_scm_from_stringn (void *datap) can't be converted (limitation of underlying Guile conversion support). */ SCM -gdbscm_scm_from_string (const char *string, size_t len, - const char *charset, int strict) +gdbscm_scm_from_string (const char *string, size_t len, const char *charset, + int strict) { struct scm_from_stringn_data data; SCM scm_result; @@ -184,9 +183,8 @@ gdbscm_scm_from_string (const char *string, size_t len, data.len = len; data.charset = charset; /* The use of SCM_FAILED_CONVERSION_QUESTION_MARK is specified by Guile. */ - data.conversion_kind = (strict - ? SCM_FAILED_CONVERSION_ERROR - : SCM_FAILED_CONVERSION_QUESTION_MARK); + data.conversion_kind = (strict ? SCM_FAILED_CONVERSION_ERROR + : SCM_FAILED_CONVERSION_QUESTION_MARK); data.result = SCM_UNDEFINED; scm_result = gdbscm_call_guile (gdbscm_call_scm_from_stringn, &data, NULL); @@ -239,8 +237,8 @@ gdbscm_string_to_argv (SCM string_scm) char *string; SCM result = SCM_EOL; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", - string_scm, &string); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", string_scm, + &string); if (string == NULL || *string == '\0') { @@ -256,18 +254,15 @@ gdbscm_string_to_argv (SCM string_scm) return scm_reverse_x (result, SCM_EOL); } - + /* Initialize the Scheme charset interface to GDB. */ -static const scheme_function string_functions[] = -{ - { "string->argv", 1, 0, 0, as_a_scm_t_subr (gdbscm_string_to_argv), - "\ +static const scheme_function string_functions[] + = { { "string->argv", 1, 0, 0, as_a_scm_t_subr (gdbscm_string_to_argv), "\ Convert a string to a list of strings split up according to\n\ gdb's argv parsing rules." }, - END_FUNCTIONS -}; + END_FUNCTIONS }; void gdbscm_initialize_strings (void) diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 1619705..5ebf53d 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -59,8 +59,7 @@ struct syscm_deleter /* Helper function for syscm_del_objfile_symbols to mark the symbol as invalid. */ - static int - syscm_mark_symbol_invalid (void **slot, void *info) + static int syscm_mark_symbol_invalid (void **slot, void *info) { symbol_smob *s_smob = (symbol_smob *) *slot; @@ -77,7 +76,7 @@ struct syscm_deleter }; static const registry<objfile>::key<htab, syscm_deleter> - syscm_objfile_data_key; + syscm_objfile_data_key; struct syscm_gdbarch_data { @@ -86,7 +85,7 @@ struct syscm_gdbarch_data }; static const registry<gdbarch>::key<syscm_gdbarch_data> syscm_gdbarch_data_key; - + /* Administrivia for symbol smobs. */ /* Helper function to hash a symbol_smob. */ @@ -107,8 +106,7 @@ syscm_eq_symbol_smob (const void *ap, const void *bp) const symbol_smob *a = (const symbol_smob *) ap; const symbol_smob *b = (const symbol_smob *) bp; - return (a->symbol == b->symbol - && a->symbol != NULL); + return (a->symbol == b->symbol && a->symbol != NULL); } /* Return the struct symbol pointer -> SCM mapping table. @@ -179,9 +177,8 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate) if (pstate->writingp) gdbscm_printf (port, "#<%s ", symbol_smob_name); gdbscm_printf (port, "%s", - s_smob->symbol != NULL - ? s_smob->symbol->print_name () - : "<invalid>"); + s_smob->symbol != NULL ? s_smob->symbol->print_name () + : "<invalid>"); if (pstate->writingp) scm_puts (">", port); @@ -196,8 +193,8 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate) static SCM syscm_make_symbol_smob (void) { - symbol_smob *s_smob = (symbol_smob *) - scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name); + symbol_smob *s_smob + = (symbol_smob *) scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name); SCM s_scm; s_smob->symbol = NULL; @@ -295,7 +292,7 @@ syscm_get_valid_symbol_smob_arg_unsafe (SCM self, int arg_pos, if (!syscm_is_valid (s_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:symbol>")); + _ ("<gdb:symbol>")); } return s_smob; @@ -308,13 +305,12 @@ struct symbol * syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos, const char *func_name) { - symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, arg_pos, - func_name); + symbol_smob *s_smob + = syscm_get_valid_symbol_smob_arg_unsafe (self, arg_pos, func_name); return s_smob->symbol; } - /* Symbol methods. */ /* (symbol-valid? <gdb:symbol>) -> boolean @@ -465,7 +461,8 @@ gdbscm_symbol_variable_p (SCM self) return scm_from_bool (!symbol->is_argument () && (theclass == LOC_LOCAL || theclass == LOC_REGISTER - || theclass == LOC_STATIC || theclass == LOC_COMPUTED + || theclass == LOC_STATIC + || theclass == LOC_COMPUTED || theclass == LOC_OPTIMIZED_OUT)); } @@ -522,15 +519,15 @@ gdbscm_symbol_value (SCM self, SCM rest) frame_smob *f_smob = NULL; struct value *value = NULL; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O", - rest, &frame_pos, &frame_scm); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O", rest, + &frame_pos, &frame_scm); if (!gdbscm_is_false (frame_scm)) f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME); if (symbol->aclass () == LOC_TYPEDEF) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _("cannot get the value of a typedef")); + _ ("cannot get the value of a typedef")); } gdbscm_gdb_exception exc {}; @@ -542,11 +539,11 @@ gdbscm_symbol_value (SCM self, SCM rest) { frame_info = frame_info_ptr (frscm_frame_smob_to_frame (f_smob)); if (frame_info == NULL) - error (_("Invalid frame")); + error (_ ("Invalid frame")); } - + if (symbol_read_needs_frame (symbol) && frame_info == NULL) - error (_("Symbol requires a frame to compute its value")); + error (_ ("Symbol requires a frame to compute its value")); /* TODO: currently, we have no way to recover the block in which SYMBOL was found, so we have no block to pass to read_var_value. This will @@ -562,7 +559,7 @@ gdbscm_symbol_value (SCM self, SCM rest) GDBSCM_HANDLE_GDB_EXCEPTION (exc); return vlscm_scm_from_value (value); } - + /* (lookup-symbol name [#:block <gdb:block>] [#:domain domain]) -> (<gdb:symbol> field-of-this?) The result is #f if the symbol is not found. @@ -580,9 +577,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) struct field_of_this_result is_a_field_of_this; struct symbol *symbol = NULL; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi", - name_scm, &name, rest, - &block_arg_pos, &block_scm, + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi", name_scm, + &name, rest, &block_arg_pos, &block_scm, &domain_arg_pos, &domain); if (block_arg_pos >= 0) @@ -603,7 +599,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) try { frame_info_ptr selected_frame - = get_selected_frame (_("no frame selected")); + = get_selected_frame (_ ("no frame selected")); block = get_frame_block (selected_frame, NULL); } catch (const gdb_exception &ex) @@ -618,7 +614,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) try { symbol = lookup_symbol (name, block, (domain_enum) domain, - &is_a_field_of_this).symbol; + &is_a_field_of_this) + .symbol; } catch (const gdb_exception &ex) { @@ -648,9 +645,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) struct symbol *symbol = NULL; gdbscm_gdb_exception except {}; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", - name_scm, &name, rest, - &domain_arg_pos, &domain); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", name_scm, + &name, rest, &domain_arg_pos, &domain); try { @@ -669,74 +665,54 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) return syscm_scm_from_symbol (symbol); } - + /* Initialize the Scheme symbol support. */ /* Note: The SYMBOL_ prefix on the integer constants here is present for compatibility with the Python support. */ -static const scheme_integer_constant symbol_integer_constants[] = -{ -#define X(SYM) { "SYMBOL_" #SYM, SYM } - X (LOC_UNDEF), - X (LOC_CONST), - X (LOC_STATIC), - X (LOC_REGISTER), - X (LOC_ARG), - X (LOC_REF_ARG), - X (LOC_LOCAL), - X (LOC_TYPEDEF), - X (LOC_LABEL), - X (LOC_BLOCK), - X (LOC_CONST_BYTES), - X (LOC_UNRESOLVED), - X (LOC_OPTIMIZED_OUT), - X (LOC_COMPUTED), - X (LOC_REGPARM_ADDR), - - X (UNDEF_DOMAIN), - X (VAR_DOMAIN), - X (STRUCT_DOMAIN), - X (LABEL_DOMAIN), - X (VARIABLES_DOMAIN), - X (FUNCTIONS_DOMAIN), +static const scheme_integer_constant symbol_integer_constants[] = { +#define X(SYM) \ + { \ + "SYMBOL_" #SYM, SYM \ + } + X (LOC_UNDEF), X (LOC_CONST), X (LOC_STATIC), + X (LOC_REGISTER), X (LOC_ARG), X (LOC_REF_ARG), + X (LOC_LOCAL), X (LOC_TYPEDEF), X (LOC_LABEL), + X (LOC_BLOCK), X (LOC_CONST_BYTES), X (LOC_UNRESOLVED), + X (LOC_OPTIMIZED_OUT), X (LOC_COMPUTED), X (LOC_REGPARM_ADDR), + + X (UNDEF_DOMAIN), X (VAR_DOMAIN), X (STRUCT_DOMAIN), + X (LABEL_DOMAIN), X (VARIABLES_DOMAIN), X (FUNCTIONS_DOMAIN), X (TYPES_DOMAIN), #undef X END_INTEGER_CONSTANTS }; -static const scheme_function symbol_functions[] = -{ - { "symbol?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_p), - "\ +static const scheme_function symbol_functions[] = { + { "symbol?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_p), "\ Return #t if the object is a <gdb:symbol> object." }, - { "symbol-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_valid_p), - "\ + { "symbol-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_valid_p), "\ Return #t if object is a valid <gdb:symbol> object.\n\ A valid symbol is a symbol that has not been freed.\n\ Symbols are freed when the objfile they come from is freed." }, - { "symbol-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_type), - "\ + { "symbol-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_type), "\ Return the type of symbol." }, - { "symbol-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_symtab), - "\ + { "symbol-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_symtab), "\ Return the symbol table (<gdb:symtab>) containing symbol." }, - { "symbol-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_line), - "\ + { "symbol-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_line), "\ Return the line number at which the symbol was defined." }, - { "symbol-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_name), - "\ + { "symbol-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_name), "\ Return the name of the symbol as a string." }, { "symbol-linkage-name", 1, 0, 0, - as_a_scm_t_subr (gdbscm_symbol_linkage_name), - "\ + as_a_scm_t_subr (gdbscm_symbol_linkage_name), "\ Return the linkage name of the symbol as a string." }, { "symbol-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_print_name), @@ -750,34 +726,27 @@ asked GDB to display demangled or mangled names." }, Return the address class of the symbol." }, { "symbol-needs-frame?", 1, 0, 0, - as_a_scm_t_subr (gdbscm_symbol_needs_frame_p), - "\ + as_a_scm_t_subr (gdbscm_symbol_needs_frame_p), "\ Return #t if the symbol needs a frame to compute its value." }, - { "symbol-argument?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_argument_p), - "\ + { "symbol-argument?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_argument_p), "\ Return #t if the symbol is a function argument." }, - { "symbol-constant?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_constant_p), - "\ + { "symbol-constant?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_constant_p), "\ Return #t if the symbol is a constant." }, - { "symbol-function?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_function_p), - "\ + { "symbol-function?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_function_p), "\ Return #t if the symbol is a function." }, - { "symbol-variable?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_variable_p), - "\ + { "symbol-variable?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_variable_p), "\ Return #t if the symbol is a variable." }, - { "symbol-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_symbol_value), - "\ + { "symbol-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_symbol_value), "\ Return the value of the symbol.\n\ \n\ Arguments: <gdb:symbol> [#:frame frame]" }, - { "lookup-symbol", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_symbol), - "\ + { "lookup-symbol", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_symbol), "\ Return (<gdb:symbol> field-of-this?) if found, otherwise #f.\n\ \n\ Arguments: name [#:block block] [#:domain domain]\n\ @@ -786,8 +755,7 @@ Return (<gdb:symbol> field-of-this?) if found, otherwise #f.\n\ domain: a SYMBOL_*_DOMAIN value" }, { "lookup-global-symbol", 1, 0, 1, - as_a_scm_t_subr (gdbscm_lookup_global_symbol), - "\ + as_a_scm_t_subr (gdbscm_lookup_global_symbol), "\ Return <gdb:symbol> if found, otherwise #f.\n\ \n\ Arguments: name [#:domain domain]\n\ diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c index f3c3347..21ca0fe 100644 --- a/gdb/guile/scm-symtab.c +++ b/gdb/guile/scm-symtab.c @@ -87,8 +87,7 @@ struct stscm_deleter /* Helper function for stscm_del_objfile_symtabs to mark the symtab as invalid. */ - static int - stscm_mark_symtab_invalid (void **slot, void *info) + static int stscm_mark_symtab_invalid (void **slot, void *info) { symtab_smob *st_smob = (symtab_smob *) *slot; @@ -105,8 +104,8 @@ struct stscm_deleter }; static const registry<objfile>::key<htab, stscm_deleter> - stscm_objfile_data_key; - + stscm_objfile_data_key; + /* Administrivia for symtab smobs. */ /* Helper function to hash a symbol_smob. */ @@ -127,8 +126,7 @@ stscm_eq_symtab_smob (const void *ap, const void *bp) const symtab_smob *a = (const symtab_smob *) ap; const symtab_smob *b = (const symtab_smob *) bp; - return (a->symtab == b->symtab - && a->symtab != NULL); + return (a->symtab == b->symtab && a->symtab != NULL); } /* Return the struct symtab pointer -> SCM mapping table. @@ -180,8 +178,8 @@ stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, "#<%s ", symtab_smob_name); gdbscm_printf (port, "%s", st_smob->symtab != NULL - ? symtab_to_filename_for_display (st_smob->symtab) - : "<invalid>"); + ? symtab_to_filename_for_display (st_smob->symtab) + : "<invalid>"); scm_puts (">", port); scm_remember_upto_here_1 (self); @@ -195,8 +193,8 @@ stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate) static SCM stscm_make_symtab_smob (void) { - symtab_smob *st_smob = (symtab_smob *) - scm_gc_malloc (sizeof (symtab_smob), symtab_smob_name); + symtab_smob *st_smob + = (symtab_smob *) scm_gc_malloc (sizeof (symtab_smob), symtab_smob_name); SCM st_scm; st_smob->symtab = NULL; @@ -244,7 +242,7 @@ stscm_scm_from_symtab (struct symtab *symtab) st_smob = (symtab_smob *) SCM_SMOB_DATA (st_scm); st_smob->symtab = symtab; gdbscm_fill_eqable_gsmob_ptr_slot (slot, &st_smob->base); - + return st_scm; } @@ -293,13 +291,12 @@ stscm_get_valid_symtab_smob_arg_unsafe (SCM self, int arg_pos, if (!stscm_is_valid (st_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:symtab>")); + _ ("<gdb:symtab>")); } return st_smob; } - /* Symbol table methods. */ /* (symtab-valid? <gdb:symtab>) -> boolean @@ -383,7 +380,7 @@ gdbscm_symtab_static_block (SCM self) return bkscm_scm_from_block (block, symtab->compunit ()->objfile ()); } - + /* Administrivia for sal (symtab-and-line) smobs. */ /* The smob "print" function for <gdb:sal>. */ @@ -508,13 +505,12 @@ stscm_get_valid_sal_smob_arg (SCM self, int arg_pos, const char *func_name) if (!stscm_sal_is_valid (s_smob)) { - gdbscm_invalid_object_error (func_name, arg_pos, self, - _("<gdb:sal>")); + gdbscm_invalid_object_error (func_name, arg_pos, self, _ ("<gdb:sal>")); } return s_smob; } - + /* sal methods */ /* (sal-valid? <gdb:sal>) -> boolean @@ -603,69 +599,54 @@ gdbscm_find_pc_line (SCM pc_scm) GDBSCM_HANDLE_GDB_EXCEPTION (exc); return stscm_scm_from_sal (sal); } - + /* Initialize the Scheme symbol support. */ -static const scheme_function symtab_functions[] = -{ - { "symtab?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_p), - "\ +static const scheme_function symtab_functions[] = { + { "symtab?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_p), "\ Return #t if the object is a <gdb:symtab> object." }, - { "symtab-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_valid_p), - "\ + { "symtab-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_valid_p), "\ Return #t if the symtab still exists in GDB.\n\ Symtabs are deleted when the corresponding objfile is freed." }, - { "symtab-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_filename), - "\ + { "symtab-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_filename), "\ Return the symtab's source file name." }, - { "symtab-fullname", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_fullname), - "\ + { "symtab-fullname", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_fullname), "\ Return the symtab's full source file name." }, - { "symtab-objfile", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_objfile), - "\ + { "symtab-objfile", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_objfile), "\ Return the symtab's objfile." }, { "symtab-global-block", 1, 0, 0, - as_a_scm_t_subr (gdbscm_symtab_global_block), - "\ + as_a_scm_t_subr (gdbscm_symtab_global_block), "\ Return the symtab's global block." }, { "symtab-static-block", 1, 0, 0, - as_a_scm_t_subr (gdbscm_symtab_static_block), - "\ + as_a_scm_t_subr (gdbscm_symtab_static_block), "\ Return the symtab's static block." }, - { "sal?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_p), - "\ + { "sal?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_p), "\ Return #t if the object is a <gdb:sal> (symtab-and-line) object." }, - { "sal-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_valid_p), - "\ + { "sal-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_valid_p), "\ Return #t if the symtab for the sal still exists in GDB.\n\ Symtabs are deleted when the corresponding objfile is freed." }, - { "sal-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_symtab), - "\ + { "sal-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_symtab), "\ Return the sal's symtab." }, - { "sal-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_line), - "\ + { "sal-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_line), "\ Return the sal's line number, or #f if there is none." }, - { "sal-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_pc), - "\ + { "sal-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_pc), "\ Return the sal's address." }, - { "sal-last", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_last), - "\ + { "sal-last", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_last), "\ Return the last address specified by the sal, or #f if there is none." }, - { "find-pc-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_find_pc_line), - "\ + { "find-pc-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_find_pc_line), "\ Return the sal corresponding to the address, or #f if there isn't one.\n\ \n\ Arguments: address" }, diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index da16d22..a2a0d88 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -66,8 +66,8 @@ struct field_smob static const char type_smob_name[] = "gdb:type"; static const char field_smob_name[] = "gdb:field"; -static const char not_composite_error[] = - N_("type is not a structure, union, or enum type"); +static const char not_composite_error[] + = N_ ("type is not a structure, union, or enum type"); /* The tag Guile knows the type smob by. */ static scm_t_bits type_smob_tag; @@ -95,13 +95,14 @@ struct tyscm_deleter gdb_assert (htab != nullptr); htab_up copied_types = create_copied_types_hash (); - htab_traverse_noresize (htab, tyscm_copy_type_recursive, copied_types.get ()); + htab_traverse_noresize (htab, tyscm_copy_type_recursive, + copied_types.get ()); htab_delete (htab); } }; static const registry<objfile>::key<htab, tyscm_deleter> - tyscm_objfile_data_key; + tyscm_objfile_data_key; /* Hash table to uniquify global (non-objfile-owned) types. */ static htab_t global_types_map; @@ -139,7 +140,7 @@ tyscm_type_name (struct type *type) gdbscm_throw (excp); } - + /* Administrivia for type smobs. */ /* Helper function to hash a type_smob. */ @@ -160,8 +161,7 @@ tyscm_eq_type_smob (const void *ap, const void *bp) const type_smob *a = (const type_smob *) ap; const type_smob *b = (const type_smob *) bp; - return (a->type == b->type - && a->type != NULL); + return (a->type == b->type && a->type != NULL); } /* Return the struct type pointer -> SCM mapping table. @@ -272,8 +272,8 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm) static SCM tyscm_make_type_smob (void) { - type_smob *t_smob = (type_smob *) - scm_gc_malloc (sizeof (type_smob), type_smob_name); + type_smob *t_smob + = (type_smob *) scm_gc_malloc (sizeof (type_smob), type_smob_name); SCM t_scm; /* This must be filled in by the caller. */ @@ -397,7 +397,6 @@ tyscm_copy_type_recursive (void **slot, void *info) return 1; } - /* Administrivia for field smobs. */ /* The smob "print" function for <gdb:field>. */ @@ -424,8 +423,8 @@ tyscm_print_field_smob (SCM self, SCM port, scm_print_state *pstate) static SCM tyscm_make_field_smob (SCM type_scm, int field_num) { - field_smob *f_smob = (field_smob *) - scm_gc_malloc (sizeof (field_smob), field_smob_name); + field_smob *f_smob + = (field_smob *) scm_gc_malloc (sizeof (field_smob), field_smob_name); SCM result; f_smob->type_scm = type_scm; @@ -511,7 +510,7 @@ tyscm_field_smob_to_field (field_smob *f_smob) return &type->field (f_smob->field_num); } - + /* Type smob accessors. */ /* (type-code <gdb:type>) -> integer @@ -545,7 +544,7 @@ gdbscm_type_fields (SCM self) containing_type = tyscm_get_composite (type); if (containing_type == NULL) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _(not_composite_error)); + _ (not_composite_error)); /* If SELF is a typedef or reference, we want the underlying type, which is what tyscm_get_composite returns. */ @@ -572,8 +571,7 @@ gdbscm_type_tag (SCM self) struct type *type = t_smob->type; const char *tagname = nullptr; - if (type->code () == TYPE_CODE_STRUCT - || type->code () == TYPE_CODE_UNION + if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION || type->code () == TYPE_CODE_ENUM) tagname = type->name (); @@ -666,7 +664,6 @@ gdbscm_type_strip_typedefs (SCM self) static struct type * tyscm_get_composite (struct type *type) { - for (;;) { gdbscm_gdb_exception exc {}; @@ -680,16 +677,14 @@ tyscm_get_composite (struct type *type) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - if (type->code () != TYPE_CODE_PTR - && type->code () != TYPE_CODE_REF) + if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF) break; type = type->target_type (); } /* If this is not a struct, union, or enum type, raise TypeError exception. */ - if (type->code () != TYPE_CODE_STRUCT - && type->code () != TYPE_CODE_UNION + if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION && type->code () != TYPE_CODE_ENUM) return NULL; @@ -708,8 +703,8 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector, long n1, n2 = 0; struct type *array = NULL; - gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l", - n1_scm, &n1, n2_scm, &n2); + gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l", n1_scm, &n1, + n2_scm, &n2); if (SCM_UNBNDP (n2_scm)) { @@ -722,7 +717,7 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector, gdbscm_out_of_range_error (func_name, SCM_ARG3, scm_cons (scm_from_long (n1), scm_from_long (n2)), - _("Array length must not be negative")); + _ ("Array length must not be negative")); } gdbscm_gdb_exception exc {}; @@ -813,9 +808,9 @@ gdbscm_type_range (SCM self) LONGEST low = 0, high = 0; SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ARRAY - || type->code () == TYPE_CODE_STRING - || type->code () == TYPE_CODE_RANGE, - self, SCM_ARG1, FUNC_NAME, _("ranged type")); + || type->code () == TYPE_CODE_STRING + || type->code () == TYPE_CODE_RANGE, + self, SCM_ARG1, FUNC_NAME, _ ("ranged type")); switch (type->code ()) { @@ -950,7 +945,7 @@ gdbscm_type_unqualified (SCM self) GDBSCM_HANDLE_GDB_EXCEPTION (exc); return tyscm_scm_from_type (type); } - + /* Field related accessors of types. */ /* (type-num-fields <gdb:type>) -> integer @@ -966,7 +961,7 @@ gdbscm_type_num_fields (SCM self) type = tyscm_get_composite (type); if (type == NULL) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _(not_composite_error)); + _ (not_composite_error)); return scm_from_long (type->num_fields ()); } @@ -982,7 +977,7 @@ gdbscm_type_field (SCM self, SCM field_scm) struct type *type = t_smob->type; SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME, - _("string")); + _ ("string")); /* We want just fields of this type, not of base types, so instead of using lookup_struct_elt_type, portions of that function are @@ -991,7 +986,7 @@ gdbscm_type_field (SCM self, SCM field_scm) type = tyscm_get_composite (type); if (type == NULL) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _(not_composite_error)); + _ (not_composite_error)); { gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm); @@ -1009,7 +1004,7 @@ gdbscm_type_field (SCM self, SCM field_scm) } gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, field_scm, - _("Unknown field")); + _ ("Unknown field")); } /* (type-has-field? <gdb:type> string) -> boolean @@ -1023,7 +1018,7 @@ gdbscm_type_has_field_p (SCM self, SCM field_scm) struct type *type = t_smob->type; SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME, - _("string")); + _ ("string")); /* We want just fields of this type, not of base types, so instead of using lookup_struct_elt_type, portions of that function are @@ -1032,11 +1027,10 @@ gdbscm_type_has_field_p (SCM self, SCM field_scm) type = tyscm_get_composite (type); if (type == NULL) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _(not_composite_error)); + _ (not_composite_error)); { - gdb::unique_xmalloc_ptr<char> field - = gdbscm_scm_to_c_string (field_scm); + gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm); for (int i = 0; i < type->num_fields (); i++) { @@ -1065,7 +1059,7 @@ gdbscm_make_field_iterator (SCM self) containing_type = tyscm_get_composite (type); if (containing_type == NULL) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _(not_composite_error)); + _ (not_composite_error)); /* If SELF is a typedef or reference, we want the underlying type, which is what tyscm_get_composite returns. */ @@ -1098,14 +1092,13 @@ gdbscm_type_next_field_x (SCM self) object = itscm_iterator_smob_object (i_smob); progress = itscm_iterator_smob_progress (i_smob); - SCM_ASSERT_TYPE (tyscm_is_type (object), object, - SCM_ARG1, FUNC_NAME, type_smob_name); + SCM_ASSERT_TYPE (tyscm_is_type (object), object, SCM_ARG1, FUNC_NAME, + type_smob_name); t_smob = (type_smob *) SCM_SMOB_DATA (object); type = t_smob->type; - SCM_ASSERT_TYPE (scm_is_signed_integer (progress, - 0, type->num_fields ()), - progress, SCM_ARG1, FUNC_NAME, _("integer")); + SCM_ASSERT_TYPE (scm_is_signed_integer (progress, 0, type->num_fields ()), + progress, SCM_ARG1, FUNC_NAME, _ ("integer")); field = scm_to_int (progress); if (field < type->num_fields ()) @@ -1117,7 +1110,7 @@ gdbscm_type_next_field_x (SCM self) return gdbscm_end_of_iteration (); } - + /* Field smob accessors. */ /* (field-name <gdb:field>) -> string @@ -1162,8 +1155,8 @@ gdbscm_field_enumval (SCM self) struct field *field = tyscm_field_smob_to_field (f_smob); struct type *type = tyscm_field_smob_containing_type (f_smob); - SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM, - self, SCM_ARG1, FUNC_NAME, _("enum type")); + SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME, + _ ("enum type")); return scm_from_long (field->loc_enumval ()); } @@ -1179,8 +1172,8 @@ gdbscm_field_bitpos (SCM self) struct field *field = tyscm_field_smob_to_field (f_smob); struct type *type = tyscm_field_smob_containing_type (f_smob); - SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM, - self, SCM_ARG1, FUNC_NAME, _("non-enum type")); + SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME, + _ ("non-enum type")); return scm_from_long (field->loc_bitpos ()); } @@ -1225,7 +1218,7 @@ gdbscm_field_baseclass_p (SCM self) return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type)); return SCM_BOOL_F; } - + /* Return the type named TYPE_NAME in BLOCK. Returns NULL if not found. This routine does not throw an error. */ @@ -1244,8 +1237,7 @@ tyscm_lookup_typename (const char *type_name, const struct block *block) else if (startswith (type_name, "enum ")) type = lookup_enum (type_name + 5, NULL); else - type = lookup_typename (current_language, - type_name, block, 0); + type = lookup_typename (current_language, type_name, block, 0); } catch (const gdb_exception &except) { @@ -1268,16 +1260,15 @@ gdbscm_lookup_type (SCM name_scm, SCM rest) const struct block *block = NULL; struct type *type; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#O", - name_scm, &name, - rest, &block_arg_pos, &block_scm); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#O", name_scm, + &name, rest, &block_arg_pos, &block_scm); if (block_arg_pos != -1) { SCM exception; - block = bkscm_scm_to_block (block_scm, block_arg_pos, FUNC_NAME, - &exception); + block + = bkscm_scm_to_block (block_scm, block_arg_pos, FUNC_NAME, &exception); if (block == NULL) { xfree (name); @@ -1291,12 +1282,10 @@ gdbscm_lookup_type (SCM name_scm, SCM rest) return tyscm_scm_from_type (type); return SCM_BOOL_F; } - -/* Initialize the Scheme type code. */ +/* Initialize the Scheme type code. */ -static const scheme_integer_constant type_integer_constants[] = -{ +static const scheme_integer_constant type_integer_constants[] = { /* This is kept for backward compatibility. */ { "TYPE_CODE_BITSTRING", -1 }, @@ -1307,46 +1296,36 @@ static const scheme_integer_constant type_integer_constants[] = END_INTEGER_CONSTANTS }; -static const scheme_function type_functions[] = -{ - { "type?", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_p), - "\ +static const scheme_function type_functions[] = { + { "type?", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_p), "\ Return #t if the object is a <gdb:type> object." }, - { "lookup-type", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_type), - "\ + { "lookup-type", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_type), "\ Return the <gdb:type> object representing string or #f if not found.\n\ If block is given then the type is looked for in that block.\n\ \n\ Arguments: string [#:block <gdb:block>]" }, - { "type-code", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_code), - "\ + { "type-code", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_code), "\ Return the code of the type" }, - { "type-tag", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_tag), - "\ + { "type-tag", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_tag), "\ Return the tag name of the type, or #f if there isn't one." }, - { "type-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_name), - "\ + { "type-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_name), "\ Return the name of the type as a string, or #f if there isn't one." }, - { "type-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_print_name), - "\ + { "type-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_print_name), "\ Return the print name of the type as a string." }, - { "type-sizeof", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_sizeof), - "\ + { "type-sizeof", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_sizeof), "\ Return the size of the type, in bytes." }, { "type-strip-typedefs", 1, 0, 0, - as_a_scm_t_subr (gdbscm_type_strip_typedefs), - "\ + as_a_scm_t_subr (gdbscm_type_strip_typedefs), "\ Return a type formed by stripping the type of all typedefs." }, - { "type-array", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_array), - "\ + { "type-array", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_array), "\ Return a type representing an array of objects of the type.\n\ \n\ Arguments: <gdb:type> [low-bound] high-bound\n\ @@ -1355,8 +1334,7 @@ Return a type representing an array of objects of the type.\n\ the array size.\n\ Valid bounds for array indices are [low-bound,high-bound]." }, - { "type-vector", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_vector), - "\ + { "type-vector", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_vector), "\ Return a type representing a vector of objects of the type.\n\ Vectors differ from arrays in that if the current language has C-style\n\ arrays, vectors don't decay to a pointer to the first element.\n\ @@ -1368,89 +1346,70 @@ They are first class values.\n\ the array size.\n\ Valid bounds for array indices are [low-bound,high-bound]." }, - { "type-pointer", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_pointer), - "\ + { "type-pointer", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_pointer), "\ Return a type of pointer to the type." }, - { "type-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_range), - "\ + { "type-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_range), "\ Return (low high) representing the range for the type." }, - { "type-reference", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_reference), - "\ + { "type-reference", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_reference), "\ Return a type of reference to the type." }, - { "type-target", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_target), - "\ + { "type-target", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_target), "\ Return the target type of the type." }, - { "type-const", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_const), - "\ + { "type-const", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_const), "\ Return a const variant of the type." }, - { "type-volatile", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_volatile), - "\ + { "type-volatile", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_volatile), "\ Return a volatile variant of the type." }, - { "type-unqualified", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_unqualified), - "\ + { "type-unqualified", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_unqualified), "\ Return a variant of the type without const or volatile attributes." }, - { "type-num-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_num_fields), - "\ + { "type-num-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_num_fields), "\ Return the number of fields of the type." }, - { "type-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_fields), - "\ + { "type-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_fields), "\ Return the list of <gdb:field> objects of fields of the type." }, { "make-field-iterator", 1, 0, 0, - as_a_scm_t_subr (gdbscm_make_field_iterator), - "\ + as_a_scm_t_subr (gdbscm_make_field_iterator), "\ Return a <gdb:iterator> object for iterating over the fields of the type." }, - { "type-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_field), - "\ + { "type-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_field), "\ Return the field named by string of the type.\n\ \n\ Arguments: <gdb:type> string" }, - { "type-has-field?", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_has_field_p), - "\ + { "type-has-field?", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_has_field_p), "\ Return #t if the type has field named string.\n\ \n\ Arguments: <gdb:type> string" }, - { "field?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_p), - "\ + { "field?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_p), "\ Return #t if the object is a <gdb:field> object." }, - { "field-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_name), - "\ + { "field-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_name), "\ Return the name of the field." }, - { "field-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_type), - "\ + { "field-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_type), "\ Return the type of the field." }, - { "field-enumval", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_enumval), - "\ + { "field-enumval", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_enumval), "\ Return the enum value represented by the field." }, - { "field-bitpos", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitpos), - "\ + { "field-bitpos", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitpos), "\ Return the offset in bits of the field in its containing type." }, - { "field-bitsize", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitsize), - "\ + { "field-bitsize", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitsize), "\ Return the size of the field in bits." }, { "field-artificial?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_artificial_p), "\ Return #t if the field is artificial." }, - { "field-baseclass?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_baseclass_p), - "\ + { "field-baseclass?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_baseclass_p), "\ Return #t if the field is a baseclass." }, END_FUNCTIONS @@ -1464,8 +1423,8 @@ gdbscm_initialize_types (void) scm_set_smob_print (type_smob_tag, tyscm_print_type_smob); scm_set_smob_equalp (type_smob_tag, tyscm_equal_p_type_smob); - field_smob_tag = gdbscm_make_smob_type (field_smob_name, - sizeof (field_smob)); + field_smob_tag + = gdbscm_make_smob_type (field_smob_name, sizeof (field_smob)); scm_set_smob_print (field_smob_tag, tyscm_print_field_smob); gdbscm_define_integer_constants (type_integer_constants, 1); diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c index 4ddb09a..0975e7e 100644 --- a/gdb/guile/scm-utils.c +++ b/gdb/guile/scm-utils.c @@ -72,7 +72,7 @@ gdbscm_define_integer_constants (const scheme_integer_constant *constants, scm_c_export (sc->name, NULL); } } - + /* scm_printf, alas it doesn't exist. */ void @@ -109,7 +109,7 @@ gdbscm_debug_write (SCM obj) scm_newline (port); scm_force_output (port); } - + /* Subroutine of gdbscm_parse_function_args to simplify it. Return the number of keyword arguments. */ @@ -177,14 +177,16 @@ validate_arg_format (const char *format) } /* Our version of SCM_ASSERT_TYPE that calls gdbscm_make_type_error. */ -#define CHECK_TYPE(ok, arg, position, func_name, expected_type) \ - do { \ - if (!(ok)) \ - { \ - return gdbscm_make_type_error ((func_name), (position), (arg), \ - (expected_type)); \ - } \ - } while (0) +#define CHECK_TYPE(ok, arg, position, func_name, expected_type) \ + do \ + { \ + if (!(ok)) \ + { \ + return gdbscm_make_type_error ((func_name), (position), (arg), \ + (expected_type)); \ + } \ + } \ + while (0) /* Subroutine of gdbscm_parse_function_args to simplify it. Check the type of ARG against FORMAT_CHAR and extract the value. @@ -192,8 +194,8 @@ validate_arg_format (const char *format) The result is #f upon success or a <gdb:exception> object. */ static SCM -extract_arg (char format_char, SCM arg, void *argp, - const char *func_name, int position) +extract_arg (char format_char, SCM arg, void *argp, const char *func_name, + int position) { switch (format_char) { @@ -202,7 +204,7 @@ extract_arg (char format_char, SCM arg, void *argp, char **arg_ptr = (char **) argp; CHECK_TYPE (gdbscm_is_true (scm_string_p (arg)), arg, position, - func_name, _("string")); + func_name, _ ("string")); *arg_ptr = gdbscm_scm_to_c_string (arg).release (); break; } @@ -212,7 +214,7 @@ extract_arg (char format_char, SCM arg, void *argp, /* While in Scheme, anything non-#f is "true", we're strict. */ CHECK_TYPE (gdbscm_is_bool (arg), arg, position, func_name, - _("boolean")); + _ ("boolean")); *arg_ptr = gdbscm_is_true (arg); break; } @@ -220,8 +222,8 @@ extract_arg (char format_char, SCM arg, void *argp, { int *arg_ptr = (int *) argp; - CHECK_TYPE (scm_is_signed_integer (arg, INT_MIN, INT_MAX), - arg, position, func_name, _("int")); + CHECK_TYPE (scm_is_signed_integer (arg, INT_MIN, INT_MAX), arg, + position, func_name, _ ("int")); *arg_ptr = scm_to_int (arg); break; } @@ -229,8 +231,8 @@ extract_arg (char format_char, SCM arg, void *argp, { int *arg_ptr = (int *) argp; - CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT_MAX), - arg, position, func_name, _("unsigned int")); + CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT_MAX), arg, position, + func_name, _ ("unsigned int")); *arg_ptr = scm_to_uint (arg); break; } @@ -238,8 +240,8 @@ extract_arg (char format_char, SCM arg, void *argp, { long *arg_ptr = (long *) argp; - CHECK_TYPE (scm_is_signed_integer (arg, LONG_MIN, LONG_MAX), - arg, position, func_name, _("long")); + CHECK_TYPE (scm_is_signed_integer (arg, LONG_MIN, LONG_MAX), arg, + position, func_name, _ ("long")); *arg_ptr = scm_to_long (arg); break; } @@ -247,8 +249,8 @@ extract_arg (char format_char, SCM arg, void *argp, { unsigned long *arg_ptr = (unsigned long *) argp; - CHECK_TYPE (scm_is_unsigned_integer (arg, 0, ULONG_MAX), - arg, position, func_name, _("unsigned long")); + CHECK_TYPE (scm_is_unsigned_integer (arg, 0, ULONG_MAX), arg, position, + func_name, _ ("unsigned long")); *arg_ptr = scm_to_ulong (arg); break; } @@ -256,8 +258,8 @@ extract_arg (char format_char, SCM arg, void *argp, { LONGEST *arg_ptr = (LONGEST *) argp; - CHECK_TYPE (scm_is_signed_integer (arg, INT64_MIN, INT64_MAX), - arg, position, func_name, _("LONGEST")); + CHECK_TYPE (scm_is_signed_integer (arg, INT64_MIN, INT64_MAX), arg, + position, func_name, _ ("LONGEST")); *arg_ptr = gdbscm_scm_to_longest (arg); break; } @@ -265,8 +267,8 @@ extract_arg (char format_char, SCM arg, void *argp, { ULONGEST *arg_ptr = (ULONGEST *) argp; - CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT64_MAX), - arg, position, func_name, _("ULONGEST")); + CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT64_MAX), arg, + position, func_name, _ ("ULONGEST")); *arg_ptr = gdbscm_scm_to_ulongest (arg); break; } @@ -304,17 +306,15 @@ lookup_keyword (const SCM *keyword_list, SCM keyword) return -1; } - /* Helper for gdbscm_parse_function_args that does most of the work, in a separate function wrapped with gdbscm_wrap so that we can use non-trivial-dtor objects here. The result is #f upon success or a <gdb:exception> object otherwise. */ static SCM -gdbscm_parse_function_args_1 (const char *func_name, - int beginning_arg_pos, - const SCM *keywords, - const char *format, va_list args) +gdbscm_parse_function_args_1 (const char *func_name, int beginning_arg_pos, + const SCM *keywords, const char *format, + va_list args) { const char *p; int i, have_rest, num_keywords, position; @@ -377,8 +377,7 @@ gdbscm_parse_function_args_1 (const char *func_name, keyword_positions[i] = -1; } - while (scm_is_pair (rest) - && scm_is_keyword (scm_car (rest))) + while (scm_is_pair (rest) && scm_is_keyword (scm_car (rest))) { SCM keyword = scm_car (rest); @@ -386,16 +385,16 @@ gdbscm_parse_function_args_1 (const char *func_name, if (i < 0) { status = gdbscm_make_error (scm_arg_type_key, func_name, - _("Unrecognized keyword: ~a"), + _ ("Unrecognized keyword: ~a"), scm_list_1 (keyword), keyword); goto fail; } if (!scm_is_pair (scm_cdr (rest))) { - status = gdbscm_make_error - (scm_arg_type_key, func_name, - _("Missing value for keyword argument"), - scm_list_1 (keyword), keyword); + status + = gdbscm_make_error (scm_arg_type_key, func_name, + _ ("Missing value for keyword argument"), + scm_list_1 (keyword), keyword); goto fail; } keyword_args[i] = scm_cadr (rest); @@ -410,7 +409,7 @@ gdbscm_parse_function_args_1 (const char *func_name, void *arg_ptr = va_arg (args, void *); SCM arg = keyword_args[i]; - if (! scm_is_eq (arg, SCM_UNSPECIFIED)) + if (!scm_is_eq (arg, SCM_UNSPECIFIED)) { *arg_pos_ptr = keyword_positions[i]; status = extract_arg (p[i], arg, arg_ptr, func_name, @@ -436,11 +435,11 @@ gdbscm_parse_function_args_1 (const char *func_name, } else { - if (! scm_is_null (rest)) + if (!scm_is_null (rest)) { status = gdbscm_make_error (scm_args_number_key, func_name, - _("Too many arguments"), - SCM_EOL, SCM_BOOL_F); + _ ("Too many arguments"), SCM_EOL, + SCM_BOOL_F); goto fail; } } @@ -448,7 +447,7 @@ gdbscm_parse_function_args_1 (const char *func_name, /* Return anything not-an-exception. */ return SCM_BOOL_F; - fail: +fail: for (char *ptr : allocated_strings) xfree (ptr); @@ -525,21 +524,18 @@ gdbscm_parse_function_args_1 (const char *func_name, argument. Unbound optional arguments are ignored. */ void -gdbscm_parse_function_args (const char *func_name, - int beginning_arg_pos, - const SCM *keywords, - const char *format, ...) +gdbscm_parse_function_args (const char *func_name, int beginning_arg_pos, + const SCM *keywords, const char *format, ...) { va_list args; va_start (args, format); - gdbscm_wrap (gdbscm_parse_function_args_1, func_name, - beginning_arg_pos, keywords, format, args); + gdbscm_wrap (gdbscm_parse_function_args_1, func_name, beginning_arg_pos, + keywords, format, args); va_end (args); } - /* Return longest L as a scheme object. */ SCM @@ -609,7 +605,7 @@ gdbscm_gc_xstrdup (const char *str) /* Return a duplicate of ARGV living on the GC heap. */ -const char * const * +const char *const * gdbscm_gc_dup_argv (char **argv) { int i, len; @@ -622,7 +618,7 @@ gdbscm_gc_dup_argv (char **argv) /* Allocating "pointerless" works because the pointers are all self-contained within the object. */ result = (char **) scm_gc_malloc_pointerless (((len + 1) * sizeof (char *)) - + string_space, + + string_space, "parameter enum list"); p = (char *) &result[len + 1]; @@ -634,7 +630,7 @@ gdbscm_gc_dup_argv (char **argv) } result[i] = NULL; - return (const char * const *) result; + return (const char *const *) result; } /* Return non-zero if the version of Guile being used it at least diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index b994830..d795745 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -77,7 +77,7 @@ static SCM length_keyword; static SCM error_symbol; static SCM escape_symbol; static SCM substitute_symbol; - + /* Administrivia for value smobs. */ /* Iterate over all the <gdb:value> objects, calling preserve_one_value on @@ -207,8 +207,8 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2) static SCM vlscm_make_value_smob (void) { - value_smob *v_smob = (value_smob *) - scm_gc_malloc (sizeof (value_smob), value_smob_name); + value_smob *v_smob + = (value_smob *) scm_gc_malloc (sizeof (value_smob), value_smob_name); SCM v_scm; /* These must be filled in by the caller. */ @@ -315,7 +315,7 @@ vlscm_scm_to_value (SCM v_scm) v_smob = (value_smob *) SCM_SMOB_DATA (v_scm); return v_smob->value; } - + /* Value methods. */ /* (make-value x [#:type type]) -> <gdb:value> */ @@ -333,28 +333,23 @@ gdbscm_make_value (SCM x, SCM rest) struct type *type = NULL; if (type_arg_pos > 0) { - type_smob *t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, - type_arg_pos, - FUNC_NAME); + type_smob *t_smob + = tyscm_get_type_smob_arg_unsafe (type_scm, type_arg_pos, FUNC_NAME); type = tyscm_type_smob_type (t_smob); } - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - SCM except_scm; - struct value *value - = vlscm_convert_typed_value_from_scheme (FUNC_NAME, SCM_ARG1, x, - type_arg_pos, type_scm, type, - &except_scm, - get_current_arch (), - current_language); - if (value == NULL) - return except_scm; - - return vlscm_scm_from_value (value); - }); + SCM except_scm; + struct value *value = vlscm_convert_typed_value_from_scheme ( + FUNC_NAME, SCM_ARG1, x, type_arg_pos, type_scm, type, &except_scm, + get_current_arch (), current_language); + if (value == NULL) + return except_scm; + + return vlscm_scm_from_value (value); + }); } /* (make-lazy-value <gdb:type> address) -> <gdb:value> */ @@ -362,22 +357,21 @@ gdbscm_make_value (SCM x, SCM rest) static SCM gdbscm_make_lazy_value (SCM type_scm, SCM address_scm) { - type_smob *t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, - SCM_ARG1, FUNC_NAME); + type_smob *t_smob + = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME); struct type *type = tyscm_type_smob_type (t_smob); ULONGEST address; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "U", - address_scm, &address); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "U", address_scm, + &address); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - struct value *value = value_from_contents_and_address (type, NULL, - address); - return vlscm_scm_from_value (value); - }); + struct value *value + = value_from_contents_and_address (type, NULL, address); + return vlscm_scm_from_value (value); + }); } /* (value-optimized-out? <gdb:value>) -> boolean */ @@ -388,10 +382,9 @@ gdbscm_value_optimized_out_p (SCM self) value_smob *v_smob = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - return gdbscm_wrap ([=] - { - return scm_from_bool (value_optimized_out (v_smob->value)); - }); + return gdbscm_wrap ([=] { + return scm_from_bool (value_optimized_out (v_smob->value)); + }); } /* (value-address <gdb:value>) -> integer @@ -404,30 +397,29 @@ gdbscm_value_address (SCM self) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return gdbscm_wrap ([=] - { - if (SCM_UNBNDP (v_smob->address)) - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + if (SCM_UNBNDP (v_smob->address)) + { + scoped_value_mark free_values; - SCM address = SCM_BOOL_F; + SCM address = SCM_BOOL_F; - try - { - address = vlscm_scm_from_value (value_addr (value)); - } - catch (const gdb_exception &except) - { - } + try + { + address = vlscm_scm_from_value (value_addr (value)); + } + catch (const gdb_exception &except) + { + } - if (gdbscm_is_exception (address)) - return address; + if (gdbscm_is_exception (address)) + return address; - v_smob->address = address; - } + v_smob->address = address; + } - return v_smob->address; - }); + return v_smob->address; + }); } /* (value-dereference <gdb:value>) -> <gdb:value> @@ -439,13 +431,12 @@ gdbscm_value_dereference (SCM self) value_smob *v_smob = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - struct value *res_val = value_ind (v_smob->value); - return vlscm_scm_from_value (res_val); - }); + struct value *res_val = value_ind (v_smob->value); + return vlscm_scm_from_value (res_val); + }); } /* (value-referenced-value <gdb:value>) -> <gdb:value> @@ -464,28 +455,27 @@ gdbscm_value_referenced_value (SCM self) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; - - struct value *res_val; - - switch (check_typedef (value_type (value))->code ()) - { - case TYPE_CODE_PTR: - res_val = value_ind (value); - break; - case TYPE_CODE_REF: - case TYPE_CODE_RVALUE_REF: - res_val = coerce_ref (value); - break; - default: - error (_("Trying to get the referenced value from a value which is" - " neither a pointer nor a reference")); - } - - return vlscm_scm_from_value (res_val); - }); + return gdbscm_wrap ([=] { + scoped_value_mark free_values; + + struct value *res_val; + + switch (check_typedef (value_type (value))->code ()) + { + case TYPE_CODE_PTR: + res_val = value_ind (value); + break; + case TYPE_CODE_REF: + case TYPE_CODE_RVALUE_REF: + res_val = coerce_ref (value); + break; + default: + error (_ ("Trying to get the referenced value from a value which is" + " neither a pointer nor a reference")); + } + + return vlscm_scm_from_value (res_val); + }); } static SCM @@ -495,13 +485,12 @@ gdbscm_reference_value (SCM self, enum type_code refcode) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - struct value *res_val = value_ref (value, refcode); - return vlscm_scm_from_value (res_val); - }); + struct value *res_val = value_ref (value, refcode); + return vlscm_scm_from_value (res_val); + }); } /* (value-reference-value <gdb:value>) -> <gdb:value> */ @@ -529,13 +518,12 @@ gdbscm_value_const_value (SCM self) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - struct value *res_val = make_cv_value (1, 0, value); - return vlscm_scm_from_value (res_val); - }); + struct value *res_val = make_cv_value (1, 0, value); + return vlscm_scm_from_value (res_val); + }); } /* (value-type <gdb:value>) -> <gdb:type> */ @@ -563,7 +551,7 @@ gdbscm_value_dynamic_type (SCM self) struct value *value = v_smob->value; struct type *type = NULL; - if (! SCM_UNBNDP (v_smob->dynamic_type)) + if (!SCM_UNBNDP (v_smob->dynamic_type)) return v_smob->dynamic_type; gdbscm_gdb_exception exc {}; @@ -630,23 +618,22 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op, = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG2, FUNC_NAME); struct type *type = tyscm_type_smob_type (t_smob); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; - - struct value *res_val; - if (op == UNOP_DYNAMIC_CAST) - res_val = value_dynamic_cast (type, value); - else if (op == UNOP_REINTERPRET_CAST) - res_val = value_reinterpret_cast (type, value); - else - { - gdb_assert (op == UNOP_CAST); - res_val = value_cast (type, value); - } - - return vlscm_scm_from_value (res_val); - }); + return gdbscm_wrap ([=] { + scoped_value_mark free_values; + + struct value *res_val; + if (op == UNOP_DYNAMIC_CAST) + res_val = value_dynamic_cast (type, value); + else if (op == UNOP_REINTERPRET_CAST) + res_val = value_reinterpret_cast (type, value); + else + { + gdb_assert (op == UNOP_CAST); + res_val = value_cast (type, value); + } + + return vlscm_scm_from_value (res_val); + }); } /* (value-cast <gdb:value> <gdb:type>) -> <gdb:value> */ @@ -684,21 +671,20 @@ gdbscm_value_field (SCM self, SCM field_scm) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME, - _("string")); + _ ("string")); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm); + gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm); - struct value *tmp = v_smob->value; + struct value *tmp = v_smob->value; - struct value *res_val = value_struct_elt (&tmp, {}, field.get (), NULL, - "struct/class/union"); + struct value *res_val + = value_struct_elt (&tmp, {}, field.get (), NULL, "struct/class/union"); - return vlscm_scm_from_value (res_val); - }); + return vlscm_scm_from_value (res_val); + }); } /* (value-subscript <gdb:value> integer|<gdb:value>) -> <gdb:value> @@ -714,32 +700,30 @@ gdbscm_value_subscript (SCM self, SCM index_scm) SCM_ASSERT (type != NULL, self, SCM_ARG2, FUNC_NAME); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - SCM except_scm; - struct value *index - = vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm, - &except_scm, - type->arch (), - current_language); - if (index == NULL) - return except_scm; - - /* Assume we are attempting an array access, and let the value code + SCM except_scm; + struct value *index + = vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm, + &except_scm, type->arch (), + current_language); + if (index == NULL) + return except_scm; + + /* Assume we are attempting an array access, and let the value code throw an exception if the index has an invalid type. Check the value's type is something that can be accessed via a subscript. */ - struct value *tmp = coerce_ref (value); - struct type *tmp_type = check_typedef (value_type (tmp)); - if (tmp_type->code () != TYPE_CODE_ARRAY - && tmp_type->code () != TYPE_CODE_PTR) - error (_("Cannot subscript requested type")); - - struct value *res_val = value_subscript (tmp, value_as_long (index)); - return vlscm_scm_from_value (res_val); - }); + struct value *tmp = coerce_ref (value); + struct type *tmp_type = check_typedef (value_type (tmp)); + if (tmp_type->code () != TYPE_CODE_ARRAY + && tmp_type->code () != TYPE_CODE_PTR) + error (_ ("Cannot subscript requested type")); + + struct value *res_val = value_subscript (tmp, value_as_long (index)); + return vlscm_scm_from_value (res_val); + }); } /* (value-call <gdb:value> arg-list) -> <gdb:value> @@ -766,12 +750,11 @@ gdbscm_value_call (SCM self, SCM args) } GDBSCM_HANDLE_GDB_EXCEPTION (exc); - SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self, - SCM_ARG1, FUNC_NAME, - _("function (value of TYPE_CODE_FUNC)")); + SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self, SCM_ARG1, FUNC_NAME, + _ ("function (value of TYPE_CODE_FUNC)")); - SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (args)), args, - SCM_ARG2, FUNC_NAME, _("list")); + SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (args)), args, SCM_ARG2, + FUNC_NAME, _ ("list")); args_count = scm_ilength (args); if (args_count > 0) @@ -786,10 +769,9 @@ gdbscm_value_call (SCM self, SCM args) { SCM arg = scm_car (args); - vargs[i] = vlscm_convert_value_from_scheme (FUNC_NAME, - GDBSCM_ARG_NONE, arg, - &except_scm, - gdbarch, language); + vargs[i] + = vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE, arg, + &except_scm, gdbarch, language); if (vargs[i] == NULL) gdbscm_throw (except_scm); @@ -798,14 +780,13 @@ gdbscm_value_call (SCM self, SCM args) gdb_assert (gdbscm_is_true (scm_null_p (args))); } - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; + return gdbscm_wrap ([=] { + scoped_value_mark free_values; - auto av = gdb::make_array_view (vargs, args_count); - value *return_value = call_function_by_hand (function, NULL, av); - return vlscm_scm_from_value (return_value); - }); + auto av = gdb::make_array_view (vargs, args_count); + value *return_value = call_function_by_hand (function, NULL, av); + return vlscm_scm_from_value (return_value); + }); } /* (value->bytevector <gdb:value>) -> bytevector */ @@ -847,10 +828,8 @@ gdbscm_value_to_bytevector (SCM self) static int is_intlike (struct type *type, int ptr_ok) { - return (type->code () == TYPE_CODE_INT - || type->code () == TYPE_CODE_ENUM - || type->code () == TYPE_CODE_BOOL - || type->code () == TYPE_CODE_CHAR + return (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_ENUM + || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_CHAR || (ptr_ok && type->code () == TYPE_CODE_PTR)); } @@ -880,7 +859,7 @@ gdbscm_value_to_bool (SCM self) GDBSCM_HANDLE_GDB_EXCEPTION (exc); SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME, - _("integer-like gdb value")); + _ ("integer-like gdb value")); try { @@ -924,7 +903,7 @@ gdbscm_value_to_integer (SCM self) GDBSCM_HANDLE_GDB_EXCEPTION (exc); SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME, - _("integer-like gdb value")); + _ ("integer-like gdb value")); try { @@ -972,7 +951,7 @@ gdbscm_value_to_real (SCM self) GDBSCM_HANDLE_GDB_EXCEPTION (exc); SCM_ASSERT_TYPE (is_intlike (type, 0) || type->code () == TYPE_CODE_FLT, - self, SCM_ARG1, FUNC_NAME, _("number")); + self, SCM_ARG1, FUNC_NAME, _ ("number")); try { @@ -1002,7 +981,7 @@ gdbscm_value_to_real (SCM self) /* TODO: Is there a better way to check if the value fits? */ if (!value_equal (value, check)) gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, - _("number can't be converted to a double")); + _ ("number can't be converted to a double")); return scm_from_double (d); } @@ -1036,9 +1015,8 @@ gdbscm_value_to_string (SCM self, SCM rest) value_smob *v_smob = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - const SCM keywords[] = { - encoding_keyword, errors_keyword, length_keyword, SCM_BOOL_F - }; + const SCM keywords[] + = { encoding_keyword, errors_keyword, length_keyword, SCM_BOOL_F }; int encoding_arg_pos = -1, errors_arg_pos = -1, length_arg_pos = -1; char *encoding = NULL; SCM errors = SCM_BOOL_F; @@ -1053,18 +1031,16 @@ gdbscm_value_to_string (SCM self, SCM rest) We can't have existing cleanups when a Scheme exception is thrown. */ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#sOi", rest, - &encoding_arg_pos, &encoding, - &errors_arg_pos, &errors, - &length_arg_pos, &length); + &encoding_arg_pos, &encoding, &errors_arg_pos, + &errors, &length_arg_pos, &length); - if (errors_arg_pos > 0 - && errors != SCM_BOOL_F + if (errors_arg_pos > 0 && errors != SCM_BOOL_F && !scm_is_eq (errors, error_symbol) && !scm_is_eq (errors, substitute_symbol)) { SCM excp = gdbscm_make_out_of_range_error (FUNC_NAME, errors_arg_pos, errors, - _("invalid error kind")); + _ ("invalid error kind")); xfree (encoding); gdbscm_throw (excp); @@ -1103,14 +1079,11 @@ gdbscm_value_to_string (SCM self, SCM rest) gdbscm_dynwind_xfree (encoding); gdbscm_dynwind_xfree (buffer_contents); - result = scm_from_stringn ((const char *) buffer_contents, - length * char_type->length (), - (encoding != NULL && *encoding != '\0' - ? encoding - : la_encoding), - scm_is_eq (errors, error_symbol) - ? SCM_FAILED_CONVERSION_ERROR - : SCM_FAILED_CONVERSION_QUESTION_MARK); + result = scm_from_stringn ( + (const char *) buffer_contents, length * char_type->length (), + (encoding != NULL && *encoding != '\0' ? encoding : la_encoding), + scm_is_eq (errors, error_symbol) ? SCM_FAILED_CONVERSION_ERROR + : SCM_FAILED_CONVERSION_QUESTION_MARK); scm_dynwind_end (); @@ -1145,14 +1118,13 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) We can't have existing cleanups when a Scheme exception is thrown. */ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#si", rest, - &encoding_arg_pos, &encoding, - &length_arg_pos, &length); + &encoding_arg_pos, &encoding, &length_arg_pos, + &length); if (length < -1) { gdbscm_out_of_range_error (FUNC_NAME, length_arg_pos, - scm_from_int (length), - _("invalid length")); + scm_from_int (length), _ ("invalid length")); } try @@ -1181,18 +1153,18 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) length = array_length; else if (array_length == -1) { - type = lookup_array_range_type (realtype->target_type (), - 0, length - 1); + type = lookup_array_range_type (realtype->target_type (), 0, + length - 1); } else if (length != array_length) { /* We need to create a new array type with the specified length. */ if (length > array_length) - error (_("length is larger than array size")); - type = lookup_array_range_type (type->target_type (), - low_bound, - low_bound + length - 1); + error (_ ("length is larger than array size")); + type + = lookup_array_range_type (type->target_type (), low_bound, + low_bound + length - 1); } addr = value_address (value); break; @@ -1245,12 +1217,11 @@ gdbscm_value_fetch_lazy_x (SCM self) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return gdbscm_wrap ([=] - { - if (value_lazy (value)) - value_fetch_lazy (value); - return SCM_UNSPECIFIED; - }); + return gdbscm_wrap ([=] { + if (value_lazy (value)) + value_fetch_lazy (value); + return SCM_UNSPECIFIED; + }); } /* (value-print <gdb:value>) -> string */ @@ -1287,7 +1258,7 @@ gdbscm_value_print (SCM self) return scm_from_stringn (stb.c_str (), stb.size (), host_charset (), SCM_FAILED_CONVERSION_QUESTION_MARK); } - + /* (parse-and-eval string) -> <gdb:value> Parse a string and evaluate the string as an expression. */ @@ -1295,14 +1266,13 @@ static SCM gdbscm_parse_and_eval (SCM expr_scm) { char *expr_str; - gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", - expr_scm, &expr_str); + gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", expr_scm, + &expr_str); - return gdbscm_wrap ([=] - { - scoped_value_mark free_values; - return vlscm_scm_from_value (parse_and_eval (expr_str)); - }); + return gdbscm_wrap ([=] { + scoped_value_mark free_values; + return vlscm_scm_from_value (parse_and_eval (expr_str)); + }); } /* (history-ref integer) -> <gdb:value> @@ -1314,10 +1284,9 @@ gdbscm_history_ref (SCM index) int i; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i); - return gdbscm_wrap ([=] - { - return vlscm_scm_from_value (access_value_history (i)); - }); + return gdbscm_wrap ([=] { + return vlscm_scm_from_value (access_value_history (i)); + }); } /* (history-append! <gdb:value>) -> index @@ -1328,22 +1297,18 @@ gdbscm_history_append_x (SCM value) { value_smob *v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME); - return gdbscm_wrap ([=] - { - return scm_from_int (record_latest_value (v_smob->value)); - }); + return gdbscm_wrap ([=] { + return scm_from_int (record_latest_value (v_smob->value)); + }); } - + /* Initialize the Scheme value code. */ -static const scheme_function value_functions[] = -{ - { "value?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_p), - "\ +static const scheme_function value_functions[] = { + { "value?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_p), "\ Return #t if the object is a <gdb:value> object." }, - { "make-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_value), - "\ + { "make-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_value), "\ Create a <gdb:value> representing object.\n\ Typically this is used to convert numbers and strings to\n\ <gdb:value> objects.\n\ @@ -1351,24 +1316,20 @@ Typically this is used to convert numbers and strings to\n\ Arguments: object [#:type <gdb:type>]" }, { "value-optimized-out?", 1, 0, 0, - as_a_scm_t_subr (gdbscm_value_optimized_out_p), - "\ + as_a_scm_t_subr (gdbscm_value_optimized_out_p), "\ Return #t if the value has been optimizd out." }, - { "value-address", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_address), - "\ + { "value-address", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_address), "\ Return the address of the value." }, - { "value-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_type), - "\ + { "value-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_type), "\ Return the type of the value." }, { "value-dynamic-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_dynamic_type), "\ Return the dynamic type of the value." }, - { "value-cast", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_cast), - "\ + { "value-cast", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_cast), "\ Cast the value to the supplied type.\n\ \n\ Arguments: <gdb:value> <gdb:type>" }, @@ -1381,8 +1342,7 @@ dynamic_cast operator.\n\ Arguments: <gdb:value> <gdb:type>" }, { "value-reinterpret-cast", 2, 0, 0, - as_a_scm_t_subr (gdbscm_value_reinterpret_cast), - "\ + as_a_scm_t_subr (gdbscm_value_reinterpret_cast), "\ Cast the value to the supplied type, as if by the C++\n\ reinterpret_cast operator.\n\ \n\ @@ -1393,8 +1353,7 @@ reinterpret_cast operator.\n\ Return the result of applying the C unary * operator to the value." }, { "value-referenced-value", 1, 0, 0, - as_a_scm_t_subr (gdbscm_value_referenced_value), - "\ + as_a_scm_t_subr (gdbscm_value_referenced_value), "\ Given a value of a reference type, return the value referenced.\n\ The difference between this function and value-dereference is that\n\ the latter applies * unary operator to a value, which need not always\n\ @@ -1404,34 +1363,28 @@ value-dereference will result in a value of type 'int' while\n\ value-referenced-value will result in a value of type 'int *'." }, { "value-reference-value", 1, 0, 0, - as_a_scm_t_subr (gdbscm_value_reference_value), - "\ + as_a_scm_t_subr (gdbscm_value_reference_value), "\ Return a <gdb:value> object which is a reference to the given value." }, { "value-rvalue-reference-value", 1, 0, 0, - as_a_scm_t_subr (gdbscm_value_rvalue_reference_value), - "\ + as_a_scm_t_subr (gdbscm_value_rvalue_reference_value), "\ Return a <gdb:value> object which is an rvalue reference to the given value." }, - { "value-const-value", 1, 0, 0, - as_a_scm_t_subr (gdbscm_value_const_value), + { "value-const-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_const_value), "\ Return a <gdb:value> object which is a 'const' version of the given value." }, - { "value-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_field), - "\ + { "value-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_field), "\ Return the specified field of the value.\n\ \n\ Arguments: <gdb:value> string" }, - { "value-subscript", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_subscript), - "\ + { "value-subscript", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_subscript), "\ Return the value of the array at the specified index.\n\ \n\ Arguments: <gdb:value> integer" }, - { "value-call", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_call), - "\ + { "value-call", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_call), "\ Perform an inferior function call taking the value as a pointer to the\n\ function to call.\n\ Each element of the argument list must be a <gdb:value> object or an object\n\ @@ -1440,18 +1393,15 @@ The result is the value returned by the function.\n\ \n\ Arguments: <gdb:value> arg-list" }, - { "value->bool", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_bool), - "\ + { "value->bool", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_bool), "\ Return the Scheme boolean representing the GDB value.\n\ The value must be \"integer like\". Pointers are ok." }, - { "value->integer", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_integer), - "\ + { "value->integer", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_integer), "\ Return the Scheme integer representing the GDB value.\n\ The value must be \"integer like\". Pointers are ok." }, - { "value->real", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_real), - "\ + { "value->real", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_real), "\ Return the Scheme real number representing the GDB value.\n\ The value must be a number." }, @@ -1460,8 +1410,7 @@ The value must be a number." }, Return a Scheme bytevector with the raw contents of the GDB value.\n\ No transformation, endian or otherwise, is performed." }, - { "value->string", 1, 0, 1, as_a_scm_t_subr (gdbscm_value_to_string), - "\ + { "value->string", 1, 0, 1, as_a_scm_t_subr (gdbscm_value_to_string), "\ Return the Unicode string of the value's contents.\n\ If ENCODING is not given, the string is assumed to be encoded in\n\ the target's charset.\n\ @@ -1475,8 +1424,7 @@ If LENGTH is provided, only fetch string to the length provided.\n\ [#:length length]" }, { "value->lazy-string", 1, 0, 1, - as_a_scm_t_subr (gdbscm_value_to_lazy_string), - "\ + as_a_scm_t_subr (gdbscm_value_to_lazy_string), "\ Return a Scheme object representing a lazily fetched Unicode string\n\ of the value's contents.\n\ If ENCODING is not given, the string is assumed to be encoded in\n\ @@ -1485,14 +1433,12 @@ If LENGTH is provided, only fetch string to the length provided.\n\ \n\ Arguments: <gdb:value> [#:encoding encoding] [#:length length]" }, - { "value-lazy?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lazy_p), - "\ + { "value-lazy?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lazy_p), "\ Return #t if the value is lazy (not fetched yet from the inferior).\n\ A lazy value is fetched when needed, or when the value-fetch-lazy! function\n\ is called." }, - { "make-lazy-value", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_lazy_value), - "\ + { "make-lazy-value", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_lazy_value), "\ Create a <gdb:value> that will be lazily fetched from the target.\n\ \n\ Arguments: <gdb:type> address" }, @@ -1502,20 +1448,16 @@ Create a <gdb:value> that will be lazily fetched from the target.\n\ Fetch the value from the inferior, if it was lazy.\n\ The result is \"unspecified\"." }, - { "value-print", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_print), - "\ + { "value-print", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_print), "\ Return the string representation (print form) of the value." }, - { "parse-and-eval", 1, 0, 0, as_a_scm_t_subr (gdbscm_parse_and_eval), - "\ + { "parse-and-eval", 1, 0, 0, as_a_scm_t_subr (gdbscm_parse_and_eval), "\ Evaluates string in gdb and returns the result as a <gdb:value> object." }, - { "history-ref", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_ref), - "\ + { "history-ref", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_ref), "\ Return the specified value from GDB's value history." }, - { "history-append!", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_append_x), - "\ + { "history-append!", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_append_x), "\ Append the specified value onto GDB's value history." }, END_FUNCTIONS @@ -1524,8 +1466,8 @@ Append the specified value onto GDB's value history." }, void gdbscm_initialize_values (void) { - value_smob_tag = gdbscm_make_smob_type (value_smob_name, - sizeof (value_smob)); + value_smob_tag + = gdbscm_make_smob_type (value_smob_name, sizeof (value_smob)); scm_set_smob_free (value_smob_tag, vlscm_free_value_smob); scm_set_smob_print (value_smob_tag, vlscm_print_value_smob); scm_set_smob_equalp (value_smob_tag, vlscm_equal_p_value_smob); |