* [U-Boot-Users] parser problem?
@ 2005-06-13 3:47 Andrew Dyer
2005-06-13 7:23 ` Wolfgang Denk
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Dyer @ 2005-06-13 3:47 UTC (permalink / raw)
To: u-boot
I noticed on my board that if I enter a space and then return at the
u-boot command line I get an exception. I using u-boot from cvs and
the standard (not hush) parser on a mips platform.
Does anybody else see this behaviour?
--
Hardware, n.:
The parts of a computer system that can be kicked.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] parser problem?
2005-06-13 3:47 [U-Boot-Users] parser problem? Andrew Dyer
@ 2005-06-13 7:23 ` Wolfgang Denk
2005-06-13 15:49 ` [U-Boot-Users] PATCH: fix parser problem with whitespace command line Andrew Dyer
0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2005-06-13 7:23 UTC (permalink / raw)
To: u-boot
In message <c166aa9f05061220474bc0d039@mail.gmail.com> you wrote:
> I noticed on my board that if I enter a space and then return at the
> u-boot command line I get an exception. I using u-boot from cvs and
> the standard (not hush) parser on a mips platform.
> Does anybody else see this behaviour?
You should see a "Unknown command '<NULL>' - try 'help'" error message.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As in certain cults it is possible to kill a process if you know its
true name. -- Ken Thompson and Dennis M. Ritchie
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] PATCH: fix parser problem with whitespace command line
2005-06-13 7:23 ` Wolfgang Denk
@ 2005-06-13 15:49 ` Andrew Dyer
2006-03-12 1:21 ` Wolfgang Denk
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Dyer @ 2005-06-13 15:49 UTC (permalink / raw)
To: u-boot
On 6/13/05, Wolfgang Denk <wd@denx.de> wrote:
> In message <c166aa9f05061220474bc0d039@mail.gmail.com> you wrote:
> > I noticed on my board that if I enter a space and then return at the
> > u-boot command line I get an exception. I using u-boot from cvs and
> > the standard (not hush) parser on a mips platform.
> > Does anybody else see this behaviour?
>
> You should see a "Unknown command '<NULL>' - try 'help'" error message.
Did you try it?
I dug a bit more and what I found was that in run_command() the parse_line()
function eats the leading whitespace then doesn't see anything it recognizes,
so sets argv[0] to NULL and returns a zero. The null pointer gets passed to
find_cmd() which happily dereferences it and the cpu throws an exception.
Below is the output of main with DEBUG_PARSER turned on (and a printf
of argc and *argv I added before the call to find_cmd():
AMR boot#
[RUN_COMMAND] cmd[83ff8bc0]=" "
[PROCESS_SEPARATORS]
token: " "
[PROCESS_MACROS] INPUT len 1: " "
[PROCESS_MACROS] OUTPUT len 1: " "
parse_line: " "
parse_line: nargs=0
argc 0
*argv 0
Unhandled exception
$ 0 : 00000000 b1100000 00000000 00000004
$ 4 : 83ff2748 83eefb78 0000000a fffffffb
$ 8 : ffffffff 83eefb7e 00000002 00000000
$12 : 00000000 00000000 83ff6d10 00000020
$16 : 83eefcb8 00000000 83eefcb9 83eefdb8
$20 : 00000000 00000000 83eefeb8 00000001
$24 : 3afe5cff 83feff2c
$28 : 83ff8050 83eefca0 281925aa 83fdb130
Hi : 00000001
Lo : 00000000
epc : 83fdb144 ra : 83fdb130 Status: 00400002 KERNEL EXL
Cause : 00800008
BadVA : 00000000
PrId : 03030200
Attached is a fix which checks if the value of argc is zero before
calling find_cmd()
and continues.
CHANGELOG:
* Patch by Andrew Dyer, 13 June2005:
add test to see if no valid commands were found in input string before
passing string
to find_cmd()
--
Hardware, n.:
The parts of a computer system that can be kicked.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: uboot-space-command.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20050613/efe3a329/attachment.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] PATCH: fix parser problem with whitespace command line
2005-06-13 15:49 ` [U-Boot-Users] PATCH: fix parser problem with whitespace command line Andrew Dyer
@ 2006-03-12 1:21 ` Wolfgang Denk
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2006-03-12 1:21 UTC (permalink / raw)
To: u-boot
In message <c166aa9f0506130849953de3f@mail.gmail.com> you wrote:
>
> * Patch by Andrew Dyer, 13 June2005:
> add test to see if no valid commands were found in input string before
> passing string
> to find_cmd()
Added, thanks.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I didn't know it was impossible when I did it."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-12 1:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-13 3:47 [U-Boot-Users] parser problem? Andrew Dyer
2005-06-13 7:23 ` Wolfgang Denk
2005-06-13 15:49 ` [U-Boot-Users] PATCH: fix parser problem with whitespace command line Andrew Dyer
2006-03-12 1:21 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox