Operating System - HP-UX
1819796 Members
3120 Online
109607 Solutions
New Discussion

Stripping debug symbols from the executables and the shared libraries

 
sandeeptt
Occasional Visitor

Stripping debug symbols from the executables and the shared libraries

Hi,

I'm building Postgres (C/C++ builds) on HP-UX B.11.31 (IA64) with aCC compiler using "-g" flag. My goal is to strip the symbols and store it in a seperate files so that they can be used to debug a coredump.

On Linux, I use the objcopy and strip commands for the executable and the shared libraries as below;

$OBJCOPY --only-keep-debug "${tostripfile}" "${STAGING_DIR}/symbols/${tostripfile}.symbols"
$STRIP --strip-debug --strip-unneeded "${tostripfile}"
$OBJCOPY --add-gnu-debuglink="${STAGING_DIR}/symbols/${tostripfile}.symbols" "${tostripfile}"

where {tostripfile} points to an executable or a shared library. How do I do it on HP-UX?

Also, on RHEL the file command generally mentioned if the executable is stripped or non-stripped. But that doesn't seem to be the case on HP-UX so how can I find out if the executable if stripped or not?

1 REPLY 1
NayakSandeep
HPE Pro

Re: Stripping debug symbols from the executables and the shared libraries

when compiling with -g the .o file contains the debug info. 

hpux by default puts the debug info into the .o

but the -s or strip command removes all info from the target file.

if the goal is to remove the debug info from the binary, its already done.

UNIQX