Debugging Core Files Using HP WDB (5900-1573; WDB 6.2; January 2011)

Avoiding Core File Corruption for Applications Running HP-UX 11i v1 and HP-UX 11i
v2
To prevent overwriting of core files from different processes for applications running
HP–UX 11i v1 or 11i v2 operating systems, you must set the kernel parameter
core_addpid to 1. The core file is stored in a file name, <core.pid> in the current
directory. To store core files in a specific filesystem, you must switch to the required
directory (using the cd command) and then run the required application.
To set the kernel parameter to prevent core file corruption, complete the following steps:
1. Create the following script, corepid, as a superuser of the system before running
the application:
Following is the corepid script for HP-UX 11i v1 systems:
# cat <path>/corepid
case $1 in
on) echo "core_addpid/W 1\ncore_addpid?W 1" | adb -w -k /stand/vmunix /dev/kmem;;
off) echo "core_addpid/W 0\ncore_addpid?W 0" | adb -w -k /stand/vmunix /dev/kmem;;
stat) echo "core_addpid/D\ncore_addpid?D" | adb -w -k /stand/vmunix /dev/kmem;;
*) echo "usage $0: on|off|stat";;
esac
Following is the corepid script for HP-UX 11i v2 systems:
# cat <path>/corepid
case $1 in
on) echo "core_addpid/W 1\ncore_addpid?W 1" | adb -o -w /stand/vmunix /dev/kmem;;
off) echo "core_addpid/W 0\ncore_addpid?W 0" | adb -o -w /stand/vmunix /dev/kmem;;
stat) echo "core_addpid/D\ncore_addpid?D" | adb -o -w /stand/vmunix /dev/kmem;;
*) echo "usage $0: on|off|stat";;
esac
2. To enable or disable the feature to store the core file in a specific file, core.pid,
run the script, corepid, with the following parameter:
#<path>/corepid[on|off]
34