Skip to content

Commit c893de1

Browse files
stkidDaniel Thompson
authored andcommitted
kdb: Remove the misfeature 'KDBFLAGS'
Currently, 'KDBFLAGS' is an internal variable of kdb, it is combined by 'KDBDEBUG' and state flags. It will be shown only when 'KDBDEBUG' is set, and the user can define an environment variable named 'KDBFLAGS' too. These are puzzling indeed. After communication with Daniel, it seems that 'KDBFLAGS' is a misfeature. So let's replace 'KDBFLAGS' with 'KDBDEBUG' to just show the value we wrote into. After this modification, we can use `md4c1 kdb_flags` instead, to observe the state flags. Suggested-by: Daniel Thompson <[email protected]> Signed-off-by: Wei Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Make kdb_flags unsigned to avoid arithmetic right shift] Signed-off-by: Daniel Thompson <[email protected]>
1 parent 1b31003 commit c893de1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/linux/kdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extern const char *kdb_diemsg;
125125
#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
126126
* not use keyboard */
127127

128-
extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */
128+
extern unsigned int kdb_flags; /* Global flags, see kdb_state for per cpu state */
129129

130130
extern void kdb_save_flags(void);
131131
extern void kdb_restore_flags(void);

kernel/debug/kdb/kdb_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int kdb_grep_trailing;
6262
/*
6363
* Kernel debugger state flags
6464
*/
65-
int kdb_flags;
65+
unsigned int kdb_flags;
6666

6767
/*
6868
* kdb_lock protects updates to kdb_initial_cpu. Used to
@@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv)
418418
argv[2]);
419419
return 0;
420420
}
421-
kdb_flags = (kdb_flags &
422-
~(KDB_DEBUG_FLAG_MASK << KDB_DEBUG_FLAG_SHIFT))
421+
kdb_flags = (kdb_flags & ~KDB_DEBUG(MASK))
423422
| (debugflags << KDB_DEBUG_FLAG_SHIFT);
424423

425424
return 0;
@@ -2082,7 +2081,8 @@ static int kdb_env(int argc, const char **argv)
20822081
}
20832082

20842083
if (KDB_DEBUG(MASK))
2085-
kdb_printf("KDBFLAGS=0x%x\n", kdb_flags);
2084+
kdb_printf("KDBDEBUG=0x%x\n",
2085+
(kdb_flags & KDB_DEBUG(MASK)) >> KDB_DEBUG_FLAG_SHIFT);
20862086

20872087
return 0;
20882088
}

0 commit comments

Comments
 (0)