#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
#include "gdb_wait.h" /* For shell escape implementation. */
#include "gdb_regex.h" /* Used by apropos_command. */
-#include "gdb_string.h"
+#include <string.h>
#include "gdb_vfork.h"
#include "linespec.h"
#include "expression.h"
char *file;
int fd;
struct cleanup *old_cleanups;
- int search_flags = OPF_TRY_CWD_FIRST;
+ int search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
file = tilde_expand (script_file);
old_cleanups = make_cleanup (xfree, file);
if (script_ext_mode != script_ext_off
&& strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py"))
{
- volatile struct gdb_exception e;
-
- TRY_CATCH (e, RETURN_MASK_ERROR)
+ if (have_python ())
+ source_python_script (stream, file);
+ else if (script_ext_mode == script_ext_soft)
{
- source_python_script (stream, file);
- }
- if (e.reason < 0)
- {
- /* Should we fallback to ye olde GDB script mode? */
- if (script_ext_mode == script_ext_soft
- && e.reason == RETURN_ERROR && e.error == UNSUPPORTED_ERROR)
- {
- fseek (stream, 0, SEEK_SET);
- script_from_file (stream, (char*) file);
- }
- else
- {
- /* Nope, just punt. */
- throw_exception (e);
- }
+ /* Fallback to GDB script mode. */
+ script_from_file (stream, file);
}
+ else
+ error (_("Python scripting is not supported in this copy of GDB."));
}
else
script_from_file (stream, file);
/* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an
error. Otherwise (e.g. if it was invoked by a script),
- silently ignore the error. */
+ just emit a warning, rather than cause an error. */
if (from_tty)
perror_with_name (file);
else
- return;
+ {
+ perror_warning_with_name (file);
+ return;
+ }
}
old_cleanups = make_cleanup (xfree, full_path);
static void
echo_command (char *text, int from_tty)
{
- char *p = text;
+ const char *p = text;
int c;
if (text)
struct gdbarch *gdbarch;
if (sal.symtab == 0)
- /* FIXME-32x64--assumes sal.pc fits in long. */
error (_("No source file for address %s."),
- hex_string ((unsigned long) sal.pc));
+ paddress (get_current_arch (), sal.pc));
gdbarch = get_objfile_arch (sal.symtab->objfile);
sym = find_pc_function (sal.pc);
struct gdbarch *gdbarch;
if (sal.symtab == 0)
- /* FIXME-32x64--assumes sal.pc fits in long. */
error (_("No source file for address %s."),
- hex_string ((unsigned long) sal.pc));
+ paddress (get_current_arch (), sal.pc));
gdbarch = get_objfile_arch (sal.symtab->objfile);
sym = find_pc_function (sal.pc);
init_cmd_lists (void)
{
max_user_call_depth = 1024;
-
- cmdlist = NULL;
- infolist = NULL;
- enablelist = NULL;
- disablelist = NULL;
- stoplist = NULL;
- deletelist = NULL;
- detachlist = NULL;
- setlist = NULL;
- unsetlist = NULL;
- showlist = NULL;
- sethistlist = NULL;
- showhistlist = NULL;
- unsethistlist = NULL;
- maintenancelist = NULL;
- maintenanceinfolist = NULL;
- maintenanceprintlist = NULL;
- setprintlist = NULL;
- showprintlist = NULL;
- setchecklist = NULL;
- showchecklist = NULL;
}
static void
value);
}
-static void
-show_baud_rate (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
-{
- fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
- value);
-}
-
static void
show_remote_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
add_cmd ("configuration", no_set_class, show_configuration,
_("Show how GDB was configured at build time."), &showlist);
- /* If target is open when baud changes, it doesn't take effect until
- the next open (I think, not sure). */
- add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\
-Set baud rate for remote serial I/O."), _("\
-Show baud rate for remote serial I/O."), _("\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets."),
- NULL,
- show_baud_rate,
- &setlist, &showlist);
-
add_setshow_zinteger_cmd ("remote", no_class, &remote_debug, _("\
Set debugging of remote protocol."), _("\
Show debugging of remote protocol."), _("\