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.
Unified · Split
| @@ -125,7 +125,7 @@ extern const char *kdb_diemsg; · 124 unmodified lines | ||
| 125 | 125 | #define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do |
| 126 | 126 | * not use keyboard */ |
| 127 | 127 | |
| 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 */ | |
| 129 | 129 | |
| 130 | 130 | extern void kdb_save_flags(void); |
| 131 | 131 | extern void kdb_restore_flags(void); |
| @@ -62,7 +62,7 @@ int kdb_grep_trailing; · 61 unmodified lines | ||
| 62 | 62 | /* |
| 63 | 63 | * Kernel debugger state flags |
| 64 | 64 | */ |
| 65 | −int kdb_flags; | |
| 65 | +unsigned int kdb_flags; | |
| 66 | 66 | |
| 67 | 67 | /* |
| 68 | 68 | * kdb_lock protects updates to kdb_initial_cpu. Used to |
| @@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv) · 349 unmodified lines | ||
| 418 | 418 | argv[2]); |
| 419 | 419 | return 0; |
| 420 | 420 | } |
| 421 | − kdb_flags = (kdb_flags & | |
| 422 | − ~(KDB_DEBUG_FLAG_MASK << KDB_DEBUG_FLAG_SHIFT)) | |
| 421 | + kdb_flags = (kdb_flags & ~KDB_DEBUG(MASK)) | |
| 423 | 422 | | (debugflags << KDB_DEBUG_FLAG_SHIFT); |
| 424 | 423 | |
| 425 | 424 | return 0; |
| @@ -2082,7 +2081,8 @@ static int kdb_env(int argc, const char **argv) · 1656 unmodified lines | ||
| 2082 | 2081 | } |
| 2083 | 2082 | |
| 2084 | 2083 | 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); | |
| 2086 | 2086 | |
| 2087 | 2087 | return 0; |
| 2088 | 2088 | } |