* [RFA2] Follow-up decode_line_1 crash
@ 2001-03-14 8:28 Keith Seitz
2001-03-14 9:48 ` Fernando Nasser
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Keith Seitz @ 2001-03-14 8:28 UTC (permalink / raw)
To: gdb-patches
Problem:
$ gdb -nw -nx -q
(gdb) b "foo"
Segmentation fault (core dumped)
decode_linespec_1 does something like:
char *p = *argptr; (the first quote in "foo")
if (p == '"')
{
p++;
is_quote_enclosed = 1;
}
if (is_quote_enclosed)
{
char *closing_quote = strchr (p, '"');
if (closing_quote && closing_quote[1] == '\0')
*closing_quote = '\0';
}
/* so now p looks like foo with no quotes and *argptr is "foo */
char *copy = (char *) alloca (p - *argptr + 1); <-- alloca of 0 bytes
memcpy (copy, *argptr, p - *argptr); <-- copy -1 bytes
Patch:
Index: linespec.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/linespec.c,v
retrieving revision 2.4
diff -p -p -r2.4 linespec.c
*** linespec.c 2000/12/20 14:34:15 2.4
--- linespec.c 2001/03/14 16:16:11
*************** decode_line_1 (char **argptr, int funfir
*** 611,620 ****
s = NULL;
p = *argptr;
! if (p[0] == '"')
{
is_quote_enclosed = 1;
! p++;
}
else
is_quote_enclosed = 0;
--- 611,620 ----
s = NULL;
p = *argptr;
! if (**argptr == '"')
{
is_quote_enclosed = 1;
! (*argptr)++;
}
else
is_quote_enclosed = 0;
Tested on RH6.2. Should be generic enough to apply to all targets. I'm no
expert at this stuff, but a crash is Just Plain Bad (TM).
Keith
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 8:28 [RFA2] Follow-up decode_line_1 crash Keith Seitz @ 2001-03-14 9:48 ` Fernando Nasser 2001-03-14 10:29 ` Keith Seitz 2001-03-14 10:40 ` Keith Seitz 2001-03-14 12:32 ` Martin M. Hunt 2001-03-15 0:52 ` Eli Zaretskii 2 siblings, 2 replies; 10+ messages in thread From: Fernando Nasser @ 2001-03-14 9:48 UTC (permalink / raw) To: Keith Seitz; +Cc: gdb-patches I have tried it and it looks OK (on Red Hat 7.0). Let's try it. Fernando Keith Seitz wrote: > > Problem: > > $ gdb -nw -nx -q > (gdb) b "foo" > Segmentation fault (core dumped) > > decode_linespec_1 does something like: > > char *p = *argptr; (the first quote in "foo") > if (p == '"') > { > p++; > is_quote_enclosed = 1; > } > > if (is_quote_enclosed) > { > char *closing_quote = strchr (p, '"'); > if (closing_quote && closing_quote[1] == '\0') > *closing_quote = '\0'; > } > > /* so now p looks like foo with no quotes and *argptr is "foo */ > > char *copy = (char *) alloca (p - *argptr + 1); <-- alloca of 0 bytes > memcpy (copy, *argptr, p - *argptr); <-- copy -1 bytes > > Patch: > > Index: linespec.c > =================================================================== > RCS file: /cvs/cvsfiles/devo/gdb/linespec.c,v > retrieving revision 2.4 > diff -p -p -r2.4 linespec.c > *** linespec.c 2000/12/20 14:34:15 2.4 > --- linespec.c 2001/03/14 16:16:11 > *************** decode_line_1 (char **argptr, int funfir > *** 611,620 **** > > s = NULL; > p = *argptr; > ! if (p[0] == '"') > { > is_quote_enclosed = 1; > ! p++; > } > else > is_quote_enclosed = 0; > --- 611,620 ---- > > s = NULL; > p = *argptr; > ! if (**argptr == '"') > { > is_quote_enclosed = 1; > ! (*argptr)++; > } > else > is_quote_enclosed = 0; > > Tested on RH6.2. Should be generic enough to apply to all targets. I'm no > expert at this stuff, but a crash is Just Plain Bad (TM). > > Keith -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 9:48 ` Fernando Nasser @ 2001-03-14 10:29 ` Keith Seitz 2001-03-14 10:31 ` Fernando Nasser 2001-03-14 10:40 ` Keith Seitz 1 sibling, 1 reply; 10+ messages in thread From: Keith Seitz @ 2001-03-14 10:29 UTC (permalink / raw) To: Fernando Nasser; +Cc: gdb-patches > > Patch: > > [snip] I forgot to post the ChangeLog (which probably requires comments): 2001-03-14 Keith Seitz <keiths@cygnus.com> * linespec.c (decode_line_1): Skip argptr over a leading double quote. Prevents alloc of 0 bytes and memcpy of -1 bytes. Keith ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 10:29 ` Keith Seitz @ 2001-03-14 10:31 ` Fernando Nasser 0 siblings, 0 replies; 10+ messages in thread From: Fernando Nasser @ 2001-03-14 10:31 UTC (permalink / raw) To: Keith Seitz; +Cc: gdb-patches Keith Seitz wrote: > > > > Patch: > > > > [snip] > > I forgot to post the ChangeLog (which probably requires comments): > > 2001-03-14 Keith Seitz <keiths@cygnus.com> > > * linespec.c (decode_line_1): Skip argptr over a leading > double quote. Prevents alloc of 0 bytes and memcpy of -1 bytes. > Sounds good. Approved. -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 9:48 ` Fernando Nasser 2001-03-14 10:29 ` Keith Seitz @ 2001-03-14 10:40 ` Keith Seitz 1 sibling, 0 replies; 10+ messages in thread From: Keith Seitz @ 2001-03-14 10:40 UTC (permalink / raw) To: gdb-patches On Wed, 14 Mar 2001, Fernando Nasser wrote: > I have tried it and it looks OK (on Red Hat 7.0). > > Let's try it. I have checked in this patch. Keith ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 8:28 [RFA2] Follow-up decode_line_1 crash Keith Seitz 2001-03-14 9:48 ` Fernando Nasser @ 2001-03-14 12:32 ` Martin M. Hunt 2001-03-15 7:11 ` Fernando Nasser 2001-03-15 0:52 ` Eli Zaretskii 2 siblings, 1 reply; 10+ messages in thread From: Martin M. Hunt @ 2001-03-14 12:32 UTC (permalink / raw) To: Keith Seitz; +Cc: gdb-patches This is really not my area, but I happened to try to decypher this file a few weeks ago. Its full of surprises. for example, starting on line 622, we have for (; *p; p++) { parse stuff ... } /* if the closing double quote was left at the end, remove it */ if (is_quote_enclosed) { char *closing_quote = strchr (p, '"'); if (closing_quote && closing_quote[1] == '\0') *closing_quote = '\0'; } so the for loop parses things until *p == NULL, then looks for the closing quote starting at the NULL?!?? Keith's patch changes 2 things. The first change makes no difference. The second change is to increment the start of the parsed string, which is certainly right. I think it would be better to leave the p++ in. (*argptr)++; p++; I tried fixing the strchr to actually remove the trailing quote and had no test failures on Linux. It is quite possible it messes up something unexpected. Current (with Keith's patch) (top-gdb) b "main" Junk at end of arguments. (top-gdb) b "foo bar.c:602" No source file named foo bar.c. (top-gdb) b "" Segmentation fault With the following patch (top-gdb) b "main" Breakpoint 3 at 0x80832aa: file ../../src/gdb/main.c, line 764. (top-gdb) b "foo bar.c:602" No source file named foo bar.c. (top-gdb) b "" Function "" not defined. (top-gdb) Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.6 diff -p -r1.6 linespec.c *** linespec.c 2001/03/14 18:36:45 1.6 --- linespec.c 2001/03/14 20:15:08 *************** decode_line_1 (char **argptr, int funfir *** 612,621 **** s = NULL; p = *argptr; ! if (**argptr == '"') { is_quote_enclosed = 1; (*argptr)++; } else is_quote_enclosed = 0; --- 612,622 ---- s = NULL; p = *argptr; ! if (p[0] == '"') { is_quote_enclosed = 1; (*argptr)++; + p++; } else is_quote_enclosed = 0; *************** decode_line_1 (char **argptr, int funfir *** 654,660 **** /* if the closing double quote was left at the end, remove it */ if (is_quote_enclosed) { ! char *closing_quote = strchr (p, '"'); if (closing_quote && closing_quote[1] == '\0') *closing_quote = '\0'; } --- 655,661 ---- /* if the closing double quote was left at the end, remove it */ if (is_quote_enclosed) { ! char *closing_quote = strchr (p-1, '"'); if (closing_quote && closing_quote[1] == '\0') *closing_quote = '\0'; } *************** decode_line_1 (char **argptr, int funfir *** 1091,1099 **** { p = skip_quoted (*argptr); } - - if (is_quote_enclosed && **argptr == '"') - (*argptr)++; copy = (char *) alloca (p - *argptr + 1); memcpy (copy, *argptr, p - *argptr); --- 1092,1097 ---- On Wed, 14 Mar 2001, Keith Seitz wrote: > > Problem: > > $ gdb -nw -nx -q > (gdb) b "foo" > Segmentation fault (core dumped) > > decode_linespec_1 does something like: > > char *p = *argptr; (the first quote in "foo") > if (p == '"') > { > p++; > is_quote_enclosed = 1; > } > > if (is_quote_enclosed) > { > char *closing_quote = strchr (p, '"'); > if (closing_quote && closing_quote[1] == '\0') > *closing_quote = '\0'; > } > > /* so now p looks like foo with no quotes and *argptr is "foo */ > > > char *copy = (char *) alloca (p - *argptr + 1); <-- alloca of 0 bytes > memcpy (copy, *argptr, p - *argptr); <-- copy -1 bytes > > Patch: > > Index: linespec.c > =================================================================== > RCS file: /cvs/cvsfiles/devo/gdb/linespec.c,v > retrieving revision 2.4 > diff -p -p -r2.4 linespec.c > *** linespec.c 2000/12/20 14:34:15 2.4 > --- linespec.c 2001/03/14 16:16:11 > *************** decode_line_1 (char **argptr, int funfir > *** 611,620 **** > > s = NULL; > p = *argptr; > ! if (p[0] == '"') > { > is_quote_enclosed = 1; > ! p++; > } > else > is_quote_enclosed = 0; > --- 611,620 ---- > > s = NULL; > p = *argptr; > ! if (**argptr == '"') > { > is_quote_enclosed = 1; > ! (*argptr)++; > } > else > is_quote_enclosed = 0; > > Tested on RH6.2. Should be generic enough to apply to all targets. I'm no > expert at this stuff, but a crash is Just Plain Bad (TM). > > Keith > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 12:32 ` Martin M. Hunt @ 2001-03-15 7:11 ` Fernando Nasser 2001-03-15 8:39 ` Eli Zaretskii 2001-03-15 10:06 ` Martin M. Hunt 0 siblings, 2 replies; 10+ messages in thread From: Fernando Nasser @ 2001-03-15 7:11 UTC (permalink / raw) To: Martin M. Hunt; +Cc: Keith Seitz, gdb-patches Martin, Please check this in as an immediate remedy. We still have to address Eli's issue with quoted '"' that may appear in filenames (can they?). An improvement would be to check the previous character and if it is a '\' do not consider that quote as a second quote. P.S.: I am adding the need of a "testsuite/gdb.base/linespec.exp" and a "testsuite/gdb.c++/linespec2.exp" to the TODO file. "Martin M. Hunt" wrote: > > This is really not my area, but I happened to try to decypher this file > a few weeks ago. Its full of surprises. > > for example, starting on line 622, we have > > for (; *p; p++) > { > parse stuff ... > } > > /* if the closing double quote was left at the end, remove it */ > if (is_quote_enclosed) > { > char *closing_quote = strchr (p, '"'); > if (closing_quote && closing_quote[1] == '\0') > *closing_quote = '\0'; > } > > so the for loop parses things until *p == NULL, then looks for the closing > quote starting at the NULL?!?? > > Keith's patch changes 2 things. The first change makes no difference. > The second change is to increment the start of the parsed string, which is > certainly right. I think it would be better to leave the p++ in. > (*argptr)++; > p++; > > I tried fixing the strchr to actually remove the trailing quote and had no > test failures on Linux. It is quite possible it messes up something > unexpected. > > Current (with Keith's patch) > (top-gdb) b "main" > Junk at end of arguments. > (top-gdb) b "foo bar.c:602" > No source file named foo bar.c. > (top-gdb) b "" > Segmentation fault > > With the following patch > (top-gdb) b "main" > Breakpoint 3 at 0x80832aa: file ../../src/gdb/main.c, line 764. > (top-gdb) b "foo bar.c:602" > No source file named foo bar.c. > (top-gdb) b "" > Function "" not defined. > (top-gdb) > > Index: linespec.c > =================================================================== > RCS file: /cvs/src/src/gdb/linespec.c,v > retrieving revision 1.6 > diff -p -r1.6 linespec.c > *** linespec.c 2001/03/14 18:36:45 1.6 > --- linespec.c 2001/03/14 20:15:08 > *************** decode_line_1 (char **argptr, int funfir > *** 612,621 **** > > s = NULL; > p = *argptr; > ! if (**argptr == '"') > { > is_quote_enclosed = 1; > (*argptr)++; > } > else > is_quote_enclosed = 0; > --- 612,622 ---- > > s = NULL; > p = *argptr; > ! if (p[0] == '"') > { > is_quote_enclosed = 1; > (*argptr)++; > + p++; > } > else > is_quote_enclosed = 0; > *************** decode_line_1 (char **argptr, int funfir > *** 654,660 **** > /* if the closing double quote was left at the end, remove it */ > if (is_quote_enclosed) > { > ! char *closing_quote = strchr (p, '"'); > if (closing_quote && closing_quote[1] == '\0') > *closing_quote = '\0'; > } > --- 655,661 ---- > /* if the closing double quote was left at the end, remove it */ > if (is_quote_enclosed) > { > ! char *closing_quote = strchr (p-1, '"'); > if (closing_quote && closing_quote[1] == '\0') > *closing_quote = '\0'; > } > *************** decode_line_1 (char **argptr, int funfir > *** 1091,1099 **** > { > p = skip_quoted (*argptr); > } > - > - if (is_quote_enclosed && **argptr == '"') > - (*argptr)++; > > copy = (char *) alloca (p - *argptr + 1); > memcpy (copy, *argptr, p - *argptr); > --- 1092,1097 ---- > > On Wed, 14 Mar 2001, Keith Seitz wrote: > > > > > Problem: > > > > $ gdb -nw -nx -q > > (gdb) b "foo" > > Segmentation fault (core dumped) > > > > decode_linespec_1 does something like: > > > > char *p = *argptr; (the first quote in "foo") > > if (p == '"') > > { > > p++; > > is_quote_enclosed = 1; > > } > > > > if (is_quote_enclosed) > > { > > char *closing_quote = strchr (p, '"'); > > if (closing_quote && closing_quote[1] == '\0') > > *closing_quote = '\0'; > > } > > > > /* so now p looks like foo with no quotes and *argptr is "foo */ > > > > > > char *copy = (char *) alloca (p - *argptr + 1); <-- alloca of 0 bytes > > memcpy (copy, *argptr, p - *argptr); <-- copy -1 bytes > > > > Patch: > > > > Index: linespec.c > > =================================================================== > > RCS file: /cvs/cvsfiles/devo/gdb/linespec.c,v > > retrieving revision 2.4 > > diff -p -p -r2.4 linespec.c > > *** linespec.c 2000/12/20 14:34:15 2.4 > > --- linespec.c 2001/03/14 16:16:11 > > *************** decode_line_1 (char **argptr, int funfir > > *** 611,620 **** > > > > s = NULL; > > p = *argptr; > > ! if (p[0] == '"') > > { > > is_quote_enclosed = 1; > > ! p++; > > } > > else > > is_quote_enclosed = 0; > > --- 611,620 ---- > > > > s = NULL; > > p = *argptr; > > ! if (**argptr == '"') > > { > > is_quote_enclosed = 1; > > ! (*argptr)++; > > } > > else > > is_quote_enclosed = 0; > > > > Tested on RH6.2. Should be generic enough to apply to all targets. I'm no > > expert at this stuff, but a crash is Just Plain Bad (TM). > > > > Keith > > > > -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-15 7:11 ` Fernando Nasser @ 2001-03-15 8:39 ` Eli Zaretskii 2001-03-15 10:06 ` Martin M. Hunt 1 sibling, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2001-03-15 8:39 UTC (permalink / raw) To: Fernando Nasser; +Cc: Martin M. Hunt, Keith Seitz, gdb-patches On Thu, 15 Mar 2001, Fernando Nasser wrote: > We still have to address Eli's issue with quoted '"' that may appear in > filenames (can they?). On Unix, sure they can. DOS and Windows specifically disallow " from appearing in a file name. I agree that plumbing the immediate bug, even without resoolving the case of '"', is the right thing to do, because a quote in a file name is a very rare case, even more rare than a space. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-15 7:11 ` Fernando Nasser 2001-03-15 8:39 ` Eli Zaretskii @ 2001-03-15 10:06 ` Martin M. Hunt 1 sibling, 0 replies; 10+ messages in thread From: Martin M. Hunt @ 2001-03-15 10:06 UTC (permalink / raw) To: Fernando Nasser; +Cc: gdb-patches OK. Checked in now. On Thu, 15 Mar 2001, Fernando Nasser wrote: > Martin, > > Please check this in as an immediate remedy. > > We still have to address Eli's issue with quoted '"' that may appear in > filenames (can they?). > > An improvement would be to check the previous character and if it is a > '\' do not consider that quote as a second quote. > > P.S.: I am adding the need of a "testsuite/gdb.base/linespec.exp" and a > "testsuite/gdb.c++/linespec2.exp" to the TODO file. > > > > "Martin M. Hunt" wrote: > > > > This is really not my area, but I happened to try to decypher this file > > a few weeks ago. Its full of surprises. > > > > for example, starting on line 622, we have > > > > for (; *p; p++) > > { > > parse stuff ... > > } > > > > /* if the closing double quote was left at the end, remove it */ > > if (is_quote_enclosed) > > { > > char *closing_quote = strchr (p, '"'); > > if (closing_quote && closing_quote[1] == '\0') > > *closing_quote = '\0'; > > } > > > > so the for loop parses things until *p == NULL, then looks for the closing > > quote starting at the NULL?!?? > > > > Keith's patch changes 2 things. The first change makes no difference. > > The second change is to increment the start of the parsed string, which is > > certainly right. I think it would be better to leave the p++ in. > > (*argptr)++; > > p++; > > > > I tried fixing the strchr to actually remove the trailing quote and had no > > test failures on Linux. It is quite possible it messes up something > > unexpected. > > > > Current (with Keith's patch) > > (top-gdb) b "main" > > Junk at end of arguments. > > (top-gdb) b "foo bar.c:602" > > No source file named foo bar.c. > > (top-gdb) b "" > > Segmentation fault > > > > With the following patch > > (top-gdb) b "main" > > Breakpoint 3 at 0x80832aa: file ../../src/gdb/main.c, line 764. > > (top-gdb) b "foo bar.c:602" > > No source file named foo bar.c. > > (top-gdb) b "" > > Function "" not defined. > > (top-gdb) > > > > Index: linespec.c > > =================================================================== > > RCS file: /cvs/src/src/gdb/linespec.c,v > > retrieving revision 1.6 > > diff -p -r1.6 linespec.c > > *** linespec.c 2001/03/14 18:36:45 1.6 > > --- linespec.c 2001/03/14 20:15:08 > > *************** decode_line_1 (char **argptr, int funfir > > *** 612,621 **** > > > > s = NULL; > > p = *argptr; > > ! if (**argptr == '"') > > { > > is_quote_enclosed = 1; > > (*argptr)++; > > } > > else > > is_quote_enclosed = 0; > > --- 612,622 ---- > > > > s = NULL; > > p = *argptr; > > ! if (p[0] == '"') > > { > > is_quote_enclosed = 1; > > (*argptr)++; > > + p++; > > } > > else > > is_quote_enclosed = 0; > > *************** decode_line_1 (char **argptr, int funfir > > *** 654,660 **** > > /* if the closing double quote was left at the end, remove it */ > > if (is_quote_enclosed) > > { > > ! char *closing_quote = strchr (p, '"'); > > if (closing_quote && closing_quote[1] == '\0') > > *closing_quote = '\0'; > > } > > --- 655,661 ---- > > /* if the closing double quote was left at the end, remove it */ > > if (is_quote_enclosed) > > { > > ! char *closing_quote = strchr (p-1, '"'); > > if (closing_quote && closing_quote[1] == '\0') > > *closing_quote = '\0'; > > } > > *************** decode_line_1 (char **argptr, int funfir > > *** 1091,1099 **** > > { > > p = skip_quoted (*argptr); > > } > > - > > - if (is_quote_enclosed && **argptr == '"') > > - (*argptr)++; > > > > copy = (char *) alloca (p - *argptr + 1); > > memcpy (copy, *argptr, p - *argptr); > > --- 1092,1097 ---- > > > > On Wed, 14 Mar 2001, Keith Seitz wrote: > > > > > > > > Problem: > > > > > > $ gdb -nw -nx -q > > > (gdb) b "foo" > > > Segmentation fault (core dumped) > > > > > > decode_linespec_1 does something like: > > > > > > char *p = *argptr; (the first quote in "foo") > > > if (p == '"') > > > { > > > p++; > > > is_quote_enclosed = 1; > > > } > > > > > > if (is_quote_enclosed) > > > { > > > char *closing_quote = strchr (p, '"'); > > > if (closing_quote && closing_quote[1] == '\0') > > > *closing_quote = '\0'; > > > } > > > > > > /* so now p looks like foo with no quotes and *argptr is "foo */ > > > > > > > > > char *copy = (char *) alloca (p - *argptr + 1); <-- alloca of 0 bytes > > > memcpy (copy, *argptr, p - *argptr); <-- copy -1 bytes > > > > > > Patch: > > > > > > Index: linespec.c > > > =================================================================== > > > RCS file: /cvs/cvsfiles/devo/gdb/linespec.c,v > > > retrieving revision 2.4 > > > diff -p -p -r2.4 linespec.c > > > *** linespec.c 2000/12/20 14:34:15 2.4 > > > --- linespec.c 2001/03/14 16:16:11 > > > *************** decode_line_1 (char **argptr, int funfir > > > *** 611,620 **** > > > > > > s = NULL; > > > p = *argptr; > > > ! if (p[0] == '"') > > > { > > > is_quote_enclosed = 1; > > > ! p++; > > > } > > > else > > > is_quote_enclosed = 0; > > > --- 611,620 ---- > > > > > > s = NULL; > > > p = *argptr; > > > ! if (**argptr == '"') > > > { > > > is_quote_enclosed = 1; > > > ! (*argptr)++; > > > } > > > else > > > is_quote_enclosed = 0; > > > > > > Tested on RH6.2. Should be generic enough to apply to all targets. I'm no > > > expert at this stuff, but a crash is Just Plain Bad (TM). > > > > > > Keith > > > > > > > > -- > Fernando Nasser > Red Hat Canada Ltd. E-Mail: fnasser@redhat.com > 2323 Yonge Street, Suite #300 > Toronto, Ontario M4P 2C9 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFA2] Follow-up decode_line_1 crash 2001-03-14 8:28 [RFA2] Follow-up decode_line_1 crash Keith Seitz 2001-03-14 9:48 ` Fernando Nasser 2001-03-14 12:32 ` Martin M. Hunt @ 2001-03-15 0:52 ` Eli Zaretskii 2 siblings, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2001-03-15 0:52 UTC (permalink / raw) To: Keith Seitz; +Cc: gdb-patches On Wed, 14 Mar 2001, Keith Seitz wrote: > *** linespec.c 2000/12/20 14:34:15 2.4 > --- linespec.c 2001/03/14 16:16:11 > *************** decode_line_1 (char **argptr, int funfir > *** 611,620 **** > > s = NULL; > p = *argptr; > ! if (p[0] == '"') > { > is_quote_enclosed = 1; > ! p++; > } > else > is_quote_enclosed = 0; > --- 611,620 ---- > > s = NULL; > p = *argptr; > ! if (**argptr == '"') > { > is_quote_enclosed = 1; > ! (*argptr)++; > } > else > is_quote_enclosed = 0; Can the argument have embedded (escaped) quotes, as in "foo\"bar", in some language? If it can, the search for the next quote is certainly not the right thing to do. One situation where this could happen is when a breakpoint uses the file:line notation, since file names could have embedded quotes. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2001-03-15 10:06 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-03-14 8:28 [RFA2] Follow-up decode_line_1 crash Keith Seitz 2001-03-14 9:48 ` Fernando Nasser 2001-03-14 10:29 ` Keith Seitz 2001-03-14 10:31 ` Fernando Nasser 2001-03-14 10:40 ` Keith Seitz 2001-03-14 12:32 ` Martin M. Hunt 2001-03-15 7:11 ` Fernando Nasser 2001-03-15 8:39 ` Eli Zaretskii 2001-03-15 10:06 ` Martin M. Hunt 2001-03-15 0:52 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox