[Crash-utility] "gdb" by itself ought to put crash into a "gdb" mode

Dave Anderson anderson at redhat.com
Tue Mar 20 18:54:14 UTC 2012



----- Original Message -----
> On 03/16/12 14:10, Dave Anderson wrote:
> >    crash>  set gdb
> >    Segmentation fault
> >    $
> 
> I guess it's a good hint that you typed in something incorrectly.
> Anyway, the problem is that I discovered that STREQ() detects a NULL
> pointer and does something reasonable if it is NULL.  That was
> not the case with IS_A_NUMBER().  It is now. :)
> 
> 
> crash> set gdb
> gdb> set gdb
> crash> set gdb
> gdb> set gdb
> crash> set gdb off
> crash> set gdb
> gdb> set gdb on
> gdb> set gdb off
> crash> quit
>

Hi Bruce,

OK, I took your latest patch and re-worked it a bit
in order to make the "gdb" environment variable behave
the same way as the other boolean variables.  That being 
the case, I just added an "if" statement to cmd_set() for
"gdb" that mimics the other booleans; the mode is turned 
on/off by entering "set gdb on" and "set gdb off", while 
"set gdb" shows the current setting.  I also had to prevent
turning it on if crash was invoked with --minimal.

Also, I didn't make any of your changes to stol(), stoll(),
decimal() and  hexadecimal().  There are several instances 
where it is perfectly legitimate to pass a NULL pointer to 
STREQ() and STREQ() -- which is one of the reasons that they
exist.  But that's really not the case with the translation 
functions.  If they receive a NULL pointer, then there is 
a bug in the calling function.

Your patch to get_command_table_entry() was a pretty nifty
way to bait-and-switch the command; I enhanced it a bit by
allowing you to run native crash commands while in "gdb" mode
by preceding them with the "crash" directive, for example,
entering "crash ps". 

I documented this new mode in both the "set" and "gdb" help
pages.

And lastly I made a new, exported, set_command_prompt()
function that cmd_set() uses, but could also be used by, say,
an extension module to change the prompt when it is loaded
and unloaded.

It is queued for crash-6.0.5.  Hopefully it will meet your needs...

Thanks,
  Dave






More information about the Crash-utility mailing list