This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug mi/10765] Missing prompt and error result record for invalid thread option
- From: "nickrob at snap dot net dot nz" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 14 Oct 2009 00:29:38 -0000
- Subject: [Bug mi/10765] Missing prompt and error result record for invalid thread option
- References: <20091013110609.10765.timo.suoranta@acrodea.co.jp>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From nickrob at snap dot net dot nz 2009-10-14 00:29 -------
Subject: New: Missing prompt and error result record for invalid thread option
timo dot suoranta at acrodea dot co dot jp writes:
> The following incorrectly spelled command does not return gdb prompt nor error
> result record when using mi:
>
> -var-create --thread 1--frame 0 - * red_vec4
> &"Invalid value for the '--thread' option\n"
Yes. I think this patch fixes it and other similar problems.
--
Nick http://users.snap.net.nz/~nickrob
2009-10-14 Nick Roberts <nickrob@snap.net.nz>
* mi/mi-parse.c (error_message): New function.
(mi_parse): Report errors using MI syntax.
*** mi-parse.c 03 Jan 2009 18:57:57 +1300 1.17
--- mi-parse.c 14 Oct 2009 13:24:48 +1300
*************** mi_parse_free (struct mi_parse *parse)
*** 144,149 ****
--- 144,157 ----
xfree (parse);
}
+ static void
+ error_message (struct mi_parse *parse, const char *msg)
+ {
+ fprintf_unfiltered (raw_stdout, "%s^error,msg=\"%s\"\n",
+ parse->token, msg);
+ mi_parse_free (parse);
+
+ }
struct mi_parse *
mi_parse (char *cmd)
*************** mi_parse (char *cmd)
*** 215,228 ****
if (strncmp (chp, "--thread ", ts) == 0)
{
if (parse->thread != -1)
! error ("Duplicate '--thread' option");
chp += ts;
parse->thread = strtol (chp, &chp, 10);
}
else if (strncmp (chp, "--frame ", fs) == 0)
{
if (parse->frame != -1)
! error ("Duplicate '--frame' option");
chp += fs;
parse->frame = strtol (chp, &chp, 10);
}
--- 223,242 ----
if (strncmp (chp, "--thread ", ts) == 0)
{
if (parse->thread != -1)
! {
! error_message (parse, "Duplicate '--thread' option");
! return NULL;
! }
chp += ts;
parse->thread = strtol (chp, &chp, 10);
}
else if (strncmp (chp, "--frame ", fs) == 0)
{
if (parse->frame != -1)
! {
! error_message (parse, "Duplicate '--frame' option");
! return NULL;
! }
chp += fs;
parse->frame = strtol (chp, &chp, 10);
}
*************** mi_parse (char *cmd)
*** 230,237 ****
break;
if (*chp != '\0' && !isspace (*chp))
! error ("Invalid value for the '%s' option",
! start[2] == 't' ? "--thread" : "--frame");
while (isspace (*chp))
chp++;
}
--- 244,258 ----
break;
if (*chp != '\0' && !isspace (*chp))
! {
! /* FIXME: This should be a function call. */
! fprintf_unfiltered
! (raw_stdout,
! "%s^error,msg=\"Invalid value for the '%s' option\"\n",
! parse->token, start[2] == 't' ? "--thread" : "--frame");
! mi_parse_free (parse);
! return NULL;
! }
while (isspace (*chp))
chp++;
}
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10765
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.