Skip to content

Commit fcf2736

Browse files
author
Daniel Thompson
committed
Revert "kdb: Get rid of confusing diag msg from "rd" if current task has no regs"
This reverts commit bbfceba. When DBG_MAX_REG_NUM is zero then a number of symbols are conditionally defined. It is therefore not possible to check it using C expressions. Reported-by: Anatoly Pugachev <[email protected]> Acked-by: Doug Anderson <[email protected]> Signed-off-by: Daniel Thompson <[email protected]>
1 parent dc2c733 commit fcf2736

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

kernel/debug/kdb/kdb_main.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,9 @@ int kdbgetaddrarg(int argc, const char **argv, int *nextarg,
543543
if (diag)
544544
return diag;
545545
} else if (symname[0] == '%') {
546-
if (kdb_check_regs())
547-
return 0;
546+
diag = kdb_check_regs();
547+
if (diag)
548+
return diag;
548549
/* Implement register values with % at a later time as it is
549550
* arch optional.
550551
*/
@@ -1835,7 +1836,8 @@ static int kdb_go(int argc, const char **argv)
18351836
*/
18361837
static int kdb_rd(int argc, const char **argv)
18371838
{
1838-
int len = 0;
1839+
int len = kdb_check_regs();
1840+
#if DBG_MAX_REG_NUM > 0
18391841
int i;
18401842
char *rname;
18411843
int rsize;
@@ -1844,14 +1846,8 @@ static int kdb_rd(int argc, const char **argv)
18441846
u16 reg16;
18451847
u8 reg8;
18461848

1847-
if (kdb_check_regs())
1848-
return 0;
1849-
1850-
/* Fallback to Linux showregs() if we don't have DBG_MAX_REG_NUM */
1851-
if (DBG_MAX_REG_NUM <= 0) {
1852-
kdb_dumpregs(kdb_current_regs);
1853-
return 0;
1854-
}
1849+
if (len)
1850+
return len;
18551851

18561852
for (i = 0; i < DBG_MAX_REG_NUM; i++) {
18571853
rsize = dbg_reg_def[i].size * 2;
@@ -1893,7 +1889,12 @@ static int kdb_rd(int argc, const char **argv)
18931889
}
18941890
}
18951891
kdb_printf("\n");
1892+
#else
1893+
if (len)
1894+
return len;
18961895

1896+
kdb_dumpregs(kdb_current_regs);
1897+
#endif
18971898
return 0;
18981899
}
18991900

@@ -1927,8 +1928,9 @@ static int kdb_rm(int argc, const char **argv)
19271928
if (diag)
19281929
return diag;
19291930

1930-
if (kdb_check_regs())
1931-
return 0;
1931+
diag = kdb_check_regs();
1932+
if (diag)
1933+
return diag;
19321934

19331935
diag = KDB_BADREG;
19341936
for (i = 0; i < DBG_MAX_REG_NUM; i++) {

0 commit comments

Comments
 (0)