/* GDB/Scheme support for safe calls into the Guile interpreter.
- Copyright (C) 2014-2018 Free Software Foundation, Inc.
+ Copyright (C) 2014-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "filenames.h"
#include "guile-internal.h"
+#include "gdbsupport/pathstuff.h"
/* Struct to marshall args to scscm_safe_call_body. */
and preventing continuation capture.
The result is NULL if no exception occurred. Otherwise, the exception is
printed according to "set guile print-stack" and the result is an error
- message allocated with malloc, caller must free. */
+ message. */
-char *
+gdb::unique_xmalloc_ptr<char>
gdbscm_safe_eval_string (const char *string, int display_result)
{
struct eval_scheme_string_data data = { string, display_result };
result = gdbscm_with_guile (scscm_eval_scheme_string, (void *) &data);
if (result != NULL)
- return xstrdup (result);
+ return make_unique_xstrdup (result);
return NULL;
}
\f
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