• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂00687ffd41edb1fe6a9a95e2829028cb76fe876c (tree)
時間2004-03-24 05:41:49
作者Elena Zannoni <ezannoni@kwik...>
CommiterElena Zannoni

Log Message

merge mainline changes into branch

Change Summary

差異

--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1,6 +1,6 @@
11 /* GDB CLI commands.
22
3- Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
44
55 This file is part of GDB.
66
@@ -20,7 +20,8 @@
2020 Boston, MA 02111-1307, USA. */
2121
2222 #include "defs.h"
23-#include <readline/tilde.h>
23+#include "readline/readline.h"
24+#include "readline/tilde.h"
2425 #include "completer.h"
2526 #include "target.h" /* For baud_rate, remote_debug and remote_timeout */
2627 #include "gdb_wait.h" /* For shell escape implementation */
@@ -45,6 +46,10 @@
4546 #include "cli/cli-setshow.h"
4647 #include "cli/cli-cmds.h"
4748
49+#ifdef TUI
50+#include "tui/tui.h" /* For tui_active et.al. */
51+#endif
52+
4853 #ifndef GDBINIT_FILENAME
4954 #define GDBINIT_FILENAME ".gdbinit"
5055 #endif
@@ -59,8 +64,6 @@ static void pwd_command (char *, int);
5964
6065 static void show_version (char *, int);
6166
62-static void validate_comname (char *);
63-
6467 static void help_command (char *, int);
6568
6669 static void show_command (char *, int);
@@ -184,7 +187,6 @@ error_no_arg (char *why)
184187 /* The "info" command is defined as a prefix, with allow_unknown = 0.
185188 Therefore, its own definition is called only for "info" with no args. */
186189
187-/* ARGSUSED */
188190 static void
189191 info_command (char *arg, int from_tty)
190192 {
@@ -194,7 +196,6 @@ info_command (char *arg, int from_tty)
194196
195197 /* The "show" command with no arguments shows all the settings. */
196198
197-/* ARGSUSED */
198199 static void
199200 show_command (char *arg, int from_tty)
200201 {
@@ -204,7 +205,6 @@ show_command (char *arg, int from_tty)
204205 /* Provide documentation on command or list given by COMMAND. FROM_TTY
205206 is ignored. */
206207
207-/* ARGSUSED */
208208 static void
209209 help_command (char *command, int from_tty)
210210 {
@@ -222,13 +222,12 @@ compare_strings (const void *arg1, const void *arg2)
222222
223223 /* The "complete" command is used by Emacs to implement completion. */
224224
225-/* ARGSUSED */
226225 static void
227226 complete_command (char *arg, int from_tty)
228227 {
229228 int i;
230229 int argpoint;
231- char **completions;
230+ char **completions, *point, *arg_prefix;
232231
233232 dont_repeat ();
234233
@@ -236,7 +235,23 @@ complete_command (char *arg, int from_tty)
236235 arg = "";
237236 argpoint = strlen (arg);
238237
239- completions = complete_line (arg, arg, argpoint);
238+ /* complete_line assumes that its first argument is somewhere within,
239+ and except for filenames at the beginning of, the word to be completed.
240+ The following crude imitation of readline's word-breaking tries to
241+ accomodate this. */
242+ point = arg + argpoint;
243+ while (point > arg)
244+ {
245+ if (strchr (rl_completer_word_break_characters, point[-1]) != 0)
246+ break;
247+ point--;
248+ }
249+
250+ arg_prefix = alloca (point - arg + 1);
251+ memcpy (arg_prefix, arg, point - arg);
252+ arg_prefix[point - arg] = 0;
253+
254+ completions = complete_line (point, arg, argpoint);
240255
241256 if (completions)
242257 {
@@ -252,7 +267,7 @@ complete_command (char *arg, int from_tty)
252267 while (item < size)
253268 {
254269 int next_item;
255- printf_unfiltered ("%s\n", completions[item]);
270+ printf_unfiltered ("%s%s\n", arg_prefix, completions[item]);
256271 next_item = item + 1;
257272 while (next_item < size
258273 && ! strcmp (completions[item], completions[next_item]))
@@ -275,7 +290,6 @@ is_complete_command (struct cmd_list_element *c)
275290 return cmd_cfunc_eq (c, complete_command);
276291 }
277292
278-/* ARGSUSED */
279293 static void
280294 show_version (char *args, int from_tty)
281295 {
@@ -295,7 +309,6 @@ quit_command (char *args, int from_tty)
295309 quit_force (args, from_tty);
296310 }
297311
298-/* ARGSUSED */
299312 static void
300313 pwd_command (char *args, int from_tty)
301314 {
@@ -303,7 +316,7 @@ pwd_command (char *args, int from_tty)
303316 error ("The \"pwd\" command does not take an argument: %s", args);
304317 getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
305318
306- if (!STREQ (gdb_dirbuf, current_directory))
319+ if (strcmp (gdb_dirbuf, current_directory) != 0)
307320 printf_unfiltered ("Working directory %s\n (canonically %s).\n",
308321 current_directory, gdb_dirbuf);
309322 else
@@ -439,12 +452,11 @@ source_command (char *args, int from_tty)
439452 do_cleanups (old_cleanups);
440453 }
441454
442-/* ARGSUSED */
443455 static void
444456 echo_command (char *text, int from_tty)
445457 {
446458 char *p = text;
447- register int c;
459+ int c;
448460
449461 if (text)
450462 while ((c = *p++) != '\0')
@@ -469,7 +481,6 @@ echo_command (char *text, int from_tty)
469481 gdb_flush (gdb_stdout);
470482 }
471483
472-/* ARGSUSED */
473484 static void
474485 shell_escape (char *arg, int from_tty)
475486 {
@@ -514,9 +525,9 @@ shell_escape (char *arg, int from_tty)
514525 p++; /* Get past '/' */
515526
516527 if (!arg)
517- execl (user_shell, p, 0);
528+ execl (user_shell, p, (char *) 0);
518529 else
519- execl (user_shell, p, "-c", arg, 0);
530+ execl (user_shell, p, "-c", arg, (char *) 0);
520531
521532 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
522533 safe_strerror (errno));
@@ -565,7 +576,7 @@ edit_command (char *arg, int from_tty)
565576 /* Now should only be one argument -- decode it in SAL */
566577
567578 arg1 = arg;
568- sals = decode_line_1 (&arg1, 0, 0, 0, 0);
579+ sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
569580
570581 if (! sals.nelts) return; /* C++ */
571582 if (sals.nelts > 1) {
@@ -659,7 +670,7 @@ list_command (char *arg, int from_tty)
659670
660671 /* "l" or "l +" lists next ten lines. */
661672
662- if (arg == 0 || STREQ (arg, "+"))
673+ if (arg == 0 || strcmp (arg, "+") == 0)
663674 {
664675 print_source_lines (cursal.symtab, cursal.line,
665676 cursal.line + get_lines_to_list (), 0);
@@ -667,7 +678,7 @@ list_command (char *arg, int from_tty)
667678 }
668679
669680 /* "l -" lists previous ten lines, the ones before the ten just listed. */
670- if (STREQ (arg, "-"))
681+ if (strcmp (arg, "-") == 0)
671682 {
672683 print_source_lines (cursal.symtab,
673684 max (get_first_line_listed () - get_lines_to_list (), 1),
@@ -689,7 +700,7 @@ list_command (char *arg, int from_tty)
689700 dummy_beg = 1;
690701 else
691702 {
692- sals = decode_line_1 (&arg1, 0, 0, 0, 0);
703+ sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
693704
694705 if (!sals.nelts)
695706 return; /* C++ */
@@ -722,9 +733,9 @@ list_command (char *arg, int from_tty)
722733 else
723734 {
724735 if (dummy_beg)
725- sals_end = decode_line_1 (&arg1, 0, 0, 0, 0);
736+ sals_end = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
726737 else
727- sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0);
738+ sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0, 0);
728739 if (sals_end.nelts == 0)
729740 return;
730741 if (sals_end.nelts > 1)
@@ -820,7 +831,6 @@ list_command (char *arg, int from_tty)
820831 Two arguments are interpeted as bounds within which to dump
821832 assembly. */
822833
823-/* ARGSUSED */
824834 static void
825835 disassemble_command (char *arg, int from_tty)
826836 {
@@ -844,8 +854,9 @@ disassemble_command (char *arg, int from_tty)
844854 #if defined(TUI)
845855 /* NOTE: cagney/2003-02-13 The `tui_active' was previously
846856 `tui_version'. */
847- else if (tui_active)
848- low = tuiGetLowDisassemblyAddress (low, pc);
857+ if (tui_active)
858+ /* FIXME: cagney/2004-02-07: This should be an observer. */
859+ low = tui_get_low_disassembly_address (low, pc);
849860 #endif
850861 low += FUNCTION_START_OFFSET;
851862 }
@@ -858,8 +869,9 @@ disassemble_command (char *arg, int from_tty)
858869 #if defined(TUI)
859870 /* NOTE: cagney/2003-02-13 The `tui_active' was previously
860871 `tui_version'. */
861- else if (tui_active)
862- low = tuiGetLowDisassemblyAddress (low, pc);
872+ if (tui_active)
873+ /* FIXME: cagney/2004-02-07: This should be an observer. */
874+ low = tui_get_low_disassembly_address (low, pc);
863875 #endif
864876 low += FUNCTION_START_OFFSET;
865877 }
@@ -920,7 +932,6 @@ make_command (char *arg, int from_tty)
920932 shell_escape (p, from_tty);
921933 }
922934
923-/* ARGSUSED */
924935 static void
925936 show_user (char *args, int from_tty)
926937 {
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -29,6 +29,10 @@
2929 #include "cli/cli-cmds.h"
3030 #include "cli/cli-decode.h"
3131
32+#ifdef TUI
33+#include "tui/tui.h" /* For tui_active et.al. */
34+#endif
35+
3236 #include "gdb_assert.h"
3337
3438 /* Prototypes for local functions */
@@ -133,7 +137,7 @@ struct cmd_list_element *
133137 add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
134138 char *doc, struct cmd_list_element **list)
135139 {
136- register struct cmd_list_element *c
140+ struct cmd_list_element *c
137141 = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
138142 struct cmd_list_element *p;
139143
@@ -212,8 +216,8 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
212216 {
213217 /* Must do this since lookup_cmd tries to side-effect its first arg */
214218 char *copied_name;
215- register struct cmd_list_element *old;
216- register struct cmd_list_element *c;
219+ struct cmd_list_element *old;
220+ struct cmd_list_element *c;
217221 copied_name = (char *) alloca (strlen (oldname) + 1);
218222 strcpy (copied_name, oldname);
219223 old = lookup_cmd (&copied_name, *list, "", 1, 1);
@@ -247,7 +251,7 @@ add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int),
247251 char *prefixname, int allow_unknown,
248252 struct cmd_list_element **list)
249253 {
250- register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
254+ struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
251255 c->prefixlist = prefixlist;
252256 c->prefixname = prefixname;
253257 c->allow_unknown = allow_unknown;
@@ -262,7 +266,7 @@ add_abbrev_prefix_cmd (char *name, enum command_class class,
262266 struct cmd_list_element **prefixlist, char *prefixname,
263267 int allow_unknown, struct cmd_list_element **list)
264268 {
265- register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
269+ struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
266270 c->prefixlist = prefixlist;
267271 c->prefixname = prefixname;
268272 c->allow_unknown = allow_unknown;
@@ -500,10 +504,10 @@ add_show_from_set (struct cmd_list_element *setcmd,
500504 void
501505 delete_cmd (char *name, struct cmd_list_element **list)
502506 {
503- register struct cmd_list_element *c;
507+ struct cmd_list_element *c;
504508 struct cmd_list_element *p;
505509
506- while (*list && STREQ ((*list)->name, name))
510+ while (*list && strcmp ((*list)->name, name) == 0)
507511 {
508512 if ((*list)->hookee_pre)
509513 (*list)->hookee_pre->hook_pre = 0; /* Hook slips out of its mouth */
@@ -517,7 +521,7 @@ delete_cmd (char *name, struct cmd_list_element **list)
517521 if (*list)
518522 for (c = *list; c->next;)
519523 {
520- if (STREQ (c->next->name, name))
524+ if (strcmp (c->next->name, name) == 0)
521525 {
522526 if (c->next->hookee_pre)
523527 c->next->hookee_pre->hook_pre = 0; /* hooked cmd gets away. */
@@ -577,7 +581,7 @@ void
577581 apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
578582 struct re_pattern_buffer *regex, char *prefix)
579583 {
580- register struct cmd_list_element *c;
584+ struct cmd_list_element *c;
581585 int returnvalue=1; /*Needed to avoid double printing*/
582586 /* Walk through the commands */
583587 for (c=commandlist;c;c=c->next)
@@ -786,7 +790,7 @@ print_doc_line (struct ui_file *stream, char *str)
786790 {
787791 static char *line_buffer = 0;
788792 static int line_size;
789- register char *p;
793+ char *p;
790794
791795 if (!line_buffer)
792796 {
@@ -830,7 +834,7 @@ void
830834 help_cmd_list (struct cmd_list_element *list, enum command_class class,
831835 char *prefix, int recurse, struct ui_file *stream)
832836 {
833- register struct cmd_list_element *c;
837+ struct cmd_list_element *c;
834838
835839 for (c = list; c; c = c->next)
836840 {
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -31,7 +31,7 @@
3131 #include "gdb_assert.h"
3232 #include <ctype.h>
3333 #include "target.h"
34-#include <readline/readline.h>
34+#include "readline/readline.h"
3535
3636 #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
3737
@@ -331,36 +331,6 @@ dump_value_command (char *cmd, char *mode)
331331 }
332332
333333 static void
334-dump_filetype (char *cmd, char *mode, char *filetype)
335-{
336- char *suffix = cmd;
337-
338- if (cmd == NULL || *cmd == '\0')
339- error ("Missing subcommand: try 'help %s %s'.",
340- mode[0] == 'a' ? "append" : "dump",
341- filetype);
342-
343- suffix += strcspn (cmd, " \t");
344-
345- if (suffix != cmd)
346- {
347- if (strncmp ("memory", cmd, suffix - cmd) == 0)
348- {
349- dump_memory_to_file (suffix, mode, filetype);
350- return;
351- }
352- else if (strncmp ("value", cmd, suffix - cmd) == 0)
353- {
354- dump_value_to_file (suffix, mode, filetype);
355- return;
356- }
357- }
358-
359- error ("dump %s: unknown subcommand '%s' -- try 'value' or 'memory'.",
360- filetype, cmd);
361-}
362-
363-static void
364334 dump_srec_memory (char *args, int from_tty)
365335 {
366336 dump_memory_to_file (args, FOPEN_WB, "srec");
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -36,9 +36,6 @@
3636
3737 /* Prototypes for local functions */
3838
39-static struct cleanup *
40- make_cleanup_free_command_lines (struct command_line **arg);
41-
4239 static enum command_control_type
4340 recurse_read_control_structure (struct command_line *current_cmd);
4441
@@ -255,7 +252,7 @@ do_restore_user_call_depth (void * call_depth)
255252 void
256253 execute_user_command (struct cmd_list_element *c, char *args)
257254 {
258- register struct command_line *cmdlines;
255+ struct command_line *cmdlines;
259256 struct cleanup *old_chain;
260257 enum command_control_type ret;
261258 static int user_call_depth = 0;
@@ -297,21 +294,25 @@ execute_control_command (struct command_line *cmd)
297294 {
298295 struct expression *expr;
299296 struct command_line *current;
300- struct cleanup *old_chain = 0;
297+ struct cleanup *old_chain = make_cleanup (null_cleanup, 0);
301298 struct value *val;
302299 struct value *val_mark;
303300 int loop;
304301 enum command_control_type ret;
305302 char *new_line;
306303
304+ /* Start by assuming failure, if a problem is detected, the code
305+ below will simply "break" out of the switch. */
306+ ret = invalid_control;
307+
307308 switch (cmd->control_type)
308309 {
309310 case simple_control:
310311 /* A simple command, execute it and return. */
311312 new_line = insert_args (cmd->line);
312313 if (!new_line)
313- return invalid_control;
314- old_chain = make_cleanup (free_current_contents, &new_line);
314+ break;
315+ make_cleanup (free_current_contents, &new_line);
315316 execute_command (new_line, 0);
316317 ret = cmd->control_type;
317318 break;
@@ -328,8 +329,8 @@ execute_control_command (struct command_line *cmd)
328329 /* Parse the loop control expression for the while statement. */
329330 new_line = insert_args (cmd->line);
330331 if (!new_line)
331- return invalid_control;
332- old_chain = make_cleanup (free_current_contents, &new_line);
332+ break;
333+ make_cleanup (free_current_contents, &new_line);
333334 expr = parse_expression (new_line);
334335 make_cleanup (free_current_contents, &expr);
335336
@@ -388,8 +389,8 @@ execute_control_command (struct command_line *cmd)
388389 {
389390 new_line = insert_args (cmd->line);
390391 if (!new_line)
391- return invalid_control;
392- old_chain = make_cleanup (free_current_contents, &new_line);
392+ break;
393+ make_cleanup (free_current_contents, &new_line);
393394 /* Parse the conditional for the if statement. */
394395 expr = parse_expression (new_line);
395396 make_cleanup (free_current_contents, &expr);
@@ -427,11 +428,10 @@ execute_control_command (struct command_line *cmd)
427428
428429 default:
429430 warning ("Invalid control type in command structure.");
430- return invalid_control;
431+ break;
431432 }
432433
433- if (old_chain)
434- do_cleanups (old_chain);
434+ do_cleanups (old_chain);
435435
436436 return ret;
437437 }
@@ -974,8 +974,8 @@ read_command_lines (char *prompt_arg, int from_tty)
974974 void
975975 free_command_lines (struct command_line **lptr)
976976 {
977- register struct command_line *l = *lptr;
978- register struct command_line *next;
977+ struct command_line *l = *lptr;
978+ struct command_line *next;
979979 struct command_line **blist;
980980 int i;
981981
@@ -1001,7 +1001,7 @@ do_free_command_lines_cleanup (void *arg)
10011001 free_command_lines (arg);
10021002 }
10031003
1004-static struct cleanup *
1004+struct cleanup *
10051005 make_cleanup_free_command_lines (struct command_line **arg)
10061006 {
10071007 return make_cleanup (do_free_command_lines_cleanup, arg);
@@ -1040,7 +1040,7 @@ copy_command_lines (struct command_line *cmds)
10401040 static void
10411041 validate_comname (char *comname)
10421042 {
1043- register char *p;
1043+ char *p;
10441044
10451045 if (comname == 0)
10461046 error_no_arg ("name of command to define");
@@ -1070,8 +1070,8 @@ define_command (char *comname, int from_tty)
10701070 CMD_PRE_HOOK,
10711071 CMD_POST_HOOK
10721072 };
1073- register struct command_line *cmds;
1074- register struct cmd_list_element *c, *newc, *oldc, *hookc = 0;
1073+ struct command_line *cmds;
1074+ struct cmd_list_element *c, *newc, *oldc, *hookc = 0;
10751075 char *tem = comname;
10761076 char *tem2;
10771077 char tmpbuf[MAX_TMPBUF];
@@ -1176,7 +1176,7 @@ void
11761176 document_command (char *comname, int from_tty)
11771177 {
11781178 struct command_line *doclines;
1179- register struct cmd_list_element *c;
1179+ struct cmd_list_element *c;
11801180 char *tem = comname;
11811181 char tmpbuf[128];
11821182
@@ -1194,8 +1194,8 @@ document_command (char *comname, int from_tty)
11941194 xfree (c->doc);
11951195
11961196 {
1197- register struct command_line *cl1;
1198- register int len = 0;
1197+ struct command_line *cl1;
1198+ int len = 0;
11991199
12001200 for (cl1 = doclines; cl1; cl1 = cl1->next)
12011201 len += strlen (cl1->line) + 1;
@@ -1233,7 +1233,6 @@ source_cleanup_lines (void *args)
12331233 error_pre_print = p->old_error_pre_print;
12341234 }
12351235
1236-/* ARGSUSED */
12371236 static void
12381237 do_fclose_cleanup (void *stream)
12391238 {
@@ -1290,7 +1289,7 @@ script_from_file (FILE *stream, char *file)
12901289 void
12911290 show_user_1 (struct cmd_list_element *c, struct ui_file *stream)
12921291 {
1293- register struct command_line *cmdlines;
1292+ struct command_line *cmdlines;
12941293
12951294 cmdlines = c->user_commands;
12961295 if (!cmdlines)
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -47,6 +47,8 @@ extern void print_command_lines (struct ui_out *,
4747
4848 extern struct command_line * copy_command_lines (struct command_line *cmds);
4949
50+struct cleanup *make_cleanup_free_command_lines (struct command_line **arg);
51+
5052 /* Exported to gdb/infrun.c */
5153
5254 extern void execute_user_command (struct cmd_list_element *c, char *args);
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -18,7 +18,7 @@
1818 Boston, MA 02111-1307, USA. */
1919
2020 #include "defs.h"
21-#include <readline/tilde.h>
21+#include "readline/tilde.h"
2222 #include "value.h"
2323 #include <ctype.h>
2424 #include "gdb_string.h"