Skip to content

Commit 48ee217

Browse files
author
gingold
committed
libbacktrace: add support of PE/COFF
libbacktrace/ 2015-05-29 Tristan Gingold <gingold@adacore.com> * pecoff.c: New file. * Makefile.am (FORMAT_FILES): Add pecoff.c and dependencies. * Makefile.in: Regenerate. * filetype.awk: Detect pecoff. * configure.ac: Define BACKTRACE_SUPPORTS_DATA on elf platforms. Add pecoff. * btest.c (test5): Test enabled only if BACKTRACE_SUPPORTS_DATA is true. * backtrace-supported.h.in (BACKTRACE_SUPPORTS_DATA): Define. * configure: Regenerate. * pecoff.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223859 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 79d4620 commit 48ee217

File tree

9 files changed

+993
-2
lines changed

9 files changed

+993
-2
lines changed

Diff for: libbacktrace/ChangeLog

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2015-05-29 Tristan Gingold <gingold@adacore.com>
2+
3+
* pecoff.c: New file.
4+
* Makefile.am (FORMAT_FILES): Add pecoff.c and dependencies.
5+
* Makefile.in: Regenerate.
6+
* filetype.awk: Detect pecoff.
7+
* configure.ac: Define BACKTRACE_SUPPORTS_DATA on elf platforms.
8+
Add pecoff.
9+
* btest.c (test5): Test enabled only if BACKTRACE_SUPPORTS_DATA is
10+
true.
11+
* backtrace-supported.h.in (BACKTRACE_SUPPORTS_DATA): Define.
12+
* configure: Regenerate.
13+
* pecoff.c: New file.
14+
115
2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
216

317
* Makefile.in: Regenerated with automake-1.11.6.

Diff for: libbacktrace/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ BACKTRACE_FILES = \
5656

5757
FORMAT_FILES = \
5858
elf.c \
59+
pecoff.c \
5960
unknown.c
6061

6162
VIEW_FILES = \
@@ -124,6 +125,7 @@ fileline.lo: config.h backtrace.h internal.h
124125
mmap.lo: config.h backtrace.h internal.h
125126
mmapio.lo: config.h backtrace.h internal.h
126127
nounwind.lo: config.h internal.h
128+
pecoff.lo: config.h backtrace.h internal.h
127129
posix.lo: config.h backtrace.h internal.h
128130
print.lo: config.h backtrace.h internal.h
129131
read.lo: config.h backtrace.h internal.h

Diff for: libbacktrace/Makefile.in

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ BACKTRACE_FILES = \
299299

300300
FORMAT_FILES = \
301301
elf.c \
302+
pecoff.c \
302303
unknown.c
303304

304305
VIEW_FILES = \
@@ -753,6 +754,7 @@ fileline.lo: config.h backtrace.h internal.h
753754
mmap.lo: config.h backtrace.h internal.h
754755
mmapio.lo: config.h backtrace.h internal.h
755756
nounwind.lo: config.h internal.h
757+
pecoff.lo: config.h backtrace.h internal.h
756758
posix.lo: config.h backtrace.h internal.h
757759
print.lo: config.h backtrace.h internal.h
758760
read.lo: config.h backtrace.h internal.h

Diff for: libbacktrace/backtrace-supported.h.in

+5
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ POSSIBILITY OF SUCH DAMAGE. */
5959
as 0. */
6060

6161
#define BACKTRACE_SUPPORTS_THREADS @BACKTRACE_SUPPORTS_THREADS@
62+
63+
/* BACKTRACE_SUPPORTS_DATA will be #defined'd as 1 if the backtrace_syminfo
64+
will work for variables. It will always work for functions. */
65+
66+
#define BACKTRACE_SUPPORTS_DATA @BACKTRACE_SUPPORTS_DATA@

Diff for: libbacktrace/btest.c

+6
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ f33 (int f1line, int f2line)
616616
return failures;
617617
}
618618

619+
#if BACKTRACE_SUPPORTS_DATA
620+
619621
int global = 1;
620622

621623
static int
@@ -684,6 +686,8 @@ test5 (void)
684686
return failures;
685687
}
686688

689+
#endif /* BACKTRACE_SUPPORTS_DATA */
690+
687691
static void
688692
error_callback_create (void *data ATTRIBUTE_UNUSED, const char *msg,
689693
int errnum)
@@ -708,7 +712,9 @@ main (int argc ATTRIBUTE_UNUSED, char **argv)
708712
test2 ();
709713
test3 ();
710714
test4 ();
715+
#if BACKTRACE_SUPPORTS_DATA
711716
test5 ();
717+
#endif
712718
#endif
713719

714720
exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);

Diff for: libbacktrace/configure

+14-2
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ NATIVE_TRUE
607607
BACKTRACE_USES_MALLOC
608608
ALLOC_FILE
609609
VIEW_FILE
610+
BACKTRACE_SUPPORTS_DATA
610611
BACKTRACE_SUPPORTED
611612
FORMAT_FILE
612613
BACKTRACE_SUPPORTS_THREADS
@@ -11129,7 +11130,7 @@ else
1112911130
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1113011131
lt_status=$lt_dlunknown
1113111132
cat > conftest.$ac_ext <<_LT_EOF
11132-
#line 11132 "configure"
11133+
#line 11133 "configure"
1113311134
#include "confdefs.h"
1113411135
1113511136
#if HAVE_DLFCN_H
@@ -11235,7 +11236,7 @@ else
1123511236
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1123611237
lt_status=$lt_dlunknown
1123711238
cat > conftest.$ac_ext <<_LT_EOF
11238-
#line 11238 "configure"
11239+
#line 11239 "configure"
1123911240
#include "confdefs.h"
1124011241
1124111242
#if HAVE_DLFCN_H
@@ -11826,8 +11827,12 @@ $as_echo "$libbacktrace_cv_sys_filetype" >&6; }
1182611827
1182711828
# Match the file type to decide what files to compile.
1182811829
FORMAT_FILE=
11830+
backtrace_supports_data=yes
1182911831
case "$libbacktrace_cv_sys_filetype" in
1183011832
elf*) FORMAT_FILE="elf.lo" ;;
11833+
pecoff) FORMAT_FILE="pecoff.lo"
11834+
backtrace_supports_data=no
11835+
;;
1183111836
*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine output file type" >&5
1183211837
$as_echo "$as_me: WARNING: could not determine output file type" >&2;}
1183311838
FORMAT_FILE="unknown.lo"
@@ -11841,6 +11846,7 @@ elfsize=
1184111846
case "$libbacktrace_cv_sys_filetype" in
1184211847
elf32) elfsize=32 ;;
1184311848
elf64) elfsize=64 ;;
11849+
*) elfsize=unused
1184411850
esac
1184511851
1184611852
cat >>confdefs.h <<_ACEOF
@@ -11854,6 +11860,12 @@ if test "$backtrace_supported" = "yes"; then
1185411860
fi
1185511861
1185611862
11863+
BACKTRACE_SUPPORTS_DATA=0
11864+
if test "$backtrace_supports_data" = "yes"; then
11865+
BACKTRACE_SUPPORTS_DATA=1
11866+
fi
11867+
11868+
1185711869
1185811870
1185911871
inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'`

Diff for: libbacktrace/configure.ac

+11
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ libbacktrace_cv_sys_filetype=$filetype])
229229

230230
# Match the file type to decide what files to compile.
231231
FORMAT_FILE=
232+
backtrace_supports_data=yes
232233
case "$libbacktrace_cv_sys_filetype" in
233234
elf*) FORMAT_FILE="elf.lo" ;;
235+
pecoff) FORMAT_FILE="pecoff.lo"
236+
backtrace_supports_data=no
237+
;;
234238
*) AC_MSG_WARN([could not determine output file type])
235239
FORMAT_FILE="unknown.lo"
236240
backtrace_supported=no
@@ -243,6 +247,7 @@ elfsize=
243247
case "$libbacktrace_cv_sys_filetype" in
244248
elf32) elfsize=32 ;;
245249
elf64) elfsize=64 ;;
250+
*) elfsize=unused
246251
esac
247252
AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
248253

@@ -252,6 +257,12 @@ if test "$backtrace_supported" = "yes"; then
252257
fi
253258
AC_SUBST(BACKTRACE_SUPPORTED)
254259

260+
BACKTRACE_SUPPORTS_DATA=0
261+
if test "$backtrace_supports_data" = "yes"; then
262+
BACKTRACE_SUPPORTS_DATA=1
263+
fi
264+
AC_SUBST(BACKTRACE_SUPPORTS_DATA)
265+
255266
GCC_HEADER_STDINT(gstdint.h)
256267

257268
AC_CHECK_HEADERS(sys/mman.h)

Diff for: libbacktrace/filetype.awk

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# An awk script to determine the type of a file.
22
/\177ELF\001/ { if (NR == 1) { print "elf32"; exit } }
33
/\177ELF\002/ { if (NR == 1) { print "elf64"; exit } }
4+
/\114\001/ { if (NR == 1) { print "pecoff"; exit } }
5+
/\144\206/ { if (NR == 1) { print "pecoff"; exit } }

0 commit comments

Comments
 (0)