Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
36b21390
Commit
36b21390
authored
Oct 23, 2015
by
Ben Gamari
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rts: Expose more libdw symbols
parent
70ee6389
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
19 deletions
+37
-19
includes/rts/Libdw.h
includes/rts/Libdw.h
+9
-5
rts/Libdw.c
rts/Libdw.c
+18
-4
rts/Libdw.h
rts/Libdw.h
+0
-10
rts/RtsSymbols.c
rts/RtsSymbols.c
+10
-0
No files found.
includes/rts/Libdw.h
View file @
36b21390
...
...
@@ -77,14 +77,18 @@ typedef struct Location_ {
StgWord32
colno
;
}
__attribute__
((
packed
))
Location
;
#ifdef USE_LIBDW
struct
LibdwSession_
;
typedef
struct
LibdwSession_
LibdwSession
;
/* Free a backtrace */
void
backtraceFree
(
Backtrace
*
bt
);
#else
/* Request a backtrace of the current stack state.
* May return NULL if a backtrace can't be acquired. */
Backtrace
*
libdwGetBacktrace
(
LibdwSession
*
session
);
INLINE_HEADER
void
backtraceFree
(
Backtrace
*
bt
STG_UNUSED
)
{
}
#endif
/* USE_LIBDW */
/* Lookup Location information for the given address.
* Returns 0 if successful, 1 if address could not be found. */
int
libdwLookupLocation
(
LibdwSession
*
session
,
Location
*
loc
,
StgPtr
pc
);
#endif
/* RTS_LIBDW_H */
rts/Libdw.c
View file @
36b21390
...
...
@@ -6,16 +6,16 @@
*
* --------------------------------------------------------------------------*/
#include "Rts.h"
#include "RtsUtils.h"
#include "Libdw.h"
#ifdef USE_LIBDW
#include <elfutils/libdwfl.h>
#include <dwarf.h>
#include <unistd.h>
#include "Rts.h"
#include "Libdw.h"
#include "RtsUtils.h"
static
BacktraceChunk
*
backtraceAllocChunk
(
BacktraceChunk
*
next
)
{
BacktraceChunk
*
chunk
=
stgMallocBytes
(
sizeof
(
BacktraceChunk
),
"backtraceAllocChunk"
);
...
...
@@ -329,4 +329,18 @@ static const Dwfl_Thread_Callbacks thread_cbs = {
.
set_initial_registers
=
set_initial_registers
,
};
#else
/* !USE_LIBDW */
void
backtraceFree
(
Backtrace
*
bt
STG_UNUSED
)
{
}
Backtrace
*
libdwGetBacktrace
(
LibdwSession
*
session
STG_UNUSED
)
{
return
NULL
;
}
int
libdwLookupLocation
(
LibdwSession
*
session
STG_UNUSED
,
Location
*
loc
STG_UNUSED
,
StgPtr
pc
STG_UNUSED
)
{
return
1
;
}
#endif
/* USE_LIBDW */
rts/Libdw.h
View file @
36b21390
...
...
@@ -18,22 +18,12 @@
#ifdef USE_LIBDW
struct
LibdwSession_
;
typedef
struct
LibdwSession_
LibdwSession
;
/* Begin a libdw session. A session is tied to a particular capability */
LibdwSession
*
libdwInit
(
void
);
/* Free a session */
void
libdwFree
(
LibdwSession
*
session
);
/* Request a backtrace of the current stack state */
Backtrace
*
libdwGetBacktrace
(
LibdwSession
*
session
);
/* Lookup Location information for the given address.
* Returns 0 if successful, 1 if address could not be found. */
int
libdwLookupLocation
(
LibdwSession
*
session
,
Location
*
loc
,
StgPtr
pc
);
/* Pretty-print a backtrace to std*/
void
libdwPrintBacktrace
(
LibdwSession
*
session
,
FILE
*
file
,
Backtrace
*
bt
);
...
...
rts/RtsSymbols.c
View file @
36b21390
...
...
@@ -35,6 +35,15 @@
SymI_HasProto(stg_makeStableNamezh) \
SymI_HasProto(stg_finalizzeWeakzh)
#if defined(USE_LIBDW)
#define RTS_LIBDW_SYMBOLS \
SymE_HasProto(backtraceFree) \
SymE_HasProto(libdwGetBacktrace) \
SymE_HasProto(libdwLookupLocation)
#else
#define RTS_LIBDW_SYMBOLS
#endif
/* USE_LIBDW */
#if !defined (mingw32_HOST_OS)
#define RTS_POSIX_ONLY_SYMBOLS \
SymI_HasProto(__hscore_get_saved_termios) \
...
...
@@ -667,6 +676,7 @@
Maybe_Stable_Names \
RTS_TICKY_SYMBOLS \
RTS_PROF_SYMBOLS \
RTS_LIBDW_SYMBOLS \
SymI_HasProto(StgReturn) \
SymI_HasProto(stg_gc_noregs) \
SymI_HasProto(stg_ret_v_info) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment