Commit Graph

38 Commits

Author SHA1 Message Date
Chieh-Min Wang
816be268be [console] support background command execution
Launch a thread to execute commands when the last argument is ampersand

Signed-off-by: Chieh-Min Wang <cmwang@google.com>
2025-07-09 23:12:51 -07:00
Travis Geiselbrecht
baaa474628 [console][help] dont print command blocks if no commands are available
When in crash mode, a lot of the commands are unavailable, so delay
printing the command block header until the first unmasked command is
printed.
2024-08-09 19:50:27 -07:00
Joshua Seaton
f10d685722 [console] List commands alphabetically by name in normal mode
This change updates the `help` console command to list the available
commands alphabetically, but only when we're not panicking. This makes
`help`'s helping more helpful.
2024-08-09 19:41:54 -07:00
Aaron Odell
af844a2ff6 [lib][console] Add an unsigned long long to console_cmd_args
Add and populate an unsigned long long element in the console_cmd_args
struct. This enables handling of 64 bit values on 32 bit targets.
2023-04-23 17:34:49 -07:00
Travis Geiselbrecht
89f9805277 [lib][console] move the state of the console into an object
This will allow in the future multiple instances of it to be active at
at a time. Place the current console in a new TLS slot per thread so
threads created as a side effect of console commands can properly run
commands.
2021-05-29 00:52:47 -07:00
Travis Geiselbrecht
4edb93adde [lib][console] rename some console command types to be prefixed with console_
Some of the structures, notably 'cmd', in the lib console stuff are a
little too generically named and have collided with some other code
so prefix the names a bit more cleanly with console_

The change is largely mechanical, and folks with out of tree code can
easily switch by renaming:
cmd -> console_cmd
cmd_args -> console_cmd_args
cmd_block -> console_cmd_block
console_cmd -> console_cmd_func

Apologies if this breaks you but it should be pretty easy to fix.
2020-07-25 15:59:58 -07:00
Travis Geiselbrecht
ca800ac932 [console] move the history buffer into static memory, remove console_init
No need to malloc this memory if it's always going to be initialized
anyway. Add history disabling switch to a few targets to make sure both
builds are tested.
2020-05-17 16:13:45 -07:00
Travis Geiselbrecht
0175e27ac5 [console] move the command blocks into ro memory
Nothing was using console_register_commands so just move the command
block into a read only section. Remove the linked list stuff but add a
block name to print in its place.
2020-05-17 15:59:04 -07:00
Travis Geiselbrecht
d3d22d68a5 [lib][console] switch the console commands to __start __stop style symbols 2020-05-15 00:03:14 -07:00
Travis Geiselbrecht
6cb02526b7 [include][console] split lib/console.h into two
TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
2019-07-13 16:56:33 -07:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Girts Folkmanis
fc611a8fda [lib/console] add "repeat" command.
Adds a repeat command with the following syntax:
  repeat <times> <delay in ms> <argv0> [<argv1> ...]
2016-09-30 10:38:10 -07:00
Travis Geiselbrecht
2eb32a4369 [style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.

Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
2016-02-14 12:24:01 -08:00
Travis Geiselbrecht
a7496980c0 [lib][stdio] fix the build after -fbuiltin and io changes 2016-02-07 16:05:46 -08:00
Travis Geiselbrecht
244ed17c40 [lib][debug] have the panic shell return a pointer, disable the shell if unimplemented 2016-02-07 16:05:46 -08:00
Travis Geiselbrecht
38f20ec0a1 [lib][console] add pointer type arg, switch some users to it.
Patch courtesy Erik Corry
2015-10-19 12:49:20 -07:00
Gurjant Kalsi
dc1bfa8e30 [style][console][panic shell] Autoformatted console code. 2015-10-12 16:44:56 -07:00
Gurjant Kalsi
dc079d7327 [console][uart][shell] Created a crash-time shell and a polling based UART driver to use on panic. 2015-10-12 16:38:51 -07:00
Sergio Rodriguez
f943e7593c [lib][console] Modifying console for x86-64
Adding an 8 byte alignment to fix a problem with the console and app
section elements being unaligned. Will need a better fix eventually.
2014-12-11 19:21:46 -08:00
Shreyas Nagaraj
78c4eee1c8 [arch][x86-64] MMU enabling 2014-12-11 19:21:33 -08:00
Chris Anderson
283884daa3 [console] Change backspace usages to \b 2014-06-26 19:25:27 -07:00
Travis Geiselbrecht
605bf6e2d5 [lib][console] switch the integer args to long types 2014-03-11 21:04:20 -07:00
Dima Zavin
e8a9b4b7a4 [libc] move tracing out of debug into separate trace.h
Change-Id: I7476fc17b587a0ea2a42cbe3d49b72063e4c5dc8
Signed-off-by: Dima Zavin <dima@android.com>
2013-08-05 10:04:29 -07:00
Travis Geiselbrecht
75745e0758 [lib][console] add echo command
echo off stops command line echoing. Nicer if you're trying to
drive the command line from a script.
2013-07-31 12:12:07 -07:00
Travis Geiselbrecht
4979cce3d5 [lib][console] Reduce stack size requirement for console apps
- Move args array (256 byte) off stack
- check memory allocation results
- make max number of args #defined
- also free debug buffer
2013-07-31 12:12:01 -07:00
Travis Geiselbrecht
98b4e0938e [make] rename DEBUGLEVEL -> LK_DEBUGLEVEL, remove DEBUG define
-Remove top level DEBUG=<N> define
-Rename DEBUGLEVEL to LK_DEBUGLEVEL to be clear.
-Fix the places that used DEBUGLEVEL and the few spots that #ifdef
on DEBUG.
2013-06-07 22:27:00 -07:00
Travis Geiselbrecht
7e9fa038c3 [libc] fixup users of newly modified stdio routines 2013-05-24 20:51:37 -07:00
Travis Geiselbrecht
9b961b4a34 [lib] run all of lib and include through astyle 2012-10-31 21:47:17 -07:00
Travis Geiselbrecht
c97291c7a3 [lib][console] kill some old warnings 2012-10-13 21:28:17 -07:00
Chris Anderson
134e07a45f [console] change mutex allocation to calloc
During a standard boot command_lock receives the same address
each time and in the case of reset this means it will fail the
mutex check. Changing to calloc ensures the state has been cleared
on reset.
2012-10-07 11:38:32 -07:00
Travis Geiselbrecht
5c8b5da7fd [lib][console] set console line length to 128 (from 512) 2012-05-23 13:47:23 -07:00
Travis Geiselbrecht
d63cbe77ad [lib][console] add overridable switch to turn off console history
set DEFINES += CONSOLE_ENABLE_HISTORY=0 in a rules.mk
2012-05-23 13:44:34 -07:00
Travis Geiselbrecht
b1da117fdd [lib] remove assert.h from debug.h, which clears up an order of inclusion problem 2012-04-23 15:52:30 -07:00
Travis Geiselbrecht
3517ac5c35 [debug] change the dgetc signature to match external sources 2009-06-28 11:12:40 -07:00
Travis Geiselbrecht
967d05f24a [console] synchronize with external sources 2009-06-28 11:05:41 -07:00
Travis Geiselbrecht
0166fb2d09 move app/console to lib/console 2009-01-24 20:12:52 -08:00