mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-03-31 22:49:09 +08:00
libbacktrace: Add hpux fileline support
Fixes libstdc++ stacktrace tests. 2025-04-10 John David Anglin <danglin@gcc.gnu.org> libbacktrace/ChangeLog: * fileline.c (hpux_get_executable_path): New. (fileline_initialize): Add pass to get hpux executable path.
This commit is contained in:
committed by
Ian Lance Taylor
parent
0bb163df97
commit
793921876c
36
fileline.c
36
fileline.c
@@ -47,6 +47,10 @@ POSSIBILITY OF SUCH DAMAGE. */
|
|||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __hpux__
|
||||||
|
#include <dl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
#ifdef HAVE_WINDOWS_H
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@@ -66,6 +70,33 @@ POSSIBILITY OF SUCH DAMAGE. */
|
|||||||
#define getexecname() NULL
|
#define getexecname() NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __hpux__
|
||||||
|
static char *
|
||||||
|
hpux_get_executable_path (struct backtrace_state *state,
|
||||||
|
backtrace_error_callback error_callback, void *data)
|
||||||
|
{
|
||||||
|
struct shl_descriptor *desc;
|
||||||
|
size_t len = sizeof (struct shl_descriptor);
|
||||||
|
|
||||||
|
desc = backtrace_alloc (state, len, error_callback, data);
|
||||||
|
if (desc == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (shl_get_r (0, desc) == -1)
|
||||||
|
{
|
||||||
|
backtrace_free (state, desc, len, error_callback, data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc->filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define hpux_get_executable_path(state, error_callback, data) NULL
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined (HAVE_KERN_PROC_ARGS) && !defined (HAVE_KERN_PROC)
|
#if !defined (HAVE_KERN_PROC_ARGS) && !defined (HAVE_KERN_PROC)
|
||||||
|
|
||||||
#define sysctl_exec_name1(state, error_callback, data) NULL
|
#define sysctl_exec_name1(state, error_callback, data) NULL
|
||||||
@@ -245,7 +276,7 @@ fileline_initialize (struct backtrace_state *state,
|
|||||||
|
|
||||||
descriptor = -1;
|
descriptor = -1;
|
||||||
called_error_callback = 0;
|
called_error_callback = 0;
|
||||||
for (pass = 0; pass < 10; ++pass)
|
for (pass = 0; pass < 11; ++pass)
|
||||||
{
|
{
|
||||||
int does_not_exist;
|
int does_not_exist;
|
||||||
|
|
||||||
@@ -285,6 +316,9 @@ fileline_initialize (struct backtrace_state *state,
|
|||||||
case 9:
|
case 9:
|
||||||
filename = windows_get_executable_path (buf, error_callback, data);
|
filename = windows_get_executable_path (buf, error_callback, data);
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
filename = hpux_get_executable_path (state, error_callback, data);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user