This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Prevent crashes using $arg0


> Date: Tue, 7 Feb 2006 14:39:32 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> This patch fixes a crash Andrew Stubbs reported:
> 
> if 1 == 1
>   print $arg0
> end
> 
> The new response is:
> $arg0 used outside of any user function

Is it possible to have $arg0 behave outside user-defined functions as
any other convenience variable?  That is, can we have this response
instead:

    (gdb) if 1 == 1
     >print $arg0
     >end
    $1 = void
    (gdb)

?  If this is not too hard, it's cleaner, since it doesn't reserve the
names of these variables globally.

[Time passes...] Actually, I'm quite sure we should behave like I
suggested, since we already do that without the if clause:

    (gdb) print $arg0
    $1 = void
    (gdb)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]