/*1* Kernel Debugger Architecture Independent Console I/O handler2*3* This file is subject to the terms and conditions of the GNU General Public4* License. See the file "COPYING" in the main directory of this archive5* for more details.6*7* Copyright (c) 1999-2006 Silicon Graphics, Inc. All Rights Reserved.8* Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.9*/1011#include <linux/types.h>12#include <linux/ctype.h>13#include <linux/kernel.h>14#include <linux/init.h>15#include <linux/kdev_t.h>16#include <linux/console.h>17#include <linux/string.h>18#include <linux/sched.h>19#include <linux/smp.h>20#include <linux/nmi.h>21#include <linux/delay.h>22#include <linux/kgdb.h>23#include <linux/kdb.h>24#include <linux/kallsyms.h>25#include "kdb_private.h"2627#define CMD_BUFLEN 25628char kdb_prompt_str[CMD_BUFLEN];2930int kdb_trap_printk;31int kdb_printf_cpu = -1;3233static int kgdb_transition_check(char *buffer)34{35if (buffer[0] != '+' && buffer[0] != '$') {36KDB_STATE_SET(KGDB_TRANS);37kdb_printf("%s", buffer);38} else {39int slen = strlen(buffer);40if (slen > 3 && buffer[slen - 3] == '#') {41kdb_gdb_state_pass(buffer);42strcpy(buffer, "kgdb");43KDB_STATE_SET(DOING_KGDB);44return 1;45}46}47return 0;48}4950/**51* kdb_handle_escape() - validity check on an accumulated escape sequence.52* @buf: Accumulated escape characters to be examined. Note that buf53* is not a string, it is an array of characters and need not be54* nil terminated.55* @sz: Number of accumulated escape characters.56*57* Return: -1 if the escape sequence is unwanted, 0 if it is incomplete,58* otherwise it returns a mapped key value to pass to the upper layers.59*/60static int kdb_handle_escape(char *buf, size_t sz)61{62char *lastkey = buf + sz - 1;6364switch (sz) {65case 1:66if (*lastkey == '\e')67return 0;68break;6970case 2: /* \e<something> */71if (*lastkey == '[')72return 0;73break;7475case 3:76switch (*lastkey) {77case 'A': /* \e[A, up arrow */78return 16;79case 'B': /* \e[B, down arrow */80return 14;81case 'C': /* \e[C, right arrow */82return 6;83case 'D': /* \e[D, left arrow */84return 2;85case '1': /* \e[<1,3,4>], may be home, del, end */86case '3':87case '4':88return 0;89}90break;9192case 4:93if (*lastkey == '~') {94switch (buf[2]) {95case '1': /* \e[1~, home */96return 1;97case '3': /* \e[3~, del */98return 4;99case '4': /* \e[4~, end */100return 5;101}102}103break;104}105106return -1;107}108109/**110* kdb_getchar() - Read a single character from a kdb console (or consoles).111*112* Other than polling the various consoles that are currently enabled,113* most of the work done in this function is dealing with escape sequences.114*115* An escape key could be the start of a vt100 control sequence such as \e[D116* (left arrow) or it could be a character in its own right. The standard117* method for detecting the difference is to wait for 2 seconds to see if there118* are any other characters. kdb is complicated by the lack of a timer service119* (interrupts are off), by multiple input sources. Escape sequence processing120* has to be done as states in the polling loop.121*122* Return: The key pressed or a control code derived from an escape sequence.123*/124char kdb_getchar(void)125{126#define ESCAPE_UDELAY 1000127#define ESCAPE_DELAY (2*1000000/ESCAPE_UDELAY) /* 2 seconds worth of udelays */128char buf[4]; /* longest vt100 escape sequence is 4 bytes */129char *pbuf = buf;130int escape_delay = 0;131get_char_func *f, *f_prev = NULL;132int key;133static bool last_char_was_cr;134135for (f = &kdb_poll_funcs[0]; ; ++f) {136if (*f == NULL) {137/* Reset NMI watchdog once per poll loop */138touch_nmi_watchdog();139f = &kdb_poll_funcs[0];140}141142key = (*f)();143if (key == -1) {144if (escape_delay) {145udelay(ESCAPE_UDELAY);146if (--escape_delay == 0)147return '\e';148}149continue;150}151152/*153* The caller expects that newlines are either CR or LF. However154* some terminals send _both_ CR and LF. Avoid having to handle155* this in the caller by stripping the LF if we saw a CR right156* before.157*/158if (last_char_was_cr && key == '\n') {159last_char_was_cr = false;160continue;161}162last_char_was_cr = (key == '\r');163164/*165* When the first character is received (or we get a change166* input source) we set ourselves up to handle an escape167* sequences (just in case).168*/169if (f_prev != f) {170f_prev = f;171pbuf = buf;172escape_delay = ESCAPE_DELAY;173}174175*pbuf++ = key;176key = kdb_handle_escape(buf, pbuf - buf);177if (key < 0) /* no escape sequence; return best character */178return buf[pbuf - buf == 2 ? 1 : 0];179if (key > 0)180return key;181}182183unreachable();184}185186/**187* kdb_position_cursor() - Place cursor in the correct horizontal position188* @prompt: Nil-terminated string containing the prompt string189* @buffer: Nil-terminated string containing the entire command line190* @cp: Cursor position, pointer the character in buffer where the cursor191* should be positioned.192*193* The cursor is positioned by sending a carriage-return and then printing194* the content of the line until we reach the correct cursor position.195*196* There is some additional fine detail here.197*198* Firstly, even though kdb_printf() will correctly format zero-width fields199* we want the second call to kdb_printf() to be conditional. That keeps things200* a little cleaner when LOGGING=1.201*202* Secondly, we can't combine everything into one call to kdb_printf() since203* that renders into a fixed length buffer and the combined print could result204* in unwanted truncation.205*/206static void kdb_position_cursor(char *prompt, char *buffer, char *cp)207{208kdb_printf("\r%s", prompt);209if (cp > buffer)210kdb_printf("%.*s", (int)(cp - buffer), buffer);211}212213/*214* kdb_read215*216* This function reads a string of characters, terminated by217* a newline, or by reaching the end of the supplied buffer,218* from the current kernel debugger console device.219* Parameters:220* buffer - Address of character buffer to receive input characters.221* bufsize - size, in bytes, of the character buffer222* Returns:223* Returns a pointer to the buffer containing the received224* character string. This string will be terminated by a225* newline character.226* Locking:227* No locks are required to be held upon entry to this228* function. It is not reentrant - it relies on the fact229* that while kdb is running on only one "master debug" cpu.230* Remarks:231* The buffer size must be >= 2.232*/233234static char *kdb_read(char *buffer, size_t bufsize)235{236char *cp = buffer;237char *bufend = buffer+bufsize-2; /* Reserve space for newline238* and null byte */239char *lastchar;240char *p_tmp;241char tmp;242static char tmpbuffer[CMD_BUFLEN];243int len = strlen(buffer);244int len_tmp;245int tab = 0;246int count;247int i;248int diag, dtab_count;249int key, ret;250251diag = kdbgetintenv("DTABCOUNT", &dtab_count);252if (diag)253dtab_count = 30;254255if (len > 0) {256cp += len;257if (*(buffer+len-1) == '\n')258cp--;259}260261lastchar = cp;262*cp = '\0';263kdb_printf("%s", buffer);264poll_again:265key = kdb_getchar();266if (key != 9)267tab = 0;268switch (key) {269case 8: /* backspace */270if (cp > buffer) {271memmove(cp-1, cp, lastchar - cp + 1);272lastchar--;273cp--;274kdb_printf("\b%s ", cp);275kdb_position_cursor(kdb_prompt_str, buffer, cp);276}277break;278case 10: /* linefeed */279case 13: /* carriage return */280*lastchar++ = '\n';281*lastchar++ = '\0';282if (!KDB_STATE(KGDB_TRANS)) {283KDB_STATE_SET(KGDB_TRANS);284kdb_printf("%s", buffer);285}286kdb_printf("\n");287return buffer;288case 4: /* Del */289if (cp < lastchar) {290memmove(cp, cp+1, lastchar - cp);291lastchar--;292kdb_printf("%s ", cp);293kdb_position_cursor(kdb_prompt_str, buffer, cp);294}295break;296case 1: /* Home */297if (cp > buffer) {298cp = buffer;299kdb_position_cursor(kdb_prompt_str, buffer, cp);300}301break;302case 5: /* End */303if (cp < lastchar) {304kdb_printf("%s", cp);305cp = lastchar;306}307break;308case 2: /* Left */309if (cp > buffer) {310kdb_printf("\b");311--cp;312}313break;314case 14: /* Down */315case 16: /* Up */316kdb_printf("\r%*c\r",317(int)(strlen(kdb_prompt_str) + (lastchar - buffer)),318' ');319*lastchar = (char)key;320*(lastchar+1) = '\0';321return lastchar;322case 6: /* Right */323if (cp < lastchar) {324kdb_printf("%c", *cp);325++cp;326}327break;328case 9: /* Tab */329if (tab < 2)330++tab;331332tmp = *cp;333*cp = '\0';334p_tmp = strrchr(buffer, ' ');335p_tmp = (p_tmp ? p_tmp + 1 : buffer);336strscpy(tmpbuffer, p_tmp);337*cp = tmp;338339len = strlen(tmpbuffer);340count = kallsyms_symbol_complete(tmpbuffer, sizeof(tmpbuffer));341if (tab == 2 && count > 0) {342kdb_printf("\n%d symbols are found.", count);343if (count > dtab_count) {344count = dtab_count;345kdb_printf(" But only first %d symbols will"346" be printed.\nYou can change the"347" environment variable DTABCOUNT.",348count);349}350kdb_printf("\n");351for (i = 0; i < count; i++) {352ret = kallsyms_symbol_next(tmpbuffer, i, sizeof(tmpbuffer));353if (WARN_ON(!ret))354break;355if (ret != -E2BIG)356kdb_printf("%s ", tmpbuffer);357else358kdb_printf("%s... ", tmpbuffer);359tmpbuffer[len] = '\0';360}361if (i >= dtab_count)362kdb_printf("...");363kdb_printf("\n");364kdb_printf("%s", kdb_prompt_str);365kdb_printf("%s", buffer);366if (cp != lastchar)367kdb_position_cursor(kdb_prompt_str, buffer, cp);368} else if (tab != 2 && count > 0) {369/* How many new characters do we want from tmpbuffer? */370len_tmp = strlen(tmpbuffer) - len;371if (lastchar + len_tmp >= bufend)372len_tmp = bufend - lastchar;373374if (len_tmp) {375/* + 1 ensures the '\0' is memmove'd */376memmove(cp+len_tmp, cp, (lastchar-cp) + 1);377memcpy(cp, tmpbuffer+len, len_tmp);378kdb_printf("%s", cp);379cp += len_tmp;380lastchar += len_tmp;381if (cp != lastchar)382kdb_position_cursor(kdb_prompt_str,383buffer, cp);384}385}386kdb_nextline = 1; /* reset output line number */387break;388default:389if (key >= 32 && lastchar < bufend) {390if (cp < lastchar) {391memmove(cp+1, cp, lastchar - cp + 1);392lastchar++;393*cp = key;394kdb_printf("%s", cp);395++cp;396kdb_position_cursor(kdb_prompt_str, buffer, cp);397} else {398*++lastchar = '\0';399*cp++ = key;400/* The kgdb transition check will hide401* printed characters if we think that402* kgdb is connecting, until the check403* fails */404if (!KDB_STATE(KGDB_TRANS)) {405if (kgdb_transition_check(buffer))406return buffer;407} else {408kdb_printf("%c", key);409}410}411/* Special escape to kgdb */412if (lastchar - buffer >= 5 &&413strcmp(lastchar - 5, "$?#3f") == 0) {414kdb_gdb_state_pass(lastchar - 5);415strcpy(buffer, "kgdb");416KDB_STATE_SET(DOING_KGDB);417return buffer;418}419if (lastchar - buffer >= 11 &&420strcmp(lastchar - 11, "$qSupported") == 0) {421kdb_gdb_state_pass(lastchar - 11);422strcpy(buffer, "kgdb");423KDB_STATE_SET(DOING_KGDB);424return buffer;425}426}427break;428}429goto poll_again;430}431432/*433* kdb_getstr434*435* Print the prompt string and read a command from the436* input device.437*438* Parameters:439* buffer Address of buffer to receive command440* bufsize Size of buffer in bytes441* prompt Pointer to string to use as prompt string442* Returns:443* Pointer to command buffer.444* Locking:445* None.446* Remarks:447* For SMP kernels, the processor number will be448* substituted for %d, %x or %o in the prompt.449*/450451char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt)452{453if (prompt && kdb_prompt_str != prompt)454strscpy(kdb_prompt_str, prompt);455kdb_printf("%s", kdb_prompt_str);456kdb_nextline = 1; /* Prompt and input resets line number */457return kdb_read(buffer, bufsize);458}459460/*461* kdb_input_flush462*463* Get rid of any buffered console input.464*465* Parameters:466* none467* Returns:468* nothing469* Locking:470* none471* Remarks:472* Call this function whenever you want to flush input. If there is any473* outstanding input, it ignores all characters until there has been no474* data for approximately 1ms.475*/476477static void kdb_input_flush(void)478{479get_char_func *f;480int res;481int flush_delay = 1;482while (flush_delay) {483flush_delay--;484empty:485touch_nmi_watchdog();486for (f = &kdb_poll_funcs[0]; *f; ++f) {487res = (*f)();488if (res != -1) {489flush_delay = 1;490goto empty;491}492}493if (flush_delay)494mdelay(1);495}496}497498/*499* kdb_printf500*501* Print a string to the output device(s).502*503* Parameters:504* printf-like format and optional args.505* Returns:506* 0507* Locking:508* None.509* Remarks:510* use 'kdbcons->write()' to avoid polluting 'log_buf' with511* kdb output.512*513* If the user is doing a cmd args | grep srch514* then kdb_grepping_flag is set.515* In that case we need to accumulate full lines (ending in \n) before516* searching for the pattern.517*/518519static char kdb_buffer[256]; /* A bit too big to go on stack */520static char *next_avail = kdb_buffer;521static int size_avail;522static int suspend_grep;523524/*525* search arg1 to see if it contains arg2526* (kdmain.c provides flags for ^pat and pat$)527*528* return 1 for found, 0 for not found529*/530static int kdb_search_string(char *searched, char *searchfor)531{532char firstchar, *cp;533int len1, len2;534535/* not counting the newline at the end of "searched" */536len1 = strlen(searched)-1;537len2 = strlen(searchfor);538if (len1 < len2)539return 0;540if (kdb_grep_leading && kdb_grep_trailing && len1 != len2)541return 0;542if (kdb_grep_leading) {543if (!strncmp(searched, searchfor, len2))544return 1;545} else if (kdb_grep_trailing) {546if (!strncmp(searched+len1-len2, searchfor, len2))547return 1;548} else {549firstchar = *searchfor;550cp = searched;551while ((cp = strchr(cp, firstchar))) {552if (!strncmp(cp, searchfor, len2))553return 1;554cp++;555}556}557return 0;558}559560static void kdb_msg_write(const char *msg, int msg_len)561{562struct console *c;563const char *cp;564int cookie;565int len;566567if (msg_len == 0)568return;569570cp = msg;571len = msg_len;572573while (len--) {574dbg_io_ops->write_char(*cp);575cp++;576}577578/*579* The console_srcu_read_lock() only provides safe console list580* traversal. The use of the ->write() callback relies on all other581* CPUs being stopped at the moment and console drivers being able to582* handle reentrance when @oops_in_progress is set.583*584* There is no guarantee that every console driver can handle585* reentrance in this way; the developer deploying the debugger586* is responsible for ensuring that the console drivers they587* have selected handle reentrance appropriately.588*/589cookie = console_srcu_read_lock();590for_each_console_srcu(c) {591if (!(console_srcu_read_flags(c) & CON_ENABLED))592continue;593if (c == dbg_io_ops->cons)594continue;595if (!c->write)596continue;597/*598* Set oops_in_progress to encourage the console drivers to599* disregard their internal spin locks: in the current calling600* context the risk of deadlock is a bigger problem than risks601* due to re-entering the console driver. We operate directly on602* oops_in_progress rather than using bust_spinlocks() because603* the calls bust_spinlocks() makes on exit are not appropriate604* for this calling context.605*/606++oops_in_progress;607c->write(c, msg, msg_len);608--oops_in_progress;609touch_nmi_watchdog();610}611console_srcu_read_unlock(cookie);612}613614int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)615{616int diag;617int linecount;618int colcount;619int logging, saved_loglevel = 0;620int retlen = 0;621int fnd, len;622int this_cpu, old_cpu;623char *cp, *cp2, *cphold = NULL, replaced_byte = ' ';624char *moreprompt = "more> ";625unsigned long flags;626627/* Serialize kdb_printf if multiple cpus try to write at once.628* But if any cpu goes recursive in kdb, just print the output,629* even if it is interleaved with any other text.630*/631local_irq_save(flags);632this_cpu = smp_processor_id();633for (;;) {634old_cpu = cmpxchg(&kdb_printf_cpu, -1, this_cpu);635if (old_cpu == -1 || old_cpu == this_cpu)636break;637638cpu_relax();639}640641diag = kdbgetintenv("LINES", &linecount);642if (diag || linecount <= 1)643linecount = 24;644645diag = kdbgetintenv("COLUMNS", &colcount);646if (diag || colcount <= 1)647colcount = 80;648649diag = kdbgetintenv("LOGGING", &logging);650if (diag)651logging = 0;652653if (!kdb_grepping_flag || suspend_grep) {654/* normally, every vsnprintf starts a new buffer */655next_avail = kdb_buffer;656size_avail = sizeof(kdb_buffer);657}658vsnprintf(next_avail, size_avail, fmt, ap);659660/*661* If kdb_parse() found that the command was cmd xxx | grep yyy662* then kdb_grepping_flag is set, and kdb_grep_string contains yyy663*664* Accumulate the print data up to a newline before searching it.665* (vsnprintf does null-terminate the string that it generates)666*/667668/* skip the search if prints are temporarily unconditional */669if (!suspend_grep && kdb_grepping_flag) {670cp = strchr(kdb_buffer, '\n');671if (!cp) {672/*673* Special cases that don't end with newlines674* but should be written without one:675* The "[nn]kdb> " prompt should676* appear at the front of the buffer.677*678* The "[nn]more " prompt should also be679* (MOREPROMPT -> moreprompt)680* written * but we print that ourselves,681* we set the suspend_grep flag to make682* it unconditional.683*684*/685if (next_avail == kdb_buffer) {686/*687* these should occur after a newline,688* so they will be at the front of the689* buffer690*/691cp2 = kdb_buffer;692len = strlen(kdb_prompt_str);693if (!strncmp(cp2, kdb_prompt_str, len)) {694/*695* We're about to start a new696* command, so we can go back697* to normal mode.698*/699kdb_grepping_flag = 0;700goto kdb_printit;701}702}703/* no newline; don't search/write the buffer704until one is there */705len = strlen(kdb_buffer);706next_avail = kdb_buffer + len;707size_avail = sizeof(kdb_buffer) - len;708goto kdb_print_out;709}710711/*712* The newline is present; print through it or discard713* it, depending on the results of the search.714*/715cp++; /* to byte after the newline */716replaced_byte = *cp; /* remember what/where it was */717cphold = cp;718*cp = '\0'; /* end the string for our search */719720/*721* We now have a newline at the end of the string722* Only continue with this output if it contains the723* search string.724*/725fnd = kdb_search_string(kdb_buffer, kdb_grep_string);726if (!fnd) {727/*728* At this point the complete line at the start729* of kdb_buffer can be discarded, as it does730* not contain what the user is looking for.731* Shift the buffer left.732*/733*cphold = replaced_byte;734strcpy(kdb_buffer, cphold);735len = strlen(kdb_buffer);736next_avail = kdb_buffer + len;737size_avail = sizeof(kdb_buffer) - len;738goto kdb_print_out;739}740if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) {741/*742* This was a interactive search (using '/' at more743* prompt) and it has completed. Replace the \0 with744* its original value to ensure multi-line strings745* are handled properly, and return to normal mode.746*/747*cphold = replaced_byte;748kdb_grepping_flag = 0;749}750/*751* at this point the string is a full line and752* should be printed, up to the null.753*/754}755kdb_printit:756757/*758* Write to all consoles.759*/760retlen = strlen(kdb_buffer);761cp = (char *) printk_skip_headers(kdb_buffer);762if (!dbg_kdb_mode && kgdb_connected)763gdbstub_msg_write(cp, retlen - (cp - kdb_buffer));764else765kdb_msg_write(cp, retlen - (cp - kdb_buffer));766767if (logging) {768saved_loglevel = console_loglevel;769console_loglevel = CONSOLE_LOGLEVEL_SILENT;770if (printk_get_level(kdb_buffer) || src == KDB_MSGSRC_PRINTK)771printk("%s", kdb_buffer);772else773pr_info("%s", kdb_buffer);774}775776if (KDB_STATE(PAGER)) {777/*778* Check printed string to decide how to bump the779* kdb_nextline to control when the more prompt should780* show up.781*/782int got = 0;783len = retlen;784while (len--) {785if (kdb_buffer[len] == '\n') {786kdb_nextline++;787got = 0;788} else if (kdb_buffer[len] == '\r') {789got = 0;790} else {791got++;792}793}794kdb_nextline += got / (colcount + 1);795}796797/* check for having reached the LINES number of printed lines */798if (kdb_nextline >= linecount) {799char ch;800801/* Watch out for recursion here. Any routine that calls802* kdb_printf will come back through here. And kdb_read803* uses kdb_printf to echo on serial consoles ...804*/805kdb_nextline = 1; /* In case of recursion */806807/*808* Pause until cr.809*/810moreprompt = kdbgetenv("MOREPROMPT");811if (moreprompt == NULL)812moreprompt = "more> ";813814kdb_input_flush();815kdb_msg_write(moreprompt, strlen(moreprompt));816817if (logging)818printk("%s", moreprompt);819820ch = kdb_getchar();821kdb_nextline = 1; /* Really set output line 1 */822823/* empty and reset the buffer: */824kdb_buffer[0] = '\0';825next_avail = kdb_buffer;826size_avail = sizeof(kdb_buffer);827if ((ch == 'q') || (ch == 'Q')) {828/* user hit q or Q */829KDB_FLAG_SET(CMD_INTERRUPT); /* command interrupted */830KDB_STATE_CLEAR(PAGER);831/* end of command output; back to normal mode */832kdb_grepping_flag = 0;833kdb_printf("\n");834} else if (ch == ' ') {835kdb_printf("\r");836suspend_grep = 1; /* for this recursion */837} else if (ch == '\n' || ch == '\r') {838kdb_nextline = linecount - 1;839kdb_printf("\r");840suspend_grep = 1; /* for this recursion */841} else if (ch == '/' && !kdb_grepping_flag) {842kdb_printf("\r");843kdb_getstr(kdb_grep_string, KDB_GREP_STRLEN,844kdbgetenv("SEARCHPROMPT") ?: "search> ");845*strchrnul(kdb_grep_string, '\n') = '\0';846kdb_grepping_flag += KDB_GREPPING_FLAG_SEARCH;847suspend_grep = 1; /* for this recursion */848} else if (ch) {849/* user hit something unexpected */850suspend_grep = 1; /* for this recursion */851if (ch != '/')852kdb_printf(853"\nOnly 'q', 'Q' or '/' are processed at "854"more prompt, input ignored\n");855else856kdb_printf("\n'/' cannot be used during | "857"grep filtering, input ignored\n");858} else if (kdb_grepping_flag) {859/* user hit enter */860suspend_grep = 1; /* for this recursion */861kdb_printf("\n");862}863kdb_input_flush();864}865866/*867* For grep searches, shift the printed string left.868* replaced_byte contains the character that was overwritten with869* the terminating null, and cphold points to the null.870* Then adjust the notion of available space in the buffer.871*/872if (kdb_grepping_flag && !suspend_grep) {873*cphold = replaced_byte;874strcpy(kdb_buffer, cphold);875len = strlen(kdb_buffer);876next_avail = kdb_buffer + len;877size_avail = sizeof(kdb_buffer) - len;878}879880kdb_print_out:881suspend_grep = 0; /* end of what may have been a recursive call */882if (logging)883console_loglevel = saved_loglevel;884/* kdb_printf_cpu locked the code above. */885smp_store_release(&kdb_printf_cpu, old_cpu);886local_irq_restore(flags);887return retlen;888}889890int kdb_printf(const char *fmt, ...)891{892va_list ap;893int r;894895va_start(ap, fmt);896r = vkdb_printf(KDB_MSGSRC_INTERNAL, fmt, ap);897va_end(ap);898899return r;900}901EXPORT_SYMBOL_GPL(kdb_printf);902903904