X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Fcli%2Fcli-cmds.c;h=4317ea351fb168113a20cf91ef334982ebb20fc3;hb=492c0ab72a050a19d09d0df16eb3b0d8da22be1a;hp=c05f77f1d7654bda4b76990cb2828ff1f118d282;hpb=6f937416b997de1c0fb4664df3b7a69910b66b76;p=platform%2Fupstream%2Fbinutils.git diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index c05f77f..4317ea3 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -39,6 +39,7 @@ #include "source.h" #include "disasm.h" #include "tracepoint.h" +#include "filestuff.h" #include "ui-out.h" @@ -115,10 +116,6 @@ struct cmd_list_element *enablelist; struct cmd_list_element *disablelist; -/* Chain containing all defined toggle subcommands. */ - -struct cmd_list_element *togglelist; - /* Chain containing all defined stop subcommands. */ struct cmd_list_element *stoplist; @@ -314,6 +311,12 @@ show_version (char *args, int from_tty) printf_filtered ("\n"); } +static void +show_configuration (char *args, int from_tty) +{ + print_gdb_configuration (gdb_stdout); +} + /* Handle the quit command. */ void @@ -322,7 +325,7 @@ quit_command (char *args, int from_tty) if (!quit_confirm ()) error (_("Not confirmed.")); - disconnect_tracing (from_tty); + query_if_trace_running (from_tty); quit_force (args, from_tty); } @@ -350,6 +353,7 @@ cd_command (char *dir, int from_tty) /* Found something other than leading repetitions of "/..". */ int found_real_path; char *p; + struct cleanup *cleanup; /* If the new directory is absolute, repeat is a no-op; if relative, repeat might be useful but is more likely to be a mistake. */ @@ -359,7 +363,7 @@ cd_command (char *dir, int from_tty) dir = "~"; dir = tilde_expand (dir); - make_cleanup (xfree, dir); + cleanup = make_cleanup (xfree, dir); if (chdir (dir) < 0) perror_with_name (dir); @@ -443,6 +447,8 @@ cd_command (char *dir, int from_tty) if (from_tty) pwd_command ((char *) 0, 1); + + do_cleanups (cleanup); } /* Show the current value of the 'script-extension' option. */ @@ -473,7 +479,7 @@ find_and_open_script (const char *script_file, int search_path, 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); @@ -587,7 +593,7 @@ source_script_with_search (const char *file, int from_tty, int search_path) for use in loading .gdbinit scripts. */ void -source_script (char *file, int from_tty) +source_script (const char *file, int from_tty) { source_script_with_search (file, from_tty, 0); } @@ -721,6 +727,8 @@ shell_escape (char *arg, int from_tty) { const char *p, *user_shell; + close_most_fds (); + if ((user_shell = (char *) getenv ("SHELL")) == NULL) user_shell = "/bin/sh"; @@ -1318,13 +1326,14 @@ alias_command (char *args, int from_tty) char *args2, *equals, *alias, *command; char **alias_argv, **command_argv; dyn_string_t alias_dyn_string, command_dyn_string; + struct cleanup *cleanup; static const char usage[] = N_("Usage: alias [-a] [--] ALIAS = COMMAND"); if (args == NULL || strchr (args, '=') == NULL) error (_(usage)); args2 = xstrdup (args); - make_cleanup (xfree, args2); + cleanup = make_cleanup (xfree, args2); equals = strchr (args2, '='); *equals = '\0'; alias_argv = gdb_buildargv (args2); @@ -1431,6 +1440,8 @@ alias_command (char *args, int from_tty) command_argv[command_argc - 1], class_alias, abbrev_flag, c_command->prefixlist); } + + do_cleanups (cleanup); } /* Print a list of files and line numbers which a user may choose from @@ -1547,28 +1558,6 @@ void init_cmd_lists (void) { max_user_call_depth = 1024; - - cmdlist = NULL; - infolist = NULL; - enablelist = NULL; - disablelist = NULL; - togglelist = 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 @@ -1756,6 +1745,9 @@ the previous command number shown."), add_cmd ("version", no_set_class, show_version, _("Show what version of GDB this is."), &showlist); + 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, _("\