Ævar Arnfjörð Bjarmason wrote:
> On 9/12/07, Jim Cromie <jim.cromie gmail.com> wrote:
>
>> hv crypt.org wrote:
>>
>>> It's been a while since I tried to use gdb on
bleadperl, and I've switched
>>> to a new computer and a new linux flavour in
the meantime. I'm using:
>>> GNU gdb Red Hat Linux (6.5-15.fc6rh)
>>> .. on a debugging build of perl.
>>>
>>> I'm sure I used to be able to look at things by
specifying the typedef'd
>>> structure name, but now I get:
>>> (gdb) print *(XPVNV*)left->sv_any
>>> No symbol "XPVNV" in current
context.
>>> (gdb)
>>>
>>> Can anyone tell me how to get at this?
>>>
>>> Hugo
>>>
>>>
>>>
>> GDB seems to have difficulties with macro defs,
>> at least on perl code.
>>
>> <syncronicity>
>> I kicked tires on Devel: ebugInit
, which uses C::Scan (your module)
>> and it went into deep recursion expanding macros -
>>
>> From the existence of this module, I infer that
GDB cannot by itself
>> handle macro defs sufficiently well.
>>
>> <tangent>
>>
>
> gdb got macro expand support in 2002 [1], you need to
compile with
> -ggdb3 for this to work. However as is mentioned in
that e-mail it
> does not support all preprocessor features. The one
perl misses the
> most is support for macros that use ##, these are
frequently used in
> the perl source and gdb will fail to expand them.
>
> 1. http://sourceware.org/ml/gdb-patches/2002-03/msg00271.
html
>
>
Thanks AEvar, that was helpful.
I ended up building this:
../../bleadperl/Configure -des -Dusethreads -Doptimize='-g3
-O3 -ggdb'
-UDEBUGGING -Dmksymlinks
with this build, gdb now understands PL_op, whereas it didnt
before.
it also understands macros:
(gdb) info macro EXTEND
Defined at /mnt/extra/jimc/perl/core/dev/ggdb/pp.h:280
included at
/mnt/extra/jimc/perl/core/dev/ggdb/perl.h:4563
included at
/mnt/extra/jimc/perl/core/dev/ggdb/pp_hot.c:35
#define EXTEND(p, n) STMT_START { if (PL_stack_max - p <
(int)(n)) { sp
= stack_grow(sp,p, (int) (n)); } } STMT_END
also understands the typedefs:
(gdb) ptype XPV
type = struct xpv {
union {
NV xnv_nv;
HV *xgv_stash;
struct {...} xpad_cop_seq;
struct {...} xbm_s;
} xnv_u;
STRLEN xpv_cur;
STRLEN xpv_len;
}
by running this, and settng breakpoint on Perl_pp_gvsv
(gdb) r -Ilib -e '$a=1.1; print $a'
I was able to get at $a;
(gdb) p *(XPV*)GvSVn(cGVOP_gv)->sv_any
$19 = {xnv_u = {xnv_nv = 1.1000000000000001, xgv_stash =
0x9999999a,
xpad_cop_seq = {xlow = 2576980378,
xhigh = 1072798105}, xbm_s = {xbm_previous =
2576980378, xbm_flags
= 153 '231',
xbm_rare = 153 '231'}}, xpv_cur = 141073512, xpv_len
= 0}
(gdb)
This isnt quite the same as an XPVNV (obviously),
for which I got the same error as Hugo mentioned.
(gdb) p *(XPVNV*)GvSVn(cGVOP_gv)->sv_any
No symbol "XPVNV" in current context.
Im at a loss, so Ill guess wildly - is it possibly due to
either:
a libperl.a vs perl (.exe) issue ?
special case compilation of one of the *.o files ?
BTW, I have same gdb ..
$ gdb --version
GNU gdb Red Hat Linux (6.5-15.fc6rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as
"i386-redhat-linux-gnu".
|