2011-02-19 Michael Snyder <msnyder@vmware.com>
* reverse.c (delete_one_bookmark): Argument is now bookmark id rather than pointer to bookmark struct. (delete_bookmark_command): Use get_number_or_range. (goto_bookmark_command): Parse with get_number instead of strtoul. (bookmark_1): New function. Print info for one bookmark. (bookmarks_info): Use get_number_or_range and bookmark_1.
This commit is contained in:
parent
65ebfb52d9
commit
7d357efd13
2 changed files with 61 additions and 33 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2011-02-19 Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
|
* reverse.c (delete_one_bookmark): Argument is now bookmark
|
||||||
|
id rather than pointer to bookmark struct.
|
||||||
|
(delete_bookmark_command): Use get_number_or_range.
|
||||||
|
(goto_bookmark_command): Parse with get_number instead of strtoul.
|
||||||
|
(bookmark_1): New function. Print info for one bookmark.
|
||||||
|
(bookmarks_info): Use get_number_or_range and bookmark_1.
|
||||||
|
|
||||||
2011-02-18 Michael Snyder <msnyder@vmware.com>
|
2011-02-18 Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
* thread.c (info_threads_command): Re-implement using
|
* thread.c (info_threads_command): Re-implement using
|
||||||
|
|
|
@ -173,9 +173,14 @@ save_bookmark_command (char *args, int from_tty)
|
||||||
/* Implement "delete bookmark" command. */
|
/* Implement "delete bookmark" command. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
delete_one_bookmark (struct bookmark *b)
|
delete_one_bookmark (int num)
|
||||||
{
|
{
|
||||||
struct bookmark *b1;
|
struct bookmark *b1, *b;
|
||||||
|
|
||||||
|
/* Find bookmark with corresponding number. */
|
||||||
|
ALL_BOOKMARKS (b)
|
||||||
|
if (b->number == num)
|
||||||
|
break;
|
||||||
|
|
||||||
/* Special case, first item in list. */
|
/* Special case, first item in list. */
|
||||||
if (b == bookmark_chain)
|
if (b == bookmark_chain)
|
||||||
|
@ -215,7 +220,7 @@ static void
|
||||||
delete_bookmark_command (char *args, int from_tty)
|
delete_bookmark_command (char *args, int from_tty)
|
||||||
{
|
{
|
||||||
struct bookmark *b;
|
struct bookmark *b;
|
||||||
unsigned long num;
|
int num;
|
||||||
|
|
||||||
if (bookmark_chain == NULL)
|
if (bookmark_chain == NULL)
|
||||||
{
|
{
|
||||||
|
@ -231,15 +236,13 @@ delete_bookmark_command (char *args, int from_tty)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = strtoul (args, NULL, 0);
|
while (args != NULL && *args != '\0')
|
||||||
/* Find bookmark with corresponding number. */
|
{
|
||||||
ALL_BOOKMARKS (b)
|
num = get_number_or_range (&args);
|
||||||
if (b->number == num)
|
if (!delete_one_bookmark (num))
|
||||||
break;
|
/* Not found. */
|
||||||
|
warning (_("No bookmark #%d."), num);
|
||||||
if (!delete_one_bookmark (b))
|
}
|
||||||
/* Not found. */
|
|
||||||
error (_("delete bookmark: no bookmark found for '%s'."), args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement "goto-bookmark" command. */
|
/* Implement "goto-bookmark" command. */
|
||||||
|
@ -272,7 +275,7 @@ goto_bookmark_command (char *args, int from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General case. Bookmark identified by bookmark number. */
|
/* General case. Bookmark identified by bookmark number. */
|
||||||
num = strtoul (args, NULL, 0);
|
num = get_number (&args);
|
||||||
ALL_BOOKMARKS (b)
|
ALL_BOOKMARKS (b)
|
||||||
if (b->number == num)
|
if (b->number == num)
|
||||||
break;
|
break;
|
||||||
|
@ -287,33 +290,48 @@ goto_bookmark_command (char *args, int from_tty)
|
||||||
error (_("goto-bookmark: no bookmark found for '%s'."), args);
|
error (_("goto-bookmark: no bookmark found for '%s'."), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bookmark_1 (int bnum)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
|
||||||
|
struct bookmark *b;
|
||||||
|
int matched = 0;
|
||||||
|
|
||||||
|
ALL_BOOKMARKS (b)
|
||||||
|
{
|
||||||
|
if (bnum == -1 || bnum == b->number)
|
||||||
|
{
|
||||||
|
printf_filtered (" %d %s '%s'\n",
|
||||||
|
b->number,
|
||||||
|
paddress (gdbarch, b->pc),
|
||||||
|
b->opaque_data);
|
||||||
|
matched++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bnum > 0 && matched == 0)
|
||||||
|
printf_filtered ("No bookmark #%d\n", bnum);
|
||||||
|
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
|
||||||
/* Implement "info bookmarks" command. */
|
/* Implement "info bookmarks" command. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bookmarks_info (char *args, int from_tty)
|
bookmarks_info (char *args, int from_tty)
|
||||||
{
|
{
|
||||||
struct bookmark *b;
|
|
||||||
int bnum = -1;
|
int bnum = -1;
|
||||||
struct gdbarch *gdbarch;
|
|
||||||
|
|
||||||
if (args)
|
|
||||||
bnum = parse_and_eval_long (args);
|
|
||||||
|
|
||||||
if (!bookmark_chain)
|
if (!bookmark_chain)
|
||||||
{
|
printf_filtered (_("No bookmarks.\n"));
|
||||||
printf_filtered (_("No bookmarks.\n"));
|
else if (args == NULL || *args == '\0')
|
||||||
return;
|
bookmark_1 (-1);
|
||||||
}
|
else
|
||||||
|
while (args != NULL && *args != '\0')
|
||||||
gdbarch = get_regcache_arch (get_current_regcache ());
|
{
|
||||||
printf_filtered (_("Bookmark Address Opaque\n"));
|
bnum = get_number_or_range (&args);
|
||||||
printf_filtered (_(" ID Data\n"));
|
bookmark_1 (bnum);
|
||||||
|
}
|
||||||
ALL_BOOKMARKS (b)
|
|
||||||
printf_filtered (" %d %s '%s'\n",
|
|
||||||
b->number,
|
|
||||||
paddress (gdbarch, b->pc),
|
|
||||||
b->opaque_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,7 +388,8 @@ execution history that can be returned to later in the same debug \n\
|
||||||
session."));
|
session."));
|
||||||
add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _("\
|
add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _("\
|
||||||
Delete a bookmark from the bookmark list.\n\
|
Delete a bookmark from the bookmark list.\n\
|
||||||
Argument is a bookmark number, or no argument to delete all bookmarks.\n"),
|
Argument is a bookmark number or numbers,\n\
|
||||||
|
or no argument to delete all bookmarks.\n"),
|
||||||
&deletelist);
|
&deletelist);
|
||||||
add_com ("goto-bookmark", class_bookmark, goto_bookmark_command, _("\
|
add_com ("goto-bookmark", class_bookmark, goto_bookmark_command, _("\
|
||||||
Go to an earlier-bookmarked point in the program's execution history.\n\
|
Go to an earlier-bookmarked point in the program's execution history.\n\
|
||||||
|
|
Loading…
Reference in a new issue