[comp.sys.hp] xdb bug?

paul@eye.com (Paul B. Booth) (04/30/91)

Hi there.  I'm posting this for a colleague:

Hello.  I'm running xdb on an HP 835 workstation, HP-UX A/B7, and I've run into
a most confusing problem.

The manifestions of the problem are:

    o When I query the contents of a struct, the data is displayed in terms of
      field names of a different struct.  (Not another instance of the same
      type of struct, but an altogether different struct type).

    o When I ask for the contents of a specific field within that struct
      variable, xdb responds that there is no such field associated with the
      variable.

The facts are:

    o The program which I am debugging works.

    o When the contents of the struct variable are queried, the data that comes
      out is correct both in terms of what the values are and their placement
      in memory.  It's just the raw data is being cast into incorrect field
      types.

    o I am unable to reproduce this behavior on s300 machines, but a co-worker
      has seen something very similar on her new 720 (an HP-PA link?)

This problem seemed to have intermittently disappeared, through no apparent
action of my own save repetitive re-copying of sources and makefiles and
re-making of the image, but is now back again.  Has anyone run into similar
problems with xdb or know about a bug that I'm unaware of?  What should I do?

--
Paul B. Booth  (paul@eye.com) (...!hplabs!hpfcla!eye!paul)
-------------------------------------------------------------------------------
3D/EYE, Inc., 2359 N. Triphammer Rd., Ithaca, NY  14850    voice: (607)257-1381
                                                             fax: (607)257-7335

stroyan@hpfcso.FC.HP.COM (Mike Stroyan) (05/05/91)

>     o When I query the contents of a struct, the data is displayed in terms of
>       field names of a different struct.  (Not another instance of the same
>       type of struct, but an altogether different struct type).

>     o I am unable to reproduce this behavior on s300 machines, but a co-worker
>       has seen something very similar on her new 720 (an HP-PA link?)

> Paul B. Booth  (paul@eye.com) (...!hplabs!hpfcla!eye!paul)

The problem is that xdb assumes that all structs of type "struct foo"
will be the same as the first struct of type "struct foo" that it
encounters in the link sequence.  If you link the file that you are
debugging before any other that uses the same names for structs, then
the debugger will act in a reasonable manner.  This problem is coming to
the 300 series in 8.0.  It is a design shortcoming that crept in along
with some major debugger performance improvements.

Mike Stroyan, mike_stroyan@fc.hp.com

bruno@hpfcso.FC.HP.COM (Bruno Melli) (05/06/91)

> The problem is that xdb assumes that all structs of type "struct foo"
> will be the same as the first struct of type "struct foo" that it
> encounters in the link sequence.

If the 2 structures have the same name, this is indeed the correct
explanation. If however the structures have a different name, this
is most likely due to invalid debug information. We just ran into a
similar problem about 2 weeks ago. One potential work around is to
compile a dummy file that just includes the structure definition, and
declares a static of that type. Link in that dummy .o file ahead of
any other file when you create a debuggable file. That should
solve your problem.

bruno.