0

in HP UX 11.23 on ia64 , when debugging a particular code segment, i am getting this error when trying to access a particular object.

I was wondering if anyone faced it, and could help me make sense of it.

(gdb) p *rsp
$8 = {<> = {Couldn't find virtual table -- object may not be constructed yet.
(gdb) p rrc
$9 = (class iface::rrc::MeasurementMessage *) 0x0
(gdb) l
417                                    iface::cpr::PositionResponse      &rspPtr,
418                                    bool                              &is3D)
419     {
420       iface::rrlp::PositionResponse       *rsp = lt.getRrlpResponse();
421       iface::rrc::MeasurementMessage      *rrc = lt.getRrc();
422       iface::lpp::PositionResponse        *lpp = lt.getLppResponse();
423       const iface::util::GadShape         *gad = 0;
424       iface::cpr::PositionRequest         &req = lt.getCprRequest();
425       const iface::is801::MsRspLocation  *cdma = lt.getMsRspLocation();
426
(gdb) bt
#0  eotd::fetchAndSetPosition (lt=@0xa76200, position=@0x65e2c640,
    rspPtr=@0x3be9660, is3D=@0x65e2c580)
    at /home/egpsbld/source/smlc47hpux/icursor/com/cps/eotd/utils.cpp:422
#1  0x200000007e7195b0:0 in eotd::P6Locator::compute (this=0x4076c0,
    lt=@0xa76200)
j0k
  • 22,600
  • 28
  • 79
  • 90
  • What's the content of `lt`? In particular the elements that `getRrlpResponse` and `getRrc` return. – user786653 Aug 23 '11 at 09:19
  • sorry last comment went too early. lt is a large object with many members. getRrlpResponse returns poinnter to an object of tyupe PositionResponse. rsp is returned as not null, but in debugger when i try to get it printed, i get ouldn't find virtual table -- object may not be constructed yet. – Pankaj Kapoor Aug 23 '11 at 09:32
  • So to summarise, getRrlpResponse returns a pointer to positionResponse object. This object is already created by another part of the code. – Pankaj Kapoor Aug 23 '11 at 09:35
  • Though rsp is not null, it may be corrupted. Try to check code under Valgrind. – ks1322 Aug 23 '11 at 09:36
  • Thanks. I will check it under valgrind/purify. – Pankaj Kapoor Aug 23 '11 at 09:40
  • Is it a valid pointer? You can use `x/` in gdb to inspect the memory at `rsp`. E.g. if `PositionResponse` contains 4 unsigned ints, you can use `x/4uw rsp` to print them. – user786653 Aug 23 '11 at 09:41

1 Answers1

1

These kind of issues are frequent when you debug optimized code. Local variables are all messed up by the optimizer. The resulting behavior is the same, of course, but you will not see the data where and when you'd expect.

If that is the case, simply recompile your program with -O0

rodrigo
  • 94,151
  • 12
  • 143
  • 190