On Wed, 16 Nov 2005, Dave Anderson wrote:
Castor Fu wrote:
The minimal expectation would be something which would export
pc->program_version
If pc->curcmd were exported, that would also remove dependencies
on calling cmd_usage.
I do try my best to not muck with the basic data structures, and if changed,
to add the new struff onto the end of the data structure, so even if a module
were built with an older version, its dependencies would still be in place.
And with respect to the program_context structure specifically, I cannot
even remember the last time that it changed. We can always put a
moratorium on the data structure to enforce the "only-add-to-the-end"
rule. Or if you feel it's necessary, come up with a mechanism for
exporting stuff generically for extensions, come up with something
that we can put in extensions.c.
If it doesn't change much, that's fine.
Regarding the 'bt -O' change... If I run 'crash' in root's $HOME
a '.crashrc' will get executed twice. I cannot put 'bt -O' in
a .crashrc file and get predictable behavior. It'd be good to
have a mechanism which is idempotent.
I've attached patches which change 'bt -O' to accept an optional 0/1 argument
to fix the value.
Thanks!
-castor
Common subdirectories: crash-4.0-2.12/extensions and crash-4.0-2.12-new/extensions
Common subdirectories: crash-4.0-2.12/gdb-6.1 and crash-4.0-2.12-new/gdb-6.1
diff -Nau -X ignorepat crash-4.0-2.12/help.c crash-4.0-2.12-new/help.c
--- crash-4.0-2.12/help.c 2005-11-15 12:53:06 -08:00
+++ crash-4.0-2.12-new/help.c 2005-11-17 16:13:58 -08:00
@@ -1155,7 +1155,7 @@
"bt",
"backtrace",
#if defined(GDB_6_0) || defined(GDB_6_1)
-"[-a|-r|-t|-T|-l|-e|-E|-f|-o|-O] [-R ref] [ -I ip ] [-S sp] [pid | taskp]",
+"[-a|-r|-t|-T|-l|-e|-E|-f|-o|-O [0|1]] [-R ref] [ -I ip ] [-S sp] [pid | taskp]",
#else
"[-a|-r|-t|-l|-e|-f|-g] [-R ref] [ -I ip ] [-S sp] [pid | taskp]",
#endif
@@ -1180,9 +1180,9 @@
" on IA64, the argument register contents are dumped.",
" -o use old backtrace method, permissable only on kernels that were",
" compiled without the -fomit-frame_pointer (x86 only).",
-" -O use old backtrace method by default, permissable only on kernels",
-" that were compiled without the -fomit-frame_pointer; subsequent",
-" usage of this option toggles the backtrace method (x86 only).",
+" -O [0|1] select use of old backtrace method, permissable only on kernels",
+" that were compiled without the -fomit-frame_pointer; without arguments",
+" toggles the option, (default off) (x86 only)",
#if !defined(GDB_6_0) && !defined(GDB_6_1)
" -g use gdb stack trace code. (alpha only)",
#endif
diff -Nau -X ignorepat crash-4.0-2.12/kernel.c crash-4.0-2.12-new/kernel.c
--- crash-4.0-2.12/kernel.c 2005-11-15 12:53:06 -08:00
+++ crash-4.0-2.12-new/kernel.c 2005-11-17 16:13:54 -08:00
@@ -1133,6 +1133,7 @@
struct bt_info bt_info, bt_setup, *bt;
struct reference reference;
char *refptr;
+ int toggle_old_bt = 0;
tc = NULL;
subsequent = active = count = 0;
@@ -1158,13 +1159,28 @@
case 'O':
if (!(machine_type("X86"))) {
option_not_supported(c);
- } else if (kt->flags & USE_OLD_BT) {
- kt->flags &= ~USE_OLD_BT;
- error(INFO, "use new bt method by default\n");
} else {
- kt->flags |= USE_OLD_BT;
- error(INFO, "use old bt method by default\n");
- }
+ if (argcnt > optind) {
+ switch(args[optind][0]) {
+ case '0':
+ kt->flags &= ~USE_OLD_BT;
+ error(INFO, "use new bt method by default\n");
+ break;
+ case '1':
+ kt->flags |= USE_OLD_BT;
+ error(INFO, "use old bt method by default\n");
+ break;
+ default:
+ option_not_supported(args[optind][0]);
+ }
+ } else if (kt->flags & USE_OLD_BT) {
+ kt->flags &= ~USE_OLD_BT;
+ error(INFO, "use new bt method by default\n");
+ } else {
+ kt->flags |= USE_OLD_BT;
+ error(INFO, "use old bt method by default\n");
+ }
+ }
return;
case 'R':