07-22-2010 01:32 AM
While analyzing a crash dump (from HP-UX 11.31 IA), I am passing -m flag to kwdb to enable DLKM debugging. kwdb can recognize symbols from our DLKM module, but it is not recognizing type names. Couple of examples:
1. _fsh_fs_info_tbl is a global. kwdb can find it, but can't recognize its type.
q4> print &_fsh_fs_info_tbl
$1 = ( *) 0x4f12270
2. Directly printing a type doesn't work too.
q4> ptype struct fsh_fstype_info_st
No struct type named fsh_fstype_info_st.
How can I make kwdb recognize type names from our DLKM module?
I wrote a small C file (sym.c) with a few data structures defined in it and then compiled it using the command line: /opt/ansic/bin/cc +DD64 -D_KERNEL -g -c sym.c (_KERNEL is defined to include kernel space declarations). Then I used the 'adddebug' command inside kwdb to load these symbols:
q4> adddebug sym.o
Reading debug info from /var/adm/crash.3/sym.o...
expanding to full symbols...Reading debug info ...done.
Still the symbols defined in sym.c are not visible inside kwdb. I must be missing something. How can I get this to work?
kwdb version is 3.2.1.
Solved! Go to Solution.
07-22-2010 01:44 AM
What does "ptype &_fsh_fs_info_tbl" show?
Can you toss kwdb out and use a normal C executable with sym.c and see if gdb finds that type?
What aC++ compiler version are you using?
07-22-2010 03:49 AM
q4> ptype &_fsh_fs_info_tbl
type = *
> What aC++ compiler version are you using?
B9007AA C.11.31.04.2 HP C/aC++ Developer's Bundle
I think I've figured out the problem. It's got something to do with the Itanium compiler's behaviour. Things are fine on PA-RISC.
I created a simple program foo.c:
typedef struct mytype
Then compiled it both on IA and PA using the cmd: /opt/ansic/bin/cc +DD64 -g -c foo.c
When I 'adddebug'ed foo.o on kwdb (or gdb) running on a PA machine, kwdb showed 'mytype' in the catalog.
However, on IA machine, kwdb didn't show 'mytype'.
I figured out that if you _use_ a variable of a type then that type will show up in kwdb on IA. So changing main to:
t1.a = 10;
will cause kwdb to recognize 'mytype'. Note that simply declaring a variable is not enough; you have to actually use that variable. I guess the IA compiler is removing unused code even in the presence of -g flag. I don't know if a flag can be used to change this behaviour. PA compiler doesn't need this extra work.
07-22-2010 01:21 PM
This is A.06.20. The latest is A.06.25.01.
>I guess the IA compiler is removing unused code even in the presence of -g flag.
Yes. A C++ compiler can't afford to put unused info into the debug info.
>I don't know if a flag can be used to change this behaviour.
I can't duplicate your problem. If you use +kernel and -g, unused types are put into the debug info. I assume you also used +noobjdebug?
07-23-2010 02:44 AM
I would think that any optimizations should not be applied when -g flag is specified _and_ none of the optimization flags are specified. PA compiler seems to work differently in this regard, which is along (my) expected lines.
> If you use +kernel and -g, unused types are put into
> the debug info. I assume you also used +noobjdebug?
I didn't use +noobjdebug.
However, using +kernel makes it work. I no longer have to use the types to make them appear in debugger.
What does this option really do? It is not listed at A.06.25's online help page (http://h21007.www2.hp.com/portal/download/files/un
07-23-2010 03:20 AM
This isn't really an optimization. Customers don't like it when their object files are massive.
>PA compiler seems to work differently in this regard
That's because it is a C only compiler, not aC++.
>our DLKM module
>using +kernel makes it work.
>What does this option really do?
This is a required option for DLKMs. If you are creating DLKMs, you must follow the info in the DDK guides.
07-23-2010 04:04 AM
Hmm, yes. I didn't know this. On Itanium:
# ls -l /opt/ansic
lrwxrwxrwx 1 bin bin 3 Jul 22 04:45 /opt/ansic -> aCC
> +kernel ... This is a required option for DLKMs.
Our DLKM is actually built using this option (along with several others); just that I didn't use it for my test program, more so because PA compiler did not require it. But things are better now.
Thanks a lot, Dennis, for all the help.
07-23-2010 05:12 AM
If you are happy with the answers you were given, please read the following about how to assign points: