This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH
On Tue, Jul 12, 2011 at 13:31, Matt Rice wrote:
> On Tue, Jul 12, 2011 at 8:59 AM, Mike Frysinger wrote:
>> On Tue, Jul 12, 2011 at 03:15, Abhijit Halder wrote:
>>> since the pipe (|) symbol is also a c operator, it will confuse gdb.
>>> Even if we use |& we may land up into a trouble situation.
>>>
>>> Breakpoint 1, main (argc=1, argv=0x7fffb6e506a8) at test.c:15
>>> 15 ? ? ? ? ?return (SUCCESS) ;
>>> (gdb) p argc|&*argc
>>> $1 = 1
>>> (gdb) p argc |& *argc
>>> $2 = 1
>>> (gdb)
>>
>> i'm not seeing this. ?on an unmodified gdb-7.2, i get:
>> (gdb) p g
>> $1 = 0xa
>> (gdb) p g |& g
>> Argument to arithmetic operation not a number or boolean.
>>
>> so what am i missing ?
>
> this one should work.
>
> p 0 |& argv[argc] - &argv[0]
oh, i see now. creative spacing. "...|& FOO" is taking the address
of FOO. hrm, this would also mean ">&" wont work as that could be a
comparison against the address of a variable.
">|" might work. it's not as intuitive, but it's muscle memory in the
end and people will learn soon enough :P.
-mike