kdb: Remove the misfeature 'KDBFLAGS'
PATCH v3 1/1 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.
---
v2 -> v3:
- Change to replace the internal env 'KDBFLAGS' with 'KDBDEBUG'.
v1 -> v2:
- Fix lack of braces.
kernel/debug/kdb/kdb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/debug/kdb/kdb_main.c +3 -3
@@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv) argv[2]);return 0 ; } - kdb_flags = (kdb_flags & - ~(KDB_DEBUG_FLAG_MASK <<KDB_DEBUG_FLAG_SHIFT )) + kdb_flags = (kdb_flags & ~KDB_DEBUG (MASK )) | (debugflags <<KDB_DEBUG_FLAG_SHIFT );return 0 ;
@@ -2081,7 +2080,8 @@ static int kdb_env(int argc, const char **argv) }if (KDB_DEBUG (MASK )) -kdb_printf ("KDBFLAGS=0x%x\n" , kdb_flags); +kdb_printf ("KDBDEBUG=0x%x\n" , + (kdb_flags &KDB_DEBUG (MASK )) >>KDB_DEBUG_FLAG_SHIFT );return 0 ; }
Signature · 1 line
2.17.1
Quoted 36 lines · Wei Li
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_flagsinstead, to observe the state flags.Suggested-by Daniel Thompson <[email protected]>Signed-off-by Wei Li <[email protected]>---
v2 -> v3:
- Change to replace the internal env 'KDBFLAGS' with 'KDBDEBUG'.
v1 -> v2:
- Fix lack of braces.kernel/debug/kdb/kdb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/debug/kdb/kdb_main.c +1
-2@@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv) argv[2]);return 0 ; } - kdb_flags = (kdb_flags & - ~(KDB_DEBUG_FLAG_MASK <<KDB_DEBUG_FLAG_SHIFT )) + kdb_flags = (kdb_flags & ~KDB_DEBUG (MASK )) | (debugflags <<KDB_DEBUG_FLAG_SHIFT );return 0 ;
kernel/debug/kdb/kdb_main.c static int kdb_env(int argc, const char **argv) · line 2084
Quoted 6 lines
kernel/debug/kdb/kdb_main.c +2
-1@@ -2081,7 +2080,8 @@ static int kdb_env(int argc, const char **argv) }if (KDB_DEBUG (MASK )) -kdb_printf ("KDBFLAGS=0x%x\n" , kdb_flags); +kdb_printf ("KDBDEBUG=0x%x\n" , + (kdb_flags &KDB_DEBUG (MASK )) >>KDB_DEBUG_FLAG_SHIFT );
For this expression to work correctly, kdb_flags, need to be unsigned (otherwise we get an arithmetic right shift and mis-report when KDBDEBUG == 0xfff).
This is just FYI, I think I can fix this up when applying...
Daniel.
Daniel Thompson
AppliedQuoted 5 lines · Wei Li
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.
Quoted 7 lines
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_flagsinstead, to observe the state flags.Suggested-by Daniel Thompson <[email protected]>Signed-off-by Wei Li <[email protected]>
Applied. Thanks.
Daniel.
Quoted 42 lines
---
v2 -> v3:
- Change to replace the internal env 'KDBFLAGS' with 'KDBDEBUG'.
v1 -> v2:
- Fix lack of braces.kernel/debug/kdb/kdb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/debug/kdb/kdb_main.c +3
-3@@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv) argv[2]);return 0 ; } - kdb_flags = (kdb_flags & - ~(KDB_DEBUG_FLAG_MASK <<KDB_DEBUG_FLAG_SHIFT )) + kdb_flags = (kdb_flags & ~KDB_DEBUG (MASK )) | (debugflags <<KDB_DEBUG_FLAG_SHIFT );return 0 ;@@ -2081,7 +2080,8 @@ static int kdb_env(int argc, const char **argv) }if (KDB_DEBUG (MASK )) -kdb_printf ("KDBFLAGS=0x%x\n" , kdb_flags); +kdb_printf ("KDBDEBUG=0x%x\n" , + (kdb_flags &KDB_DEBUG (MASK )) >>KDB_DEBUG_FLAG_SHIFT );return 0 ; }Signature · 8 lines
2.17.1 _______________________________________________ Kgdb-bugreport mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport