GNU Binutils with patches for OS216
Revision | fc47a10d9bdb9d11e226ea6ac6c90d85416ef9cd (tree) |
---|---|
Zeit | 1991-04-19 10:21:29 |
Autor | John Gilmore <gnu@cygn...> |
Commiter | John Gilmore |
@@ -31,6 +31,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
31 | 31 | |
32 | 32 | extern int memory_insert_breakpoint(), memory_remove_breakpoint(); |
33 | 33 | extern void host_convert_to_virtual(), host_convert_from_virtual(); |
34 | +extern void add_syms_addr_command(); | |
34 | 35 | |
35 | 36 | static void cleanup_target (); |
36 | 37 |
@@ -53,7 +54,8 @@ struct target_ops dummy_target = {"None", "None", | ||
53 | 54 | 0, 0, /* memory */ |
54 | 55 | 0, 0, /* bkpts */ |
55 | 56 | 0, 0, 0, 0, 0, /* terminal */ |
56 | - 0, 0, 0, /* kill, load, add_syms */ | |
57 | + 0, 0, /* kill, load */ | |
58 | + add_syms_addr_command, /* add_syms */ | |
57 | 59 | 0, 0, /* call_function, lookup_symbol */ |
58 | 60 | 0, 0, /* create_inferior, mourn_inferior */ |
59 | 61 | dummy_stratum, 0, /* stratum, next */ |
@@ -491,8 +493,9 @@ target_command (args, from_tty) | ||
491 | 493 | char *args; |
492 | 494 | int from_tty; |
493 | 495 | { |
494 | - int i; | |
496 | + int i, possible; | |
495 | 497 | char *rest; |
498 | + char *argend; | |
496 | 499 | |
497 | 500 | dont_repeat(); |
498 | 501 |
@@ -510,11 +513,11 @@ target_command (args, from_tty) | ||
510 | 513 | |
511 | 514 | /* Skip to first space, or end of args */ |
512 | 515 | for (rest = args; *rest && !isspace(*rest); rest++) ; |
516 | + argend = rest; | |
513 | 517 | if (*rest == '\0') |
514 | 518 | rest = 0; /* Only one word in args */ |
515 | 519 | else |
516 | 520 | { |
517 | - *rest = '\0'; /* Terminate first word, scan for next */ | |
518 | 521 | for (rest++; isspace (*rest); rest++) ; |
519 | 522 | if (*rest == '\0') /* Only one word w/trailing blanks */ |
520 | 523 | rest = 0; |
@@ -522,15 +525,24 @@ target_command (args, from_tty) | ||
522 | 525 | |
523 | 526 | /* Search target list for a match */ |
524 | 527 | |
528 | + possible = -1; | |
525 | 529 | for (i = 0; i < target_struct_size; i++) |
526 | 530 | { |
527 | - if (!strcmp (args, target_structs[i]->to_shortname)) | |
528 | - goto gotit; | |
531 | + if (!strncmp (args, target_structs[i]->to_shortname, argend - args)) { | |
532 | + /* If we have an exact match, it's time to quit. */ | |
533 | + if (target_structs[i]->to_shortname[args-argend] == '\0') { | |
534 | + possible = i; | |
535 | + break; | |
536 | + } | |
537 | + if (possible > 0) | |
538 | + error ("Ambiguous target. `info targets' will list all targets"); | |
539 | + possible = i; | |
540 | + } | |
529 | 541 | } |
530 | - error ("No such target. `info targets' will list all targets"); | |
542 | + if (possible < 0) | |
543 | + error ("No such target. `info targets' will list all targets"); | |
531 | 544 | |
532 | -gotit: | |
533 | - (*target_structs[i]->to_open) (rest, from_tty); | |
545 | + (*target_structs[possible]->to_open) (rest, from_tty); | |
534 | 546 | } |
535 | 547 | |
536 | 548 | static char targ_desc[] = |