+2021-05-07 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * guile/guile-internal.h (gdbscm_safe_source_script): Change
+ function return type.
+ * guile/guile.c (gdbscm_source_script): Update to handle change in
+ gdbscm_safe_source_script.
+ * guile/scm-objfile.c (gdbscm_source_objfile_script): Likewise.
+ * guile/scm-safe-call.c (gdbscm_safe_source_script): Change return
+ type.
+
2021-05-06 Simon Marchi <simon.marchi@polymtl.ca>
* inferior.h (class inferior) <args>: Change type to
extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_eval_string
(const char *string, int display_result);
-extern 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);
\f
gdbscm_source_script (const struct extension_language_defn *extlang,
FILE *file, const char *filename)
{
- char *msg = gdbscm_safe_source_script (filename);
+ gdb::unique_xmalloc_ptr<char> msg = gdbscm_safe_source_script (filename);
if (msg != NULL)
- {
- fprintf_filtered (gdb_stderr, "%s\n", msg);
- xfree (msg);
- }
+ fprintf_filtered (gdb_stderr, "%s\n", msg.get ());
}
\f
/* (execute string [#:from-tty boolean] [#:to-string boolean])
struct objfile *objfile, FILE *file,
const char *filename)
{
- char *msg;
-
ofscm_current_objfile = objfile;
- msg = gdbscm_safe_source_script (filename);
+ gdb::unique_xmalloc_ptr<char> msg = gdbscm_safe_source_script (filename);
if (msg != NULL)
- {
- fprintf_filtered (gdb_stderr, "%s", msg);
- xfree (msg);
- }
+ fprintf_filtered (gdb_stderr, "%s", msg.get ());
ofscm_current_objfile = NULL;
}
printed according to "set guile print-stack" and the result is an error
message allocated with malloc, caller must free. */
-char *
+gdb::unique_xmalloc_ptr<char>
gdbscm_safe_source_script (const char *filename)
{
/* scm_c_primitive_load_path only looks in %load-path for files with
(void *) filename);
if (result != NULL)
- return xstrdup (result);
+ return make_unique_xstrdup (result);
return NULL;
}
\f