summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-27 13:02:34 -0700
committerAlex Crichton <alex@alexcrichton.com>2018-05-30 05:58:20 -0700
commit1402a106bd66b88750f3cd255eb77451c3f432e6 (patch)
tree5be91f54dc3ca1c50deac25356ced3be69f96ccd
parentAuto merge of #51106 - davidtwco:issue-50934, r=nikomatsakis (diff)
downloadgrust-1402a106bd66b88750f3cd255eb77451c3f432e6.tar.gz
grust-1402a106bd66b88750f3cd255eb77451c3f432e6.tar.bz2
grust-1402a106bd66b88750f3cd255eb77451c3f432e6.tar.xz
std: Delete bundled libbacktrace module
-rw-r--r--src/libbacktrace/ChangeLog590
-rw-r--r--src/libbacktrace/ChangeLog.jit14
-rw-r--r--src/libbacktrace/Makefile.am136
-rw-r--r--src/libbacktrace/Makefile.in770
-rw-r--r--src/libbacktrace/README23
-rw-r--r--src/libbacktrace/aclocal.m4683
-rw-r--r--src/libbacktrace/alloc.c156
-rw-r--r--src/libbacktrace/ansidecl.h329
-rw-r--r--src/libbacktrace/atomic.c113
-rw-r--r--src/libbacktrace/backtrace-supported.h.in66
-rw-r--r--src/libbacktrace/backtrace.c129
-rw-r--r--src/libbacktrace/backtrace.h199
-rw-r--r--src/libbacktrace/btest.c721
-rw-r--r--src/libbacktrace/config.h.in134
-rw-r--r--src/libbacktrace/config.sub1836
-rwxr-xr-xsrc/libbacktrace/configure15199
-rw-r--r--src/libbacktrace/configure.ac418
-rw-r--r--src/libbacktrace/dwarf.c3038
-rw-r--r--src/libbacktrace/dwarf2.def713
-rw-r--r--src/libbacktrace/dwarf2.h430
-rw-r--r--src/libbacktrace/elf.c979
-rw-r--r--src/libbacktrace/fileline.c194
-rw-r--r--src/libbacktrace/filenames.h99
-rw-r--r--src/libbacktrace/filetype.awk11
-rw-r--r--src/libbacktrace/hashtab.h204
-rw-r--r--src/libbacktrace/install-sh501
-rw-r--r--src/libbacktrace/internal.h294
-rw-r--r--src/libbacktrace/ltmain.sh8636
-rw-r--r--src/libbacktrace/macho.c1416
-rw-r--r--src/libbacktrace/mmap.c303
-rw-r--r--src/libbacktrace/mmapio.c100
-rw-r--r--src/libbacktrace/nounwind.c66
-rw-r--r--src/libbacktrace/pecoff.c942
-rw-r--r--src/libbacktrace/posix.c100
-rw-r--r--src/libbacktrace/print.c92
-rw-r--r--src/libbacktrace/read.c96
-rw-r--r--src/libbacktrace/simple.c108
-rw-r--r--src/libbacktrace/sort.c108
-rw-r--r--src/libbacktrace/state.c72
-rw-r--r--src/libbacktrace/stest.c137
-rw-r--r--src/libbacktrace/unknown.c64
41 files changed, 0 insertions, 40219 deletions
diff --git a/src/libbacktrace/ChangeLog b/src/libbacktrace/ChangeLog
deleted file mode 100644
index acc07047f6..0000000000
--- a/src/libbacktrace/ChangeLog
+++ /dev/null
@@ -1,590 +0,0 @@
12016-05-18 Uros Bizjak <ubizjak@gmail.com>
2
3 PR target/71161
4 * elf.c (phdr_callback) [__i386__]: Add
5 __attribute__((__force_align_arg_pointer__)).
6
72016-03-02 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
8
9 * elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to
10 avoid possible crash.
11 (elf_add): Don't set *fileline_fn to elf_nodebug value in case of
12 missing debug info anymore.
13
142016-02-06 John David Anglin <danglin@gcc.gnu.org>
15
16 * mmap.c (MAP_FAILED): Define if not defined.
17
182016-01-04 Jakub Jelinek <jakub@redhat.com>
19
20 Update copyright years.
21
222015-12-18 Andris Pavenis <andris.pavenis@iki.fi>
23
24 * configure.ac: Specify that DJGPP do not have mmap
25 even when sys/mman.h exists.
26 * configure: Regenerate
27
282015-12-09 John David Anglin <danglin@gcc.gnu.org>
29
30 PR libgfortran/68115
31 * configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
32 * configure: Regenerate.
33 * elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
34 to void.
35
362015-09-17 Ian Lance Taylor <iant@google.com>
37
38 * posix.c (backtrace_open): Cast second argument of open() to int.
39
402015-09-11 Ian Lance Taylor <iant@google.com>
41
42 * Makefile.am (backtrace.lo): Depend on internal.h.
43 (sort.lo, stest.lo): Add explicit dependencies.
44 * Makefile.in: Rebuild.
45
462015-09-09 Hans-Peter Nilsson <hp@axis.com>
47
48 * backtrace.c: #include <sys/types.h>.
49
502015-09-08 Ian Lance Taylor <iant@google.com>
51
52 PR other/67457
53 * backtrace.c: #include "internal.h".
54 (struct backtrace_data): Add can_alloc field.
55 (unwind): If can_alloc is false, don't try to get file/line
56 information.
57 (backtrace_full): Set can_alloc field in bdata.
58 * alloc.c (backtrace_alloc): Don't call error_callback if it is
59 NULL.
60 * mmap.c (backtrace_alloc): Likewise.
61 * internal.h: Update comments for backtrace_alloc and
62 backtrace_free.
63
642015-09-08 Ian Lance Taylor <iant@google.com>
65
66 PR other/67457
67 * mmap.c (backtrace_alloc): Correct test for mmap failure.
68
692015-08-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
70
71 * configure.ac: For spu-*-* targets, set have_fcntl to no.
72 * configure: Regenerate.
73
742015-08-27 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
75
76 * configure.ac: Remove [disable-shared] argument to LT_INIT.
77 Remove setting PIC_FLAG when building as target library.
78 * configure: Regenerate.
79
802015-08-26 Hans-Peter Nilsson <hp@axis.com>
81
82 * configure.ac: Only compile with -fPIC if the target
83 supports it.
84 * configure: Regenerate.
85
862015-08-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
87
88 * configure.ac: Set have_mmap to no on spu-*-* targets.
89 * configure: Regenerate.
90
912015-08-13 Ian Lance Taylor <iant@google.com>
92
93 * dwarf.c (read_function_entry): Add vec_inlined parameter.
94 Change all callers.
95
962015-06-11 Martin Sebor <msebor@redhat.com>
97
98 PR sanitizer/65479
99 * dwarf.c (struct line): Add new field idx.
100 (line_compare): Use it.
101 (add_line): Set it.
102 (read_line_info): Reset it.
103
1042015-05-29 Tristan Gingold <gingold@adacore.com>
105
106 * pecoff.c: New file.
107 * Makefile.am (FORMAT_FILES): Add pecoff.c and dependencies.
108 * Makefile.in: Regenerate.
109 * filetype.awk: Detect pecoff.
110 * configure.ac: Define BACKTRACE_SUPPORTS_DATA on elf platforms.
111 Add pecoff.
112 * btest.c (test5): Test enabled only if BACKTRACE_SUPPORTS_DATA is
113 true.
114 * backtrace-supported.h.in (BACKTRACE_SUPPORTS_DATA): Define.
115 * configure: Regenerate.
116 * pecoff.c: New file.
117
1182015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
119
120 * Makefile.in: Regenerated with automake-1.11.6.
121 * aclocal.m4: Likewise.
122 * configure: Likewise.
123
1242015-01-24 Matthias Klose <doko@ubuntu.com>
125
126 * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
127 * configure: Regenerate.
128
1292015-01-05 Jakub Jelinek <jakub@redhat.com>
130
131 Update copyright years.
132
1332014-11-21 H.J. Lu <hongjiu.lu@intel.com>
134
135 PR bootstrap/63784
136 * configure: Regenerated.
137
1382014-11-11 David Malcolm <dmalcolm@redhat.com>
139
140 * ChangeLog.jit: New.
141
1422014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
143
144 PR target/63610
145 * configure: Regenerate.
146
1472014-10-23 Ian Lance Taylor <iant@google.com>
148
149 * internal.h (backtrace_atomic_load_pointer) [no atomic or sync]:
150 Fix to return void *.
151
1522014-05-08 Ian Lance Taylor <iant@google.com>
153
154 * mmap.c (backtrace_free): If freeing a large aligned block of
155 memory, call munmap rather than holding onto it.
156 (backtrace_vector_grow): When growing a vector, double the number
157 of pages requested. When releasing the old version of a grown
158 vector, pass the correct size to backtrace_free.
159
1602014-03-07 Ian Lance Taylor <iant@google.com>
161
162 * sort.c (backtrace_qsort): Use middle element as pivot.
163
1642014-03-06 Ian Lance Taylor <iant@google.com>
165
166 * sort.c: New file.
167 * stest.c: New file.
168 * internal.h (backtrace_qsort): Declare.
169 * dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort.
170 (read_line_info, read_function_entry): Likewise.
171 (read_function_info, build_dwarf_data): Likewise.
172 * elf.c (elf_initialize_syminfo): Likewise.
173 * Makefile.am (libbacktrace_la_SOURCES): Add sort.c.
174 (stest_SOURCES, stest_LDADD): Define.
175 (check_PROGRAMS): Add stest.
176
1772014-02-07 Misty De Meo <misty@brew.sh>
178
179 PR target/58710
180 * configure.ac: Use AC_LINK_IFELSE in check for
181 _Unwind_GetIPInfo.
182 * configure: Regenerate.
183
1842014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
185
186 Update copyright years
187
1882013-12-06 Jakub Jelinek <jakub@redhat.com>
189
190 * elf.c (ET_DYN): Undefine and define again.
191 (elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN,
192 return early -1 without closing the descriptor.
193 (struct phdr_data): Add exe_descriptor.
194 (phdr_callback): If pd->exe_descriptor is not -1, for very first
195 call if dlpi_name is NULL just call elf_add with the exe_descriptor,
196 otherwise backtrace_close the exe_descriptor if not -1. Adjust
197 call to elf_add.
198 (backtrace_initialize): Adjust call to elf_add. If it returns
199 -1, set pd.exe_descriptor to descriptor, otherwise set it to -1.
200
2012013-12-05 Ian Lance Taylor <iant@google.com>
202
203 * alloc.c (backtrace_vector_finish): Add error_callback and data
204 parameters. Call backtrace_vector_release. Return address base.
205 * mmap.c (backtrace_vector_finish): Add error_callback and data
206 parameters. Return address base.
207 * dwarf.c (read_function_info): Get new address base from
208 backtrace_vector_finish.
209 * internal.h (backtrace_vector_finish): Update declaration.
210
2112013-11-27 Ian Lance Taylor <iant@google.com>
212
213 * dwarf.c (find_address_ranges): New static function, broken out
214 of build_address_map.
215 (build_address_map): Call it.
216 * btest.c (check): Check for missing filename or function, rather
217 than crashing.
218 (f3): Check that enough frames were returned.
219
2202013-11-19 Jakub Jelinek <jakub@redhat.com>
221
222 * backtrace.h (backtrace_syminfo_callback): Add symsize argument.
223 * elf.c (elf_syminfo): Pass 0 or sym->size to the callback as
224 last argument.
225 * btest.c (struct symdata): Add size field.
226 (callback_three): Add symsize argument. Copy it to the data->size
227 field.
228 (f23): Set symdata.size to 0.
229 (test5): Likewise. If sizeof (int) > 1, lookup address of
230 ((uintptr_t) &global) + 1. Verify symdata.val and symdata.size
231 values.
232
233 * atomic.c: Include sys/types.h.
234
2352013-11-18 Ian Lance Taylor <iant@google.com>
236
237 * configure.ac: Check for support of __atomic extensions.
238 * internal.h: Declare or #define atomic functions for use in
239 backtrace code.
240 * atomic.c: New file.
241 * dwarf.c (dwarf_lookup_pc): Use atomic functions.
242 (dwarf_fileline, backtrace_dwarf_add): Likewise.
243 * elf.c (elf_add_syminfo_data, elf_syminfo): Likewise.
244 (backtrace_initialize): Likewise.
245 * fileline.c (fileline_initialize): Likewise.
246 * Makefile.am (libbacktrace_la_SOURCES): Add atomic.c.
247 * configure, config.h.in, Makefile.in: Rebuild.
248
2492013-11-18 Jakub Jelinek <jakub@redhat.com>
250
251 * elf.c (SHN_UNDEF): Define.
252 (elf_initialize_syminfo): Add base_address argument. Ignore symbols
253 with st_shndx == SHN_UNDEF. Add base_address to address fields.
254 (elf_add): Adjust caller.
255
256 * elf.c (phdr_callback): Process info->dlpi_addr == 0 normally.
257
2582013-11-16 Ian Lance Taylor <iant@google.com>
259
260 * backtrace.h (backtrace_create_state): Correct comment about
261 threading.
262
2632013-11-15 Ian Lance Taylor <iant@google.com>
264
265 * backtrace.h (backtrace_syminfo): Update comment and parameter
266 name to take any address, not just a PC value.
267 * elf.c (STT_OBJECT): Define.
268 (elf_nosyms): Rename parameter pc to addr.
269 (elf_symbol_search): Rename local variable pc to addr.
270 (elf_initialize_syminfo): Add STT_OBJECT symbols to elf_symbols.
271 (elf_syminfo): Rename parameter pc to addr.
272 * btest.c (global): New global variable.
273 (test5): New test.
274 (main): Call test5.
275
2762013-10-17 Ian Lance Taylor <iant@google.com>
277
278 * elf.c (elf_add): Don't get the wrong offsets if a debug section
279 is missing.
280
2812013-10-15 David Malcolm <dmalcolm@redhat.com>
282
283 * configure.ac: Add --enable-host-shared, setting up
284 pre-existing PIC_FLAG variable within Makefile.am et al.
285 * configure: Regenerate.
286
2872013-09-20 Alan Modra <amodra@gmail.com>
288
289 * configure: Regenerate.
290
2912013-07-23 Alexander Monakov <amonakov@ispras.ru>
292
293 * elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.
294
2952013-07-23 Alexander Monakov <amonakov@ispras.ru>
296
297 * elf.c (backtrace_initialize): Pass elf_fileline_fn to
298 dl_iterate_phdr callbacks.
299
3002013-03-25 Ian Lance Taylor <iant@google.com>
301
302 * alloc.c: #include <sys/types.h>.
303 * mmap.c: Likewise.
304
3052013-01-31 Ian Lance Taylor <iant@google.com>
306
307 * dwarf.c (read_function_info): Permit fvec parameter to be NULL.
308 (dwarf_lookup_pc): Don't use ddata->fvec if threaded.
309
3102013-01-25 Jakub Jelinek <jakub@redhat.com>
311
312 PR other/56076
313 * dwarf.c (read_line_header): Don't crash if DW_AT_comp_dir
314 attribute was not seen.
315
3162013-01-16 Ian Lance Taylor <iant@google.com>
317
318 * dwarf.c (struct unit): Add filename and abs_filename fields.
319 (build_address_map): Set new fields when reading unit.
320 (dwarf_lookup_pc): If we don't find an entry in the line table,
321 just return the main file name.
322
3232013-01-14 Richard Sandiford <rdsandiford@googlemail.com>
324
325 Update copyright years.
326
3272013-01-01 Ian Lance Taylor <iant@google.com>
328
329 PR bootstrap/54834
330 * Makefile.am (AM_CPPFLAGS): Remove -I ../gcc/include and -I
331 $(MULTIBUILDTOP)/../../gcc/include.
332 * Makefile.in: Rebuild.
333
3342013-01-01 Ian Lance Taylor <iant@google.com>
335
336 PR other/55536
337 * mmap.c (backtrace_alloc): Don't call sync functions if not
338 threaded.
339 (backtrace_free): Likewise.
340
3412012-12-12 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
342
343 * mmapio.c: Define MAP_FAILED if not defined.
344
3452012-12-11 Jakub Jelinek <jakub@redhat.com>
346
347 PR bootstrap/54926
348 * Makefile.am (AM_CFLAGS): Remove -frandom-seed=$@.
349 * configure.ac: If --with-target-subdir, add -frandom-seed=$@
350 to EXTRA_FLAGS unconditionally, otherwise check whether the compiler
351 accepts it.
352 * Makefile.in: Regenerated.
353 * configure: Regenerated.
354
3552012-12-07 Jakub Jelinek <jakub@redhat.com>
356
357 PR bootstrap/54926
358 * Makefile.am (AM_CFLAGS): Add -frandom-seed=$@.
359 * Makefile.in: Regenerated.
360
3612012-11-20 Ian Lance Taylor <iant@google.com>
362
363 * dwarf.c (read_attribute): Always clear val.
364
3652012-11-13 Ian Lance Taylor <iant@google.com>
366
367 PR other/55312
368 * configure.ac: Only add -Werror if building a target library.
369 * configure: Rebuild.
370
3712012-11-12 Ian Lance Taylor <iant@google.com>
372 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
373 Gerald Pfeifer <gerald@pfeifer.com>
374
375 * configure.ac: Check for getexecname.
376 * fileline.c: #include <errno.h>. Define getexecname if not
377 available.
378 (fileline_initialize): Try to find the executable in a few
379 different ways.
380 * print.c (error_callback): Only print the filename if it came
381 from the backtrace state.
382 * configure, config.h.in: Rebuild.
383
3842012-10-29 Ian Lance Taylor <iant@google.com>
385
386 * mmap.c (backtrace_vector_release): Correct last patch: add
387 aligned, not size.
388
3892012-10-29 Ian Lance Taylor <iant@google.com>
390
391 * mmap.c (backtrace_vector_release): Make sure freed block is
392 aligned on 8-byte boundary.
393
3942012-10-26 Ian Lance Taylor <iant@google.com>
395
396 PR other/55087
397 * posix.c (backtrace_open): Add does_not_exist parameter.
398 * elf.c (phdr_callback): Do not warn if shared library could not
399 be opened.
400 * fileline.c (fileline_initialize): Update calls to
401 backtrace_open.
402 * internal.h (backtrace_open): Update declaration.
403
4042012-10-26 Jack Howarth <howarth@bromo.med.uc.edu>
405
406 PR target/55061
407 * configure.ac: Check for _Unwind_GetIPInfo function declaration.
408 * configure: Regenerate.
409
4102012-10-24 Ian Lance Taylor <iant@google.com>
411
412 PR target/55061
413 * configure.ac: Check whether -funwind-tables option works.
414 * configure: Rebuild.
415
4162012-10-11 Ian Lance Taylor <iant@google.com>
417
418 * configure.ac: Do not use dl_iterate_phdr on Solaris 10.
419 * configure: Rebuild.
420
4212012-10-10 Ian Lance Taylor <iant@google.com>
422
423 * elf.c: Rename all Elf typedefs to start with b_elf, and be all
424 lower case.
425
4262012-10-10 Hans-Peter Nilsson <hp@bitrange.com>
427
428 * elf.c (elf_add_syminfo_data): Add casts to avoid warning.
429
4302012-10-09 Ian Lance Taylor <iant@google.com>
431
432 * dwarf.c (dwarf_fileline): Add cast to avoid warning.
433 (backtrace_dwarf_add): Likewise.
434
4352012-10-09 Ian Lance Taylor <iant@google.com>
436
437 Add support for tracing through shared libraries.
438 * configure.ac: Check for link.h and dl_iterate_phdr.
439 * elf.c: #include <link.h> if system has dl_iterate_phdr. #undef
440 ELF macros before #defining them.
441 (dl_phdr_info, dl_iterate_phdr): Define if system does not have
442 dl_iterate_phdr.
443 (struct elf_syminfo_data): Add next field.
444 (elf_initialize_syminfo): Initialize next field.
445 (elf_add_syminfo_data): New static function.
446 (elf_add): New static function, broken out of
447 backtrace_initialize. Call backtrace_dwarf_add instead of
448 backtrace_dwarf_initialize.
449 (struct phdr_data): Define.
450 (phdr_callback): New static function.
451 (backtrace_initialize): Call elf_add.
452 * dwarf.c (struct dwarf_data): Add next and base_address fields.
453 (add_unit_addr): Add base_address parameter. Change all callers.
454 (add_unit_ranges, build_address_map): Likewise.
455 (add_line): Add ddata parameter. Change all callers.
456 (read_line_program, add_function_range): Likewise.
457 (dwarf_lookup_pc): New static function, broken out of
458 dwarf_fileline.
459 (dwarf_fileline): Call dwarf_lookup_pc.
460 (build_dwarf_data): New static function.
461 (backtrace_dwarf_add): New function.
462 (backtrace_dwarf_initialize): Remove.
463 * internal.h (backtrace_dwarf_initialize): Don't declare.
464 (backtrace_dwarf_add): Declare.
465 * configure, config.h.in: Rebuild.
466
4672012-10-04 Gerald Pfeifer <gerald@pfeifer.com>
468
469 * btest.c (f23): Avoid uninitialized variable warning.
470
4712012-10-04 Ian Lance Taylor <iant@google.com>
472
473 * dwarf.c: If the system header files do not declare strnlen,
474 provide our own version.
475
4762012-10-03 Ian Lance Taylor <iant@google.com>
477
478 * dwarf.c (read_uleb128): Fix overflow test.
479 (read_sleb128): Likewise.
480 (build_address_map): Don't change unit_buf.start.
481
4822012-10-02 Uros Bizjak <ubizjak@gmail.com>
483
484 PR other/54761
485 * configure.ac (EXTRA_FLAGS): New.
486 * Makefile.am (AM_FLAGS): Add $(EXTRA_FLAGS).
487 * configure, Makefile.in: Regenerate.
488
4892012-09-29 Ian Lance Taylor <iant@google.com>
490
491 PR other/54749
492 * fileline.c (fileline_initialize): Pass errnum as -1 when
493 reporting that we could not read executable information after a
494 previous failure.
495
4962012-09-27 Ian Lance Taylor <iant@google.com>
497
498 PR bootstrap/54732
499 * configure.ac: Add no-dependencies to AM_INIT_AUTOMAKE.
500 * Makefile.am: Add dependencies for all objects.
501 * configure, aclocal.m4, Makefile.in: Rebuild.
502
5032012-09-27 Ian Lance Taylor <iant@google.com>
504
505 PR other/54726
506 * elf.c (backtrace_initialize): Set *fileln_fn, not
507 state->fileln_fn.
508
5092012-09-19 Ian Lance Taylor <iant@google.com>
510
511 * configure.ac: Only use GCC_CHECK_UNWIND_GETIPINFO when compiled
512 as a target library.
513 * configure: Rebuild.
514
5152012-09-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
516 Ian Lance Taylor <iant@google.com>
517
518 * configure.ac (GCC_HEADER_STDINT): Invoke.
519 * backtrace.h: If we can't find <stdint.h>, use "gstdint.h".
520 * btest.c: Don't include <stdint.h>.
521 * dwarf.c: Likewise.
522 * configure, aclocal.m4, Makefile.in, config.h.in: Rebuild.
523
5242012-09-18 Ian Lance Taylor <iant@google.com>
525
526 PR bootstrap/54623
527 * Makefile.am (AM_CPPFLAGS): Define.
528 (AM_CFLAGS): Remove -I options.
529 * Makefile.in: Rebuild.
530
5312012-09-18 Ian Lance Taylor <iant@google.com>
532
533 * posix.c (O_BINARY): Define if not defined.
534 (backtrace_open): Pass O_BINARY to open. Only call fcntl if
535 HAVE_FCNTL is defined.
536 * configure.ac: Test for the fcntl function.
537 * configure, config.h.in: Rebuild.
538
5392012-09-18 Ian Lance Taylor <iant@google.com>
540
541 * btest.c (test1, test2, test3, test4): Add the unused attribute.
542
5432012-09-18 Ian Lance Taylor <iant@google.com>
544
545 * dwarf.c: Correct test of HAVE_DECL_STRNLEN.
546
5472012-09-18 Ian Lance Taylor <iant@google.com>
548
549 * configure.ac: Add AC_USE_SYSTEM_EXTENSIONS.
550 * mmapio.c: Don't define _GNU_SOURCE.
551 * configure, config.h.in: Rebuild.
552
5532012-09-18 Ian Lance Taylor <iant@google.com>
554
555 * configure.ac: Check whether strnlen is declared.
556 * dwarf.c: Declare strnlen if not declared.
557 * configure, config.h.in: Rebuild.
558
5592012-09-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
560
561 * fileline.c: Include <stdlib.h>.
562 * mmap.c: Likewise.
563
5642012-09-17 Ian Lance Taylor <iant@google.com>
565
566 PR bootstrap/54611
567 * nounwind.c (backtrace_full): Rename from backtrace. Add state
568 parameter.
569
5702012-09-17 Gerald Pfeifer <gerald@pfeifer.com>
571
572 PR bootstrap/54611
573 * nounwind.c (backtrace_simple): Add state parameter.
574
5752012-09-17 Ian Lance Taylor <iant@google.com>
576
577 PR bootstrap/54609
578 * unknown.c (unknown_fileline): Add state parameter, remove
579 fileline_data parameter, name error_callback parameter.
580 (backtrace_initialize): Add state parameter.
581
5822012-09-17 Ian Lance Taylor <iant@google.com>
583
584 * Initial implementation.
585
586Copyright (C) 2012-2016 Free Software Foundation, Inc.
587
588Copying and distribution of this file, with or without modification,
589are permitted in any medium without royalty provided the copyright
590notice and this notice are preserved.
diff --git a/src/libbacktrace/ChangeLog.jit b/src/libbacktrace/ChangeLog.jit
deleted file mode 100644
index 6b60e3b3b0..0000000000
--- a/src/libbacktrace/ChangeLog.jit
+++ /dev/null
@@ -1,14 +0,0 @@
12014-09-24 David Malcolm <dmalcolm@redhat.com>
2
3 * ChangeLog.jit: Add copyright footer.
4
52013-10-03 David Malcolm <dmalcolm@redhat.com>
6
7 * configure.ac: Add --enable-host-shared.
8 * configure: Regenerate.
9
10Copyright (C) 2013-2014 Free Software Foundation, Inc.
11
12Copying and distribution of this file, with or without modification,
13are permitted in any medium without royalty provided the copyright
14notice and this notice are preserved.
diff --git a/src/libbacktrace/Makefile.am b/src/libbacktrace/Makefile.am
deleted file mode 100644
index a7df025909..0000000000
--- a/src/libbacktrace/Makefile.am
+++ /dev/null
@@ -1,136 +0,0 @@
1# Makefile.am -- Backtrace Makefile.
2# Copyright (C) 2012-2016 Free Software Foundation, Inc.
3
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met:
7
8# (1) Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10
11# (2) Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in
13# the documentation and/or other materials provided with the
14# distribution.
15
16# (3) The name of the author may not be used to
17# endorse or promote products derived from this software without
18# specific prior written permission.
19
20# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE.
31
32ACLOCAL_AMFLAGS = -I .. -I ../config
33
34AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
35 -I ../libgcc
36
37AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
38
39noinst_LTLIBRARIES = libbacktrace.la
40
41libbacktrace_la_SOURCES = \
42 backtrace.h \
43 atomic.c \
44 dwarf.c \
45 fileline.c \
46 internal.h \
47 posix.c \
48 print.c \
49 sort.c \
50 state.c
51
52BACKTRACE_FILES = \
53 backtrace.c \
54 simple.c \
55 nounwind.c
56
57FORMAT_FILES = \
58 elf.c \
59 pecoff.c \
60 unknown.c
61
62VIEW_FILES = \
63 read.c \
64 mmapio.c
65
66ALLOC_FILES = \
67 alloc.c \
68 mmap.c
69
70EXTRA_libbacktrace_la_SOURCES = \
71 $(BACKTRACE_FILES) \
72 $(FORMAT_FILES) \
73 $(VIEW_FILES) \
74 $(ALLOC_FILES)
75
76libbacktrace_la_LIBADD = \
77 $(BACKTRACE_FILE) \
78 $(FORMAT_FILE) \
79 $(VIEW_FILE) \
80 $(ALLOC_FILE)
81
82libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
83
84# Testsuite.
85
86check_PROGRAMS =
87
88TESTS = $(check_PROGRAMS)
89
90if NATIVE
91
92btest_SOURCES = btest.c
93btest_CFLAGS = $(AM_CFLAGS) -g -O
94btest_LDADD = libbacktrace.la
95
96check_PROGRAMS += btest
97
98stest_SOURCES = stest.c
99stest_LDADD = libbacktrace.la
100
101check_PROGRAMS += stest
102
103endif NATIVE
104
105# We can't use automake's automatic dependency tracking, because it
106# breaks when using bootstrap-lean. Automatic dependency tracking
107# with GCC bootstrap will cause some of the objects to depend on
108# header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When
109# using bootstrap-lean, prev-gcc is removed after each stage. When
110# running "make install", those header files will be gone, causing the
111# library to be rebuilt at install time. That may not succeed.
112
113# These manual dependencies do not include dependencies on unwind.h,
114# even though that is part of GCC, because where to find it depends on
115# whether we are being built as a host library or a target library.
116
117INCDIR = $(top_srcdir)/../include
118alloc.lo: config.h backtrace.h internal.h
119backtrace.lo: config.h backtrace.h internal.h
120btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
121dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
122 $(INCDIR)/filenames.h backtrace.h internal.h
123elf.lo: config.h backtrace.h internal.h
124fileline.lo: config.h backtrace.h internal.h
125mmap.lo: config.h backtrace.h internal.h
126mmapio.lo: config.h backtrace.h internal.h
127nounwind.lo: config.h internal.h
128pecoff.lo: config.h backtrace.h internal.h
129posix.lo: config.h backtrace.h internal.h
130print.lo: config.h backtrace.h internal.h
131read.lo: config.h backtrace.h internal.h
132simple.lo: config.h backtrace.h internal.h
133sort.lo: config.h backtrace.h internal.h
134stest.lo: config.h backtrace.h internal.h
135state.lo: config.h backtrace.h backtrace-supported.h internal.h
136unknown.lo: config.h backtrace.h internal.h
diff --git a/src/libbacktrace/Makefile.in b/src/libbacktrace/Makefile.in
deleted file mode 100644
index 586b6a6eaa..0000000000
--- a/src/libbacktrace/Makefile.in
+++ /dev/null
@@ -1,770 +0,0 @@
1# Makefile.in generated by automake 1.11.6 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
6# Foundation, Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18# Makefile.am -- Backtrace Makefile.
19# Copyright (C) 2012-2015 Free Software Foundation, Inc.
20
21# Redistribution and use in source and binary forms, with or without
22# modification, are permitted provided that the following conditions are
23# met:
24
25# (1) Redistributions of source code must retain the above copyright
26# notice, this list of conditions and the following disclaimer.
27
28# (2) Redistributions in binary form must reproduce the above copyright
29# notice, this list of conditions and the following disclaimer in
30# the documentation and/or other materials provided with the
31# distribution.
32
33# (3) The name of the author may not be used to
34# endorse or promote products derived from this software without
35# specific prior written permission.
36
37# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
38# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
39# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
41# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
42# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
46# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47# POSSIBILITY OF SUCH DAMAGE.
48
49VPATH = @srcdir@
50am__make_dryrun = \
51 { \
52 am__dry=no; \
53 case $$MAKEFLAGS in \
54 *\\[\ \ ]*) \
55 echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
56 | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
57 *) \
58 for am__flg in $$MAKEFLAGS; do \
59 case $$am__flg in \
60 *=*|--*) ;; \
61 *n*) am__dry=yes; break;; \
62 esac; \
63 done;; \
64 esac; \
65 test $$am__dry = yes; \
66 }
67pkgdatadir = $(datadir)/@PACKAGE@
68pkgincludedir = $(includedir)/@PACKAGE@
69pkglibdir = $(libdir)/@PACKAGE@
70pkglibexecdir = $(libexecdir)/@PACKAGE@
71am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
72install_sh_DATA = $(install_sh) -c -m 644
73install_sh_PROGRAM = $(install_sh) -c
74install_sh_SCRIPT = $(install_sh) -c
75INSTALL_HEADER = $(INSTALL_DATA)
76transform = $(program_transform_name)
77NORMAL_INSTALL = :
78PRE_INSTALL = :
79POST_INSTALL = :
80NORMAL_UNINSTALL = :
81PRE_UNINSTALL = :
82POST_UNINSTALL = :
83build_triplet = @build@
84host_triplet = @host@
85target_triplet = @target@
86check_PROGRAMS = $(am__EXEEXT_1)
87@NATIVE_TRUE@am__append_1 = btest stest
88subdir = .
89DIST_COMMON = README ChangeLog $(srcdir)/Makefile.in \
90 $(srcdir)/Makefile.am $(top_srcdir)/configure \
91 $(am__configure_deps) $(srcdir)/config.h.in \
92 $(srcdir)/../mkinstalldirs $(srcdir)/backtrace-supported.h.in
93ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
94am__aclocal_m4_deps = $(top_srcdir)/../config/lead-dot.m4 \
95 $(top_srcdir)/../config/multi.m4 \
96 $(top_srcdir)/../config/override.m4 \
97 $(top_srcdir)/../config/stdint.m4 \
98 $(top_srcdir)/../config/unwind_ipinfo.m4 \
99 $(top_srcdir)/../config/warnings.m4 \
100 $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
101 $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
102 $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
103am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
104 $(ACLOCAL_M4)
105am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
106 configure.lineno config.status.lineno
107mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
108CONFIG_HEADER = config.h
109CONFIG_CLEAN_FILES = backtrace-supported.h
110CONFIG_CLEAN_VPATH_FILES =
111LTLIBRARIES = $(noinst_LTLIBRARIES)
112am__DEPENDENCIES_1 =
113am_libbacktrace_la_OBJECTS = atomic.lo dwarf.lo fileline.lo posix.lo \
114 print.lo sort.lo state.lo
115libbacktrace_la_OBJECTS = $(am_libbacktrace_la_OBJECTS)
116@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT)
117@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT)
118btest_OBJECTS = $(am_btest_OBJECTS)
119@NATIVE_TRUE@btest_DEPENDENCIES = libbacktrace.la
120btest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
121 --mode=link $(CCLD) $(btest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
122 $(LDFLAGS) -o $@
123@NATIVE_TRUE@am_stest_OBJECTS = stest.$(OBJEXT)
124stest_OBJECTS = $(am_stest_OBJECTS)
125@NATIVE_TRUE@stest_DEPENDENCIES = libbacktrace.la
126DEFAULT_INCLUDES = -I.@am__isrc@
127depcomp =
128am__depfiles_maybe =
129COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
130 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
131LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
132 --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
133 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
134CCLD = $(CC)
135LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
136 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
137 $(LDFLAGS) -o $@
138SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \
139 $(btest_SOURCES) $(stest_SOURCES)
140MULTISRCTOP =
141MULTIBUILDTOP =
142MULTIDIRS =
143MULTISUBDIR =
144MULTIDO = true
145MULTICLEAN = true
146am__can_run_installinfo = \
147 case $$AM_UPDATE_INFO_DIR in \
148 n|no|NO) false;; \
149 *) (install-info --version) >/dev/null 2>&1;; \
150 esac
151ETAGS = etags
152CTAGS = ctags
153am__tty_colors = \
154red=; grn=; lgn=; blu=; std=
155ACLOCAL = @ACLOCAL@
156ALLOC_FILE = @ALLOC_FILE@
157AMTAR = @AMTAR@
158AR = @AR@
159AUTOCONF = @AUTOCONF@
160AUTOHEADER = @AUTOHEADER@
161AUTOMAKE = @AUTOMAKE@
162AWK = @AWK@
163BACKTRACE_FILE = @BACKTRACE_FILE@
164BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@
165BACKTRACE_SUPPORTS_DATA = @BACKTRACE_SUPPORTS_DATA@
166BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@
167BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@
168CC = @CC@
169CFLAGS = @CFLAGS@
170CPP = @CPP@
171CPPFLAGS = @CPPFLAGS@
172CYGPATH_W = @CYGPATH_W@
173DEFS = @DEFS@
174DSYMUTIL = @DSYMUTIL@
175DUMPBIN = @DUMPBIN@
176ECHO_C = @ECHO_C@
177ECHO_N = @ECHO_N@
178ECHO_T = @ECHO_T@
179EGREP = @EGREP@
180EXEEXT = @EXEEXT@
181EXTRA_FLAGS = @EXTRA_FLAGS@
182FGREP = @FGREP@
183FORMAT_FILE = @FORMAT_FILE@
184GREP = @GREP@
185INSTALL = @INSTALL@
186INSTALL_DATA = @INSTALL_DATA@
187INSTALL_PROGRAM = @INSTALL_PROGRAM@
188INSTALL_SCRIPT = @INSTALL_SCRIPT@
189INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
190LD = @LD@
191LDFLAGS = @LDFLAGS@
192LIBOBJS = @LIBOBJS@
193LIBS = @LIBS@
194LIBTOOL = @LIBTOOL@
195LIPO = @LIPO@
196LN_S = @LN_S@
197LTLIBOBJS = @LTLIBOBJS@
198MAINT = @MAINT@
199MAKEINFO = @MAKEINFO@
200MKDIR_P = @MKDIR_P@
201NM = @NM@
202NMEDIT = @NMEDIT@
203OBJDUMP = @OBJDUMP@
204OBJEXT = @OBJEXT@
205OTOOL = @OTOOL@
206OTOOL64 = @OTOOL64@
207PACKAGE = @PACKAGE@
208PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
209PACKAGE_NAME = @PACKAGE_NAME@
210PACKAGE_STRING = @PACKAGE_STRING@
211PACKAGE_TARNAME = @PACKAGE_TARNAME@
212PACKAGE_URL = @PACKAGE_URL@
213PACKAGE_VERSION = @PACKAGE_VERSION@
214PATH_SEPARATOR = @PATH_SEPARATOR@
215PIC_FLAG = @PIC_FLAG@
216RANLIB = @RANLIB@
217SED = @SED@
218SET_MAKE = @SET_MAKE@
219SHELL = @SHELL@
220STRIP = @STRIP@
221VERSION = @VERSION@
222VIEW_FILE = @VIEW_FILE@
223WARN_FLAGS = @WARN_FLAGS@
224abs_builddir = @abs_builddir@
225abs_srcdir = @abs_srcdir@
226abs_top_builddir = @abs_top_builddir@
227abs_top_srcdir = @abs_top_srcdir@
228ac_ct_CC = @ac_ct_CC@
229ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
230am__leading_dot = @am__leading_dot@
231am__tar = @am__tar@
232am__untar = @am__untar@
233bindir = @bindir@
234build = @build@
235build_alias = @build_alias@
236build_cpu = @build_cpu@
237build_os = @build_os@
238build_vendor = @build_vendor@
239builddir = @builddir@
240datadir = @datadir@
241datarootdir = @datarootdir@
242docdir = @docdir@
243dvidir = @dvidir@
244exec_prefix = @exec_prefix@
245host = @host@
246host_alias = @host_alias@
247host_cpu = @host_cpu@
248host_os = @host_os@
249host_vendor = @host_vendor@
250htmldir = @htmldir@
251includedir = @includedir@
252infodir = @infodir@
253install_sh = @install_sh@
254libdir = @libdir@
255libexecdir = @libexecdir@
256libtool_VERSION = @libtool_VERSION@
257localedir = @localedir@
258localstatedir = @localstatedir@
259mandir = @mandir@
260mkdir_p = @mkdir_p@
261multi_basedir = @multi_basedir@
262oldincludedir = @oldincludedir@
263pdfdir = @pdfdir@
264prefix = @prefix@
265program_transform_name = @program_transform_name@
266psdir = @psdir@
267sbindir = @sbindir@
268sharedstatedir = @sharedstatedir@
269srcdir = @srcdir@
270sysconfdir = @sysconfdir@
271target = @target@
272target_alias = @target_alias@
273target_cpu = @target_cpu@
274target_os = @target_os@
275target_vendor = @target_vendor@
276top_build_prefix = @top_build_prefix@
277top_builddir = @top_builddir@
278top_srcdir = @top_srcdir@
279ACLOCAL_AMFLAGS = -I .. -I ../config
280AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
281 -I ../libgcc
282
283AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
284noinst_LTLIBRARIES = libbacktrace.la
285libbacktrace_la_SOURCES = \
286 backtrace.h \
287 atomic.c \
288 dwarf.c \
289 fileline.c \
290 internal.h \
291 posix.c \
292 print.c \
293 sort.c \
294 state.c
295
296BACKTRACE_FILES = \
297 backtrace.c \
298 simple.c \
299 nounwind.c
300
301FORMAT_FILES = \
302 elf.c \
303 pecoff.c \
304 unknown.c
305
306VIEW_FILES = \
307 read.c \
308 mmapio.c
309
310ALLOC_FILES = \
311 alloc.c \
312 mmap.c
313
314EXTRA_libbacktrace_la_SOURCES = \
315 $(BACKTRACE_FILES) \
316 $(FORMAT_FILES) \
317 $(VIEW_FILES) \
318 $(ALLOC_FILES)
319
320libbacktrace_la_LIBADD = \
321 $(BACKTRACE_FILE) \
322 $(FORMAT_FILE) \
323 $(VIEW_FILE) \
324 $(ALLOC_FILE)
325
326libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
327TESTS = $(check_PROGRAMS)
328@NATIVE_TRUE@btest_SOURCES = btest.c
329@NATIVE_TRUE@btest_CFLAGS = $(AM_CFLAGS) -g -O
330@NATIVE_TRUE@btest_LDADD = libbacktrace.la
331@NATIVE_TRUE@stest_SOURCES = stest.c
332@NATIVE_TRUE@stest_LDADD = libbacktrace.la
333
334# We can't use automake's automatic dependency tracking, because it
335# breaks when using bootstrap-lean. Automatic dependency tracking
336# with GCC bootstrap will cause some of the objects to depend on
337# header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When
338# using bootstrap-lean, prev-gcc is removed after each stage. When
339# running "make install", those header files will be gone, causing the
340# library to be rebuilt at install time. That may not succeed.
341
342# These manual dependencies do not include dependencies on unwind.h,
343# even though that is part of GCC, because where to find it depends on
344# whether we are being built as a host library or a target library.
345INCDIR = $(top_srcdir)/../include
346all: config.h
347 $(MAKE) $(AM_MAKEFLAGS) all-am
348
349.SUFFIXES:
350.SUFFIXES: .c .lo .o .obj
351am--refresh: Makefile
352 @:
353$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
354 @for dep in $?; do \
355 case '$(am__configure_deps)' in \
356 *$$dep*) \
357 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps'; \
358 $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps \
359 && exit 0; \
360 exit 1;; \
361 esac; \
362 done; \
363 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps Makefile'; \
364 $(am__cd) $(top_srcdir) && \
365 $(AUTOMAKE) --foreign --ignore-deps Makefile
366.PRECIOUS: Makefile
367Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
368 @case '$?' in \
369 *config.status*) \
370 echo ' $(SHELL) ./config.status'; \
371 $(SHELL) ./config.status;; \
372 *) \
373 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
374 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
375 esac;
376
377$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
378 $(SHELL) ./config.status --recheck
379
380$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
381 $(am__cd) $(srcdir) && $(AUTOCONF)
382$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
383 $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
384$(am__aclocal_m4_deps):
385
386config.h: stamp-h1
387 @if test ! -f $@; then rm -f stamp-h1; else :; fi
388 @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
389
390stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
391 @rm -f stamp-h1
392 cd $(top_builddir) && $(SHELL) ./config.status config.h
393$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
394 ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
395 rm -f stamp-h1
396 touch $@
397
398distclean-hdr:
399 -rm -f config.h stamp-h1
400backtrace-supported.h: $(top_builddir)/config.status $(srcdir)/backtrace-supported.h.in
401 cd $(top_builddir) && $(SHELL) ./config.status $@
402
403clean-noinstLTLIBRARIES:
404 -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
405 @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
406 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
407 test "$$dir" != "$$p" || dir=.; \
408 echo "rm -f \"$${dir}/so_locations\""; \
409 rm -f "$${dir}/so_locations"; \
410 done
411libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(EXTRA_libbacktrace_la_DEPENDENCIES)
412 $(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
413
414clean-checkPROGRAMS:
415 @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
416 echo " rm -f" $$list; \
417 rm -f $$list || exit $$?; \
418 test -n "$(EXEEXT)" || exit 0; \
419 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
420 echo " rm -f" $$list; \
421 rm -f $$list
422btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) $(EXTRA_btest_DEPENDENCIES)
423 @rm -f btest$(EXEEXT)
424 $(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS)
425stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) $(EXTRA_stest_DEPENDENCIES)
426 @rm -f stest$(EXEEXT)
427 $(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
428
429mostlyclean-compile:
430 -rm -f *.$(OBJEXT)
431
432distclean-compile:
433 -rm -f *.tab.c
434
435.c.o:
436 $(COMPILE) -c $<
437
438.c.obj:
439 $(COMPILE) -c `$(CYGPATH_W) '$<'`
440
441.c.lo:
442 $(LTCOMPILE) -c -o $@ $<
443
444btest-btest.o: btest.c
445 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.o `test -f 'btest.c' || echo '$(srcdir)/'`btest.c
446
447btest-btest.obj: btest.c
448 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi`
449
450mostlyclean-libtool:
451 -rm -f *.lo
452
453clean-libtool:
454 -rm -rf .libs _libs
455
456distclean-libtool:
457 -rm -f libtool config.lt
458
459# GNU Make needs to see an explicit $(MAKE) variable in the command it
460# runs to enable its job server during parallel builds. Hence the
461# comments below.
462all-multi:
463 $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
464install-multi:
465 $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
466
467mostlyclean-multi:
468 $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
469clean-multi:
470 $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
471distclean-multi:
472 $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
473maintainer-clean-multi:
474 $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
475
476ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
477 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
478 unique=`for i in $$list; do \
479 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
480 done | \
481 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
482 END { if (nonempty) { for (i in files) print i; }; }'`; \
483 mkid -fID $$unique
484tags: TAGS
485
486TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
487 $(TAGS_FILES) $(LISP)
488 set x; \
489 here=`pwd`; \
490 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
491 unique=`for i in $$list; do \
492 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
493 done | \
494 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
495 END { if (nonempty) { for (i in files) print i; }; }'`; \
496 shift; \
497 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
498 test -n "$$unique" || unique=$$empty_fix; \
499 if test $$# -gt 0; then \
500 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
501 "$$@" $$unique; \
502 else \
503 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
504 $$unique; \
505 fi; \
506 fi
507ctags: CTAGS
508CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
509 $(TAGS_FILES) $(LISP)
510 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
511 unique=`for i in $$list; do \
512 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
513 done | \
514 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
515 END { if (nonempty) { for (i in files) print i; }; }'`; \
516 test -z "$(CTAGS_ARGS)$$unique" \
517 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
518 $$unique
519
520GTAGS:
521 here=`$(am__cd) $(top_builddir) && pwd` \
522 && $(am__cd) $(top_srcdir) \
523 && gtags -i $(GTAGS_ARGS) "$$here"
524
525distclean-tags:
526 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
527
528check-TESTS: $(TESTS)
529 @failed=0; all=0; xfail=0; xpass=0; skip=0; \
530 srcdir=$(srcdir); export srcdir; \
531 list=' $(TESTS) '; \
532 $(am__tty_colors); \
533 if test -n "$$list"; then \
534 for tst in $$list; do \
535 if test -f ./$$tst; then dir=./; \
536 elif test -f $$tst; then dir=; \
537 else dir="$(srcdir)/"; fi; \
538 if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
539 all=`expr $$all + 1`; \
540 case " $(XFAIL_TESTS) " in \
541 *[\ \ ]$$tst[\ \ ]*) \
542 xpass=`expr $$xpass + 1`; \
543 failed=`expr $$failed + 1`; \
544 col=$$red; res=XPASS; \
545 ;; \
546 *) \
547 col=$$grn; res=PASS; \
548 ;; \
549 esac; \
550 elif test $$? -ne 77; then \
551 all=`expr $$all + 1`; \
552 case " $(XFAIL_TESTS) " in \
553 *[\ \ ]$$tst[\ \ ]*) \
554 xfail=`expr $$xfail + 1`; \
555 col=$$lgn; res=XFAIL; \
556 ;; \
557 *) \
558 failed=`expr $$failed + 1`; \
559 col=$$red; res=FAIL; \
560 ;; \
561 esac; \
562 else \
563 skip=`expr $$skip + 1`; \
564 col=$$blu; res=SKIP; \
565 fi; \
566 echo "$${col}$$res$${std}: $$tst"; \
567 done; \
568 if test "$$all" -eq 1; then \
569 tests="test"; \
570 All=""; \
571 else \
572 tests="tests"; \
573 All="All "; \
574 fi; \
575 if test "$$failed" -eq 0; then \
576 if test "$$xfail" -eq 0; then \
577 banner="$$All$$all $$tests passed"; \
578 else \
579 if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
580 banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
581 fi; \
582 else \
583 if test "$$xpass" -eq 0; then \
584 banner="$$failed of $$all $$tests failed"; \
585 else \
586 if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
587 banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
588 fi; \
589 fi; \
590 dashes="$$banner"; \
591 skipped=""; \
592 if test "$$skip" -ne 0; then \
593 if test "$$skip" -eq 1; then \
594 skipped="($$skip test was not run)"; \
595 else \
596 skipped="($$skip tests were not run)"; \
597 fi; \
598 test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
599 dashes="$$skipped"; \
600 fi; \
601 report=""; \
602 if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
603 report="Please report to $(PACKAGE_BUGREPORT)"; \
604 test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
605 dashes="$$report"; \
606 fi; \
607 dashes=`echo "$$dashes" | sed s/./=/g`; \
608 if test "$$failed" -eq 0; then \
609 col="$$grn"; \
610 else \
611 col="$$red"; \
612 fi; \
613 echo "$${col}$$dashes$${std}"; \
614 echo "$${col}$$banner$${std}"; \
615 test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
616 test -z "$$report" || echo "$${col}$$report$${std}"; \
617 echo "$${col}$$dashes$${std}"; \
618 test "$$failed" -eq 0; \
619 else :; fi
620check-am: all-am
621 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
622 $(MAKE) $(AM_MAKEFLAGS) check-TESTS
623check: check-am
624all-am: Makefile $(LTLIBRARIES) all-multi config.h
625installdirs:
626install: install-am
627install-exec: install-exec-am
628install-data: install-data-am
629uninstall: uninstall-am
630
631install-am: all-am
632 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
633
634installcheck: installcheck-am
635install-strip:
636 if test -z '$(STRIP)'; then \
637 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
638 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
639 install; \
640 else \
641 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
642 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
643 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
644 fi
645mostlyclean-generic:
646
647clean-generic:
648
649distclean-generic:
650 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
651 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
652
653maintainer-clean-generic:
654 @echo "This command is intended for maintainers to use"
655 @echo "it deletes files that may require special tools to rebuild."
656clean: clean-am clean-multi
657
658clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
659 clean-noinstLTLIBRARIES mostlyclean-am
660
661distclean: distclean-am distclean-multi
662 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
663 -rm -f Makefile
664distclean-am: clean-am distclean-compile distclean-generic \
665 distclean-hdr distclean-libtool distclean-tags
666
667dvi: dvi-am
668
669dvi-am:
670
671html: html-am
672
673html-am:
674
675info: info-am
676
677info-am:
678
679install-data-am:
680
681install-dvi: install-dvi-am
682
683install-dvi-am:
684
685install-exec-am: install-multi
686
687install-html: install-html-am
688
689install-html-am:
690
691install-info: install-info-am
692
693install-info-am:
694
695install-man:
696
697install-pdf: install-pdf-am
698
699install-pdf-am:
700
701install-ps: install-ps-am
702
703install-ps-am:
704
705installcheck-am:
706
707maintainer-clean: maintainer-clean-am maintainer-clean-multi
708 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
709 -rm -rf $(top_srcdir)/autom4te.cache
710 -rm -f Makefile
711maintainer-clean-am: distclean-am maintainer-clean-generic
712
713mostlyclean: mostlyclean-am mostlyclean-multi
714
715mostlyclean-am: mostlyclean-compile mostlyclean-generic \
716 mostlyclean-libtool
717
718pdf: pdf-am
719
720pdf-am:
721
722ps: ps-am
723
724ps-am:
725
726uninstall-am:
727
728.MAKE: all all-multi check-am clean-multi distclean-multi install-am \
729 install-multi install-strip maintainer-clean-multi \
730 mostlyclean-multi
731
732.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-TESTS \
733 check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
734 clean-multi clean-noinstLTLIBRARIES ctags distclean \
735 distclean-compile distclean-generic distclean-hdr \
736 distclean-libtool distclean-multi distclean-tags dvi dvi-am \
737 html html-am info info-am install install-am install-data \
738 install-data-am install-dvi install-dvi-am install-exec \
739 install-exec-am install-html install-html-am install-info \
740 install-info-am install-man install-multi install-pdf \
741 install-pdf-am install-ps install-ps-am install-strip \
742 installcheck installcheck-am installdirs maintainer-clean \
743 maintainer-clean-generic maintainer-clean-multi mostlyclean \
744 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
745 mostlyclean-multi pdf pdf-am ps ps-am tags uninstall \
746 uninstall-am
747
748alloc.lo: config.h backtrace.h internal.h
749backtrace.lo: config.h backtrace.h internal.h
750btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
751dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
752 $(INCDIR)/filenames.h backtrace.h internal.h
753elf.lo: config.h backtrace.h internal.h
754fileline.lo: config.h backtrace.h internal.h
755mmap.lo: config.h backtrace.h internal.h
756mmapio.lo: config.h backtrace.h internal.h
757nounwind.lo: config.h internal.h
758pecoff.lo: config.h backtrace.h internal.h
759posix.lo: config.h backtrace.h internal.h
760print.lo: config.h backtrace.h internal.h
761read.lo: config.h backtrace.h internal.h
762simple.lo: config.h backtrace.h internal.h
763sort.lo: config.h backtrace.h internal.h
764stest.lo: config.h backtrace.h internal.h
765state.lo: config.h backtrace.h backtrace-supported.h internal.h
766unknown.lo: config.h backtrace.h internal.h
767
768# Tell versions [3.59,3.63) of GNU make to not export all variables.
769# Otherwise a system limit (for SysV at least) may be exceeded.
770.NOEXPORT:
diff --git a/src/libbacktrace/README b/src/libbacktrace/README
deleted file mode 100644
index e8b225745c..0000000000
--- a/src/libbacktrace/README
+++ /dev/null
@@ -1,23 +0,0 @@
1The libbacktrace library
2Initially written by Ian Lance Taylor <iant@google.com>
3
4The libbacktrace library may be linked into a program or library and
5used to produce symbolic backtraces. Sample uses would be to print a
6detailed backtrace when an error occurs or to gather detailed
7profiling information.
8
9The libbacktrace library is provided under a BSD license. See the
10source files for the exact license text.
11
12The public functions are declared and documented in the header file
13backtrace.h, which should be #include'd by a user of the library.
14
15Building libbacktrace will generate a file backtrace-supported.h,
16which a user of the library may use to determine whether backtraces
17will work. See the source file backtrace-supported.h.in for the
18macros that it defines.
19
20As of September 2012, libbacktrace only supports ELF executables with
21DWARF debugging information. The library is written to make it
22straightforward to add support for other object file and debugging
23formats.
diff --git a/src/libbacktrace/aclocal.m4 b/src/libbacktrace/aclocal.m4
deleted file mode 100644
index 8e84ddd1f1..0000000000
--- a/src/libbacktrace/aclocal.m4
+++ /dev/null
@@ -1,683 +0,0 @@
1# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5# Inc.
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13# PARTICULAR PURPOSE.
14
15m4_ifndef([AC_AUTOCONF_VERSION],
16 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
18[m4_warning([this file was generated for autoconf 2.64.
19You have another version of autoconf. It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically `autoreconf'.])])
22
23# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
24# Foundation, Inc.
25#
26# This file is free software; the Free Software Foundation
27# gives unlimited permission to copy and/or distribute it,
28# with or without modifications, as long as this notice is preserved.
29
30# serial 1
31
32# AM_AUTOMAKE_VERSION(VERSION)
33# ----------------------------
34# Automake X.Y traces this macro to ensure aclocal.m4 has been
35# generated from the m4 files accompanying Automake X.Y.
36# (This private macro should not be called outside this file.)
37AC_DEFUN([AM_AUTOMAKE_VERSION],
38[am__api_version='1.11'
39dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
40dnl require some minimum version. Point them to the right macro.
41m4_if([$1], [1.11.6], [],
42 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
43])
44
45# _AM_AUTOCONF_VERSION(VERSION)
46# -----------------------------
47# aclocal traces this macro to find the Autoconf version.
48# This is a private macro too. Using m4_define simplifies
49# the logic in aclocal, which can simply ignore this definition.
50m4_define([_AM_AUTOCONF_VERSION], [])
51
52# AM_SET_CURRENT_AUTOMAKE_VERSION
53# -------------------------------
54# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
55# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
57[AM_AUTOMAKE_VERSION([1.11.6])dnl
58m4_ifndef([AC_AUTOCONF_VERSION],
59 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
60_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61
62# AM_AUX_DIR_EXPAND -*- Autoconf -*-
63
64# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65#
66# This file is free software; the Free Software Foundation
67# gives unlimited permission to copy and/or distribute it,
68# with or without modifications, as long as this notice is preserved.
69
70# serial 1
71
72# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
74# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75#
76# Of course, Automake must honor this variable whenever it calls a
77# tool from the auxiliary directory. The problem is that $srcdir (and
78# therefore $ac_aux_dir as well) can be either absolute or relative,
79# depending on how configure is run. This is pretty annoying, since
80# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81# source directory, any form will work fine, but in subdirectories a
82# relative path needs to be adjusted first.
83#
84# $ac_aux_dir/missing
85# fails when called from a subdirectory if $ac_aux_dir is relative
86# $top_srcdir/$ac_aux_dir/missing
87# fails if $ac_aux_dir is absolute,
88# fails when called from a subdirectory in a VPATH build with
89# a relative $ac_aux_dir
90#
91# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92# are both prefixed by $srcdir. In an in-source build this is usually
93# harmless because $srcdir is `.', but things will broke when you
94# start a VPATH build or use an absolute $srcdir.
95#
96# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
98# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99# and then we would define $MISSING as
100# MISSING="\${SHELL} $am_aux_dir/missing"
101# This will work as long as MISSING is not called from configure, because
102# unfortunately $(top_srcdir) has no meaning in configure.
103# However there are other variables, like CC, which are often used in
104# configure, and could therefore not use this "fixed" $ac_aux_dir.
105#
106# Another solution, used here, is to always expand $ac_aux_dir to an
107# absolute PATH. The drawback is that using absolute paths prevent a
108# configured tree to be moved without reconfiguration.
109
110AC_DEFUN([AM_AUX_DIR_EXPAND],
111[dnl Rely on autoconf to set up CDPATH properly.
112AC_PREREQ([2.50])dnl
113# expand $ac_aux_dir to an absolute path
114am_aux_dir=`cd $ac_aux_dir && pwd`
115])
116
117# AM_CONDITIONAL -*- Autoconf -*-
118
119# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
120# Free Software Foundation, Inc.
121#
122# This file is free software; the Free Software Foundation
123# gives unlimited permission to copy and/or distribute it,
124# with or without modifications, as long as this notice is preserved.
125
126# serial 9
127
128# AM_CONDITIONAL(NAME, SHELL-CONDITION)
129# -------------------------------------
130# Define a conditional.
131AC_DEFUN([AM_CONDITIONAL],
132[AC_PREREQ(2.52)dnl
133 ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
134 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
135AC_SUBST([$1_TRUE])dnl
136AC_SUBST([$1_FALSE])dnl
137_AM_SUBST_NOTMAKE([$1_TRUE])dnl
138_AM_SUBST_NOTMAKE([$1_FALSE])dnl
139m4_define([_AM_COND_VALUE_$1], [$2])dnl
140if $2; then
141 $1_TRUE=
142 $1_FALSE='#'
143else
144 $1_TRUE='#'
145 $1_FALSE=
146fi
147AC_CONFIG_COMMANDS_PRE(
148[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
149 AC_MSG_ERROR([[conditional "$1" was never defined.
150Usually this means the macro was only invoked conditionally.]])
151fi])])
152
153# Do all the work for Automake. -*- Autoconf -*-
154
155# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
156# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
157#
158# This file is free software; the Free Software Foundation
159# gives unlimited permission to copy and/or distribute it,
160# with or without modifications, as long as this notice is preserved.
161
162# serial 16
163
164# This macro actually does too much. Some checks are only needed if
165# your package does certain things. But this isn't really a big deal.
166
167# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
168# AM_INIT_AUTOMAKE([OPTIONS])
169# -----------------------------------------------
170# The call with PACKAGE and VERSION arguments is the old style
171# call (pre autoconf-2.50), which is being phased out. PACKAGE
172# and VERSION should now be passed to AC_INIT and removed from
173# the call to AM_INIT_AUTOMAKE.
174# We support both call styles for the transition. After
175# the next Automake release, Autoconf can make the AC_INIT
176# arguments mandatory, and then we can depend on a new Autoconf
177# release and drop the old call support.
178AC_DEFUN([AM_INIT_AUTOMAKE],
179[AC_PREREQ([2.62])dnl
180dnl Autoconf wants to disallow AM_ names. We explicitly allow
181dnl the ones we care about.
182m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
183AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
184AC_REQUIRE([AC_PROG_INSTALL])dnl
185if test "`cd $srcdir && pwd`" != "`pwd`"; then
186 # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
187 # is not polluted with repeated "-I."
188 AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
189 # test to see if srcdir already configured
190 if test -f $srcdir/config.status; then
191 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
192 fi
193fi
194
195# test whether we have cygpath
196if test -z "$CYGPATH_W"; then
197 if (cygpath --version) >/dev/null 2>/dev/null; then
198 CYGPATH_W='cygpath -w'
199 else
200 CYGPATH_W=echo
201 fi
202fi
203AC_SUBST([CYGPATH_W])
204
205# Define the identity of the package.
206dnl Distinguish between old-style and new-style calls.
207m4_ifval([$2],
208[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
209 AC_SUBST([PACKAGE], [$1])dnl
210 AC_SUBST([VERSION], [$2])],
211[_AM_SET_OPTIONS([$1])dnl
212dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
213m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
214 [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
215 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
216 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
217
218_AM_IF_OPTION([no-define],,
219[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
220 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
221
222# Some tools Automake needs.
223AC_REQUIRE([AM_SANITY_CHECK])dnl
224AC_REQUIRE([AC_ARG_PROGRAM])dnl
225AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
226AM_MISSING_PROG(AUTOCONF, autoconf)
227AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
228AM_MISSING_PROG(AUTOHEADER, autoheader)
229AM_MISSING_PROG(MAKEINFO, makeinfo)
230AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
231AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
232AC_REQUIRE([AM_PROG_MKDIR_P])dnl
233# We need awk for the "check" target. The system "awk" is bad on
234# some platforms.
235AC_REQUIRE([AC_PROG_AWK])dnl
236AC_REQUIRE([AC_PROG_MAKE_SET])dnl
237AC_REQUIRE([AM_SET_LEADING_DOT])dnl
238_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
239 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
240 [_AM_PROG_TAR([v7])])])
241_AM_IF_OPTION([no-dependencies],,
242[AC_PROVIDE_IFELSE([AC_PROG_CC],
243 [_AM_DEPENDENCIES(CC)],
244 [define([AC_PROG_CC],
245 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
246AC_PROVIDE_IFELSE([AC_PROG_CXX],
247 [_AM_DEPENDENCIES(CXX)],
248 [define([AC_PROG_CXX],
249 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
250AC_PROVIDE_IFELSE([AC_PROG_OBJC],
251 [_AM_DEPENDENCIES(OBJC)],
252 [define([AC_PROG_OBJC],
253 defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
254])
255_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
256dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
257dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
258dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
259AC_CONFIG_COMMANDS_PRE(dnl
260[m4_provide_if([_AM_COMPILER_EXEEXT],
261 [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
262])
263
264dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
265dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
266dnl mangled by Autoconf and run in a shell conditional statement.
267m4_define([_AC_COMPILER_EXEEXT],
268m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
269
270
271# When config.status generates a header, we must update the stamp-h file.
272# This file resides in the same directory as the config header
273# that is generated. The stamp files are numbered to have different names.
274
275# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
276# loop where config.status creates the headers, so we can generate
277# our stamp files there.
278AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
279[# Compute $1's index in $config_headers.
280_am_arg=$1
281_am_stamp_count=1
282for _am_header in $config_headers :; do
283 case $_am_header in
284 $_am_arg | $_am_arg:* )
285 break ;;
286 * )
287 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
288 esac
289done
290echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
291
292# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
293# Inc.
294#
295# This file is free software; the Free Software Foundation
296# gives unlimited permission to copy and/or distribute it,
297# with or without modifications, as long as this notice is preserved.
298
299# serial 1
300
301# AM_PROG_INSTALL_SH
302# ------------------
303# Define $install_sh.
304AC_DEFUN([AM_PROG_INSTALL_SH],
305[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
306if test x"${install_sh}" != xset; then
307 case $am_aux_dir in
308 *\ * | *\ *)
309 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
310 *)
311 install_sh="\${SHELL} $am_aux_dir/install-sh"
312 esac
313fi
314AC_SUBST(install_sh)])
315
316# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
317# From Jim Meyering
318
319# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
320# 2011 Free Software Foundation, Inc.
321#
322# This file is free software; the Free Software Foundation
323# gives unlimited permission to copy and/or distribute it,
324# with or without modifications, as long as this notice is preserved.
325
326# serial 5
327
328# AM_MAINTAINER_MODE([DEFAULT-MODE])
329# ----------------------------------
330# Control maintainer-specific portions of Makefiles.
331# Default is to disable them, unless `enable' is passed literally.
332# For symmetry, `disable' may be passed as well. Anyway, the user
333# can override the default with the --enable/--disable switch.
334AC_DEFUN([AM_MAINTAINER_MODE],
335[m4_case(m4_default([$1], [disable]),
336 [enable], [m4_define([am_maintainer_other], [disable])],
337 [disable], [m4_define([am_maintainer_other], [enable])],
338 [m4_define([am_maintainer_other], [enable])
339 m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
340AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
341 dnl maintainer-mode's default is 'disable' unless 'enable' is passed
342 AC_ARG_ENABLE([maintainer-mode],
343[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
344 (and sometimes confusing) to the casual installer],
345 [USE_MAINTAINER_MODE=$enableval],
346 [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
347 AC_MSG_RESULT([$USE_MAINTAINER_MODE])
348 AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
349 MAINT=$MAINTAINER_MODE_TRUE
350 AC_SUBST([MAINT])dnl
351]
352)
353
354AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
355
356# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
357
358# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
359# Free Software Foundation, Inc.
360#
361# This file is free software; the Free Software Foundation
362# gives unlimited permission to copy and/or distribute it,
363# with or without modifications, as long as this notice is preserved.
364
365# serial 6
366
367# AM_MISSING_PROG(NAME, PROGRAM)
368# ------------------------------
369AC_DEFUN([AM_MISSING_PROG],
370[AC_REQUIRE([AM_MISSING_HAS_RUN])
371$1=${$1-"${am_missing_run}$2"}
372AC_SUBST($1)])
373
374
375# AM_MISSING_HAS_RUN
376# ------------------
377# Define MISSING if not defined so far and test if it supports --run.
378# If it does, set am_missing_run to use it, otherwise, to nothing.
379AC_DEFUN([AM_MISSING_HAS_RUN],
380[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
381AC_REQUIRE_AUX_FILE([missing])dnl
382if test x"${MISSING+set}" != xset; then
383 case $am_aux_dir in
384 *\ * | *\ *)
385 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
386 *)
387 MISSING="\${SHELL} $am_aux_dir/missing" ;;
388 esac
389fi
390# Use eval to expand $SHELL
391if eval "$MISSING --run true"; then
392 am_missing_run="$MISSING --run "
393else
394 am_missing_run=
395 AC_MSG_WARN([`missing' script is too old or missing])
396fi
397])
398
399# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
400# Inc.
401#
402# This file is free software; the Free Software Foundation
403# gives unlimited permission to copy and/or distribute it,
404# with or without modifications, as long as this notice is preserved.
405
406# serial 1
407
408# AM_PROG_MKDIR_P
409# ---------------
410# Check for `mkdir -p'.
411AC_DEFUN([AM_PROG_MKDIR_P],
412[AC_PREREQ([2.60])dnl
413AC_REQUIRE([AC_PROG_MKDIR_P])dnl
414dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
415dnl while keeping a definition of mkdir_p for backward compatibility.
416dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
417dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
418dnl Makefile.ins that do not define MKDIR_P, so we do our own
419dnl adjustment using top_builddir (which is defined more often than
420dnl MKDIR_P).
421AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
422case $mkdir_p in
423 [[\\/$]]* | ?:[[\\/]]*) ;;
424 */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
425esac
426])
427
428# Helper functions for option handling. -*- Autoconf -*-
429
430# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
431# Foundation, Inc.
432#
433# This file is free software; the Free Software Foundation
434# gives unlimited permission to copy and/or distribute it,
435# with or without modifications, as long as this notice is preserved.
436
437# serial 5
438
439# _AM_MANGLE_OPTION(NAME)
440# -----------------------
441AC_DEFUN([_AM_MANGLE_OPTION],
442[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
443
444# _AM_SET_OPTION(NAME)
445# --------------------
446# Set option NAME. Presently that only means defining a flag for this option.
447AC_DEFUN([_AM_SET_OPTION],
448[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
449
450# _AM_SET_OPTIONS(OPTIONS)
451# ------------------------
452# OPTIONS is a space-separated list of Automake options.
453AC_DEFUN([_AM_SET_OPTIONS],
454[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
455
456# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
457# -------------------------------------------
458# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
459AC_DEFUN([_AM_IF_OPTION],
460[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
461
462# Check to make sure that the build environment is sane. -*- Autoconf -*-
463
464# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
465# Free Software Foundation, Inc.
466#
467# This file is free software; the Free Software Foundation
468# gives unlimited permission to copy and/or distribute it,
469# with or without modifications, as long as this notice is preserved.
470
471# serial 5
472
473# AM_SANITY_CHECK
474# ---------------
475AC_DEFUN([AM_SANITY_CHECK],
476[AC_MSG_CHECKING([whether build environment is sane])
477# Just in case
478sleep 1
479echo timestamp > conftest.file
480# Reject unsafe characters in $srcdir or the absolute working directory
481# name. Accept space and tab only in the latter.
482am_lf='
483'
484case `pwd` in
485 *[[\\\"\#\$\&\'\`$am_lf]]*)
486 AC_MSG_ERROR([unsafe absolute working directory name]);;
487esac
488case $srcdir in
489 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
490 AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
491esac
492
493# Do `set' in a subshell so we don't clobber the current shell's
494# arguments. Must try -L first in case configure is actually a
495# symlink; some systems play weird games with the mod time of symlinks
496# (eg FreeBSD returns the mod time of the symlink's containing
497# directory).
498if (
499 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
500 if test "$[*]" = "X"; then
501 # -L didn't work.
502 set X `ls -t "$srcdir/configure" conftest.file`
503 fi
504 rm -f conftest.file
505 if test "$[*]" != "X $srcdir/configure conftest.file" \
506 && test "$[*]" != "X conftest.file $srcdir/configure"; then
507
508 # If neither matched, then we have a broken ls. This can happen
509 # if, for instance, CONFIG_SHELL is bash and it inherits a
510 # broken ls alias from the environment. This has actually
511 # happened. Such a system could not be considered "sane".
512 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
513alias in your environment])
514 fi
515
516 test "$[2]" = conftest.file
517 )
518then
519 # Ok.
520 :
521else
522 AC_MSG_ERROR([newly created file is older than distributed files!
523Check your system clock])
524fi
525AC_MSG_RESULT(yes)])
526
527# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
528#
529# This file is free software; the Free Software Foundation
530# gives unlimited permission to copy and/or distribute it,
531# with or without modifications, as long as this notice is preserved.
532
533# serial 1
534
535# AM_PROG_INSTALL_STRIP
536# ---------------------
537# One issue with vendor `install' (even GNU) is that you can't
538# specify the program used to strip binaries. This is especially
539# annoying in cross-compiling environments, where the build's strip
540# is unlikely to handle the host's binaries.
541# Fortunately install-sh will honor a STRIPPROG variable, so we
542# always use install-sh in `make install-strip', and initialize
543# STRIPPROG with the value of the STRIP variable (set by the user).
544AC_DEFUN([AM_PROG_INSTALL_STRIP],
545[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
546# Installed binaries are usually stripped using `strip' when the user
547# run `make install-strip'. However `strip' might not be the right
548# tool to use in cross-compilation environments, therefore Automake
549# will honor the `STRIP' environment variable to overrule this program.
550dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
551if test "$cross_compiling" != no; then
552 AC_CHECK_TOOL([STRIP], [strip], :)
553fi
554INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
555AC_SUBST([INSTALL_STRIP_PROGRAM])])
556
557# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
558#
559# This file is free software; the Free Software Foundation
560# gives unlimited permission to copy and/or distribute it,
561# with or without modifications, as long as this notice is preserved.
562
563# serial 3
564
565# _AM_SUBST_NOTMAKE(VARIABLE)
566# ---------------------------
567# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
568# This macro is traced by Automake.
569AC_DEFUN([_AM_SUBST_NOTMAKE])
570
571# AM_SUBST_NOTMAKE(VARIABLE)
572# --------------------------
573# Public sister of _AM_SUBST_NOTMAKE.
574AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
575
576# Check how to create a tarball. -*- Autoconf -*-
577
578# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
579#
580# This file is free software; the Free Software Foundation
581# gives unlimited permission to copy and/or distribute it,
582# with or without modifications, as long as this notice is preserved.
583
584# serial 2
585
586# _AM_PROG_TAR(FORMAT)
587# --------------------
588# Check how to create a tarball in format FORMAT.
589# FORMAT should be one of `v7', `ustar', or `pax'.
590#
591# Substitute a variable $(am__tar) that is a command
592# writing to stdout a FORMAT-tarball containing the directory
593# $tardir.
594# tardir=directory && $(am__tar) > result.tar
595#
596# Substitute a variable $(am__untar) that extract such
597# a tarball read from stdin.
598# $(am__untar) < result.tar
599AC_DEFUN([_AM_PROG_TAR],
600[# Always define AMTAR for backward compatibility. Yes, it's still used
601# in the wild :-( We should find a proper way to deprecate it ...
602AC_SUBST([AMTAR], ['$${TAR-tar}'])
603m4_if([$1], [v7],
604 [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
605 [m4_case([$1], [ustar],, [pax],,
606 [m4_fatal([Unknown tar format])])
607AC_MSG_CHECKING([how to create a $1 tar archive])
608# Loop over all known methods to create a tar archive until one works.
609_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
610_am_tools=${am_cv_prog_tar_$1-$_am_tools}
611# Do not fold the above two line into one, because Tru64 sh and
612# Solaris sh will not grok spaces in the rhs of `-'.
613for _am_tool in $_am_tools
614do
615 case $_am_tool in
616 gnutar)
617 for _am_tar in tar gnutar gtar;
618 do
619 AM_RUN_LOG([$_am_tar --version]) && break
620 done
621 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
622 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
623 am__untar="$_am_tar -xf -"
624 ;;
625 plaintar)
626 # Must skip GNU tar: if it does not support --format= it doesn't create
627 # ustar tarball either.
628 (tar --version) >/dev/null 2>&1 && continue
629 am__tar='tar chf - "$$tardir"'
630 am__tar_='tar chf - "$tardir"'
631 am__untar='tar xf -'
632 ;;
633 pax)
634 am__tar='pax -L -x $1 -w "$$tardir"'
635 am__tar_='pax -L -x $1 -w "$tardir"'
636 am__untar='pax -r'
637 ;;
638 cpio)
639 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
640 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
641 am__untar='cpio -i -H $1 -d'
642 ;;
643 none)
644 am__tar=false
645 am__tar_=false
646 am__untar=false
647 ;;
648 esac
649
650 # If the value was cached, stop now. We just wanted to have am__tar
651 # and am__untar set.
652 test -n "${am_cv_prog_tar_$1}" && break
653
654 # tar/untar a dummy directory, and stop if the command works
655 rm -rf conftest.dir
656 mkdir conftest.dir
657 echo GrepMe > conftest.dir/file
658 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
659 rm -rf conftest.dir
660 if test -s conftest.tar; then
661 AM_RUN_LOG([$am__untar <conftest.tar])
662 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
663 fi
664done
665rm -rf conftest.dir
666
667AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
668AC_MSG_RESULT([$am_cv_prog_tar_$1])])
669AC_SUBST([am__tar])
670AC_SUBST([am__untar])
671]) # _AM_PROG_TAR
672
673m4_include([../config/lead-dot.m4])
674m4_include([../config/multi.m4])
675m4_include([../config/override.m4])
676m4_include([../config/stdint.m4])
677m4_include([../config/unwind_ipinfo.m4])
678m4_include([../config/warnings.m4])
679m4_include([../libtool.m4])
680m4_include([../ltoptions.m4])
681m4_include([../ltsugar.m4])
682m4_include([../ltversion.m4])
683m4_include([../lt~obsolete.m4])
diff --git a/src/libbacktrace/alloc.c b/src/libbacktrace/alloc.c
deleted file mode 100644
index a9f07a013f..0000000000
--- a/src/libbacktrace/alloc.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/* alloc.c -- Memory allocation without mmap.
2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33#include "config.h"
34
35#include <errno.h>
36#include <stdlib.h>
37#include <sys/types.h>
38
39#include "backtrace.h"
40#include "internal.h"
41
42/* Allocation routines to use on systems that do not support anonymous
43 mmap. This implementation just uses malloc, which means that the
44 backtrace functions may not be safely invoked from a signal
45 handler. */
46
47/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't
48 report an error. */
49
50void *
51backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
52 size_t size, backtrace_error_callback error_callback,
53 void *data)
54{
55 void *ret;
56
57 ret = malloc (size);
58 if (ret == NULL)
59 {
60 if (error_callback)
61 error_callback (data, "malloc", errno);
62 }
63 return ret;
64}
65
66/* Free memory. */
67
68void
69backtrace_free (struct backtrace_state *state ATTRIBUTE_UNUSED,
70 void *p, size_t size ATTRIBUTE_UNUSED,
71 backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
72 void *data ATTRIBUTE_UNUSED)
73{
74 free (p);
75}
76
77/* Grow VEC by SIZE bytes. */
78
79void *
80backtrace_vector_grow (struct backtrace_state *state ATTRIBUTE_UNUSED,
81 size_t size, backtrace_error_callback error_callback,
82 void *data, struct backtrace_vector *vec)
83{
84 void *ret;
85
86 if (size > vec->alc)
87 {
88 size_t alc;
89 void *base;
90
91 if (vec->size == 0)
92 alc = 32 * size;
93 else if (vec->size >= 4096)
94 alc = vec->size + 4096;
95 else
96 alc = 2 * vec->size;
97
98 if (alc < vec->size + size)
99 alc = vec->size + size;
100
101 base = realloc (vec->base, alc);
102 if (base == NULL)
103 {
104 error_callback (data, "realloc", errno);
105 return NULL;
106 }
107
108 vec->base = base;
109 vec->alc = alc - vec->size;
110 }
111
112 ret = (char *) vec->base + vec->size;
113 vec->size += size;
114 vec->alc -= size;
115 return ret;
116}
117
118/* Finish the current allocation on VEC. */
119
120void *
121backtrace_vector_finish (struct backtrace_state *state,
122 struct backtrace_vector *vec,
123 backtrace_error_callback error_callback,
124 void *data)
125{
126 void *ret;
127
128 /* With this allocator we call realloc in backtrace_vector_grow,
129 which means we can't easily reuse the memory here. So just
130 release it. */
131 if (!backtrace_vector_release (state, vec, error_callback, data))
132 return NULL;
133 ret = vec->base;
134 vec->base = NULL;
135 vec->size = 0;
136 vec->alc = 0;
137 return ret;
138}
139
140/* Release any extra space allocated for VEC. */
141
142int
143backtrace_vector_release (struct backtrace_state *state ATTRIBUTE_UNUSED,
144 struct backtrace_vector *vec,
145 backtrace_error_callback error_callback,
146 void *data)
147{
148 vec->base = realloc (vec->base, vec->size);
149 if (vec->base == NULL)
150 {
151 error_callback (data, "realloc", errno);
152 return 0;
153 }
154 vec->alc = 0;
155 return 1;
156}
diff --git a/src/libbacktrace/ansidecl.h b/src/libbacktrace/ansidecl.h
deleted file mode 100644
index 4087dd7291..0000000000
--- a/src/libbacktrace/ansidecl.h
+++ /dev/null
@@ -1,329 +0,0 @@
1/* ANSI and traditional C compatibility macros
2 Copyright (C) 1991-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
18
19/* ANSI and traditional C compatibility macros
20
21 ANSI C is assumed if __STDC__ is #defined.
22
23 Macro ANSI C definition Traditional C definition
24 ----- ---- - ---------- ----------- - ----------
25 PTR `void *' `char *'
26 const not defined `'
27 volatile not defined `'
28 signed not defined `'
29
30 For ease of writing code which uses GCC extensions but needs to be
31 portable to other compilers, we provide the GCC_VERSION macro that
32 simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
33 wrappers around __attribute__. Also, __extension__ will be #defined
34 to nothing if it doesn't work. See below. */
35
36#ifndef _ANSIDECL_H
37#define _ANSIDECL_H 1
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/* Every source file includes this file,
44 so they will all get the switch for lint. */
45/* LINTLIBRARY */
46
47/* Using MACRO(x,y) in cpp #if conditionals does not work with some
48 older preprocessors. Thus we can't define something like this:
49
50#define HAVE_GCC_VERSION(MAJOR, MINOR) \
51 (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
52
53and then test "#if HAVE_GCC_VERSION(2,7)".
54
55So instead we use the macro below and test it against specific values. */
56
57/* This macro simplifies testing whether we are using gcc, and if it
58 is of a particular minimum version. (Both major & minor numbers are
59 significant.) This macro will evaluate to 0 if we are not using
60 gcc at all. */
61#ifndef GCC_VERSION
62#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
63#endif /* GCC_VERSION */
64
65#if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
66/* All known AIX compilers implement these things (but don't always
67 define __STDC__). The RISC/OS MIPS compiler defines these things
68 in SVR4 mode, but does not define __STDC__. */
69/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
70 C++ compilers, does not define __STDC__, though it acts as if this
71 was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */
72
73#define PTR void *
74
75#undef const
76#undef volatile
77#undef signed
78
79/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
80 it too, but it's not in C89. */
81#undef inline
82#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__))
83/* it's a keyword */
84#else
85# if GCC_VERSION >= 2007
86# define inline __inline__ /* __inline__ prevents -pedantic warnings */
87# else
88# define inline /* nothing */
89# endif
90#endif
91
92#else /* Not ANSI C. */
93
94#define PTR char *
95
96/* some systems define these in header files for non-ansi mode */
97#undef const
98#undef volatile
99#undef signed
100#undef inline
101#define const
102#define volatile
103#define signed
104#define inline
105
106#endif /* ANSI C. */
107
108/* Define macros for some gcc attributes. This permits us to use the
109 macros freely, and know that they will come into play for the
110 version of gcc in which they are supported. */
111
112#if (GCC_VERSION < 2007)
113# define __attribute__(x)
114#endif
115
116/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
117#ifndef ATTRIBUTE_MALLOC
118# if (GCC_VERSION >= 2096)
119# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
120# else
121# define ATTRIBUTE_MALLOC
122# endif /* GNUC >= 2.96 */
123#endif /* ATTRIBUTE_MALLOC */
124
125/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5. For
126 g++ an attribute on a label must be followed by a semicolon. */
127#ifndef ATTRIBUTE_UNUSED_LABEL
128# ifndef __cplusplus
129# if GCC_VERSION >= 2093
130# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
131# else
132# define ATTRIBUTE_UNUSED_LABEL
133# endif
134# else
135# if GCC_VERSION >= 4005
136# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ;
137# else
138# define ATTRIBUTE_UNUSED_LABEL
139# endif
140# endif
141#endif
142
143/* Similarly to ARG_UNUSED below. Prior to GCC 3.4, the C++ frontend
144 couldn't parse attributes placed after the identifier name, and now
145 the entire compiler is built with C++. */
146#ifndef ATTRIBUTE_UNUSED
147#if GCC_VERSION >= 3004
148# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
149#else
150#define ATTRIBUTE_UNUSED
151#endif
152#endif /* ATTRIBUTE_UNUSED */
153
154/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
155 identifier name. */
156#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
157# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
158#else /* !__cplusplus || GNUC >= 3.4 */
159# define ARG_UNUSED(NAME) NAME
160#endif /* !__cplusplus || GNUC >= 3.4 */
161
162#ifndef ATTRIBUTE_NORETURN
163#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
164#endif /* ATTRIBUTE_NORETURN */
165
166/* Attribute `nonnull' was valid as of gcc 3.3. */
167#ifndef ATTRIBUTE_NONNULL
168# if (GCC_VERSION >= 3003)
169# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
170# else
171# define ATTRIBUTE_NONNULL(m)
172# endif /* GNUC >= 3.3 */
173#endif /* ATTRIBUTE_NONNULL */
174
175/* Attribute `returns_nonnull' was valid as of gcc 4.9. */
176#ifndef ATTRIBUTE_RETURNS_NONNULL
177# if (GCC_VERSION >= 4009)
178# define ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
179# else
180# define ATTRIBUTE_RETURNS_NONNULL
181# endif /* GNUC >= 4.9 */
182#endif /* ATTRIBUTE_RETURNS_NONNULL */
183
184/* Attribute `pure' was valid as of gcc 3.0. */
185#ifndef ATTRIBUTE_PURE
186# if (GCC_VERSION >= 3000)
187# define ATTRIBUTE_PURE __attribute__ ((__pure__))
188# else
189# define ATTRIBUTE_PURE
190# endif /* GNUC >= 3.0 */
191#endif /* ATTRIBUTE_PURE */
192
193/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
194 This was the case for the `printf' format attribute by itself
195 before GCC 3.3, but as of 3.3 we need to add the `nonnull'
196 attribute to retain this behavior. */
197#ifndef ATTRIBUTE_PRINTF
198#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
199#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
200#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
201#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
202#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
203#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
204#endif /* ATTRIBUTE_PRINTF */
205
206/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on
207 a function pointer. Format attributes were allowed on function
208 pointers as of gcc 3.1. */
209#ifndef ATTRIBUTE_FPTR_PRINTF
210# if (GCC_VERSION >= 3001)
211# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
212# else
213# define ATTRIBUTE_FPTR_PRINTF(m, n)
214# endif /* GNUC >= 3.1 */
215# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2)
216# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3)
217# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4)
218# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5)
219# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6)
220#endif /* ATTRIBUTE_FPTR_PRINTF */
221
222/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
223 NULL format specifier was allowed as of gcc 3.3. */
224#ifndef ATTRIBUTE_NULL_PRINTF
225# if (GCC_VERSION >= 3003)
226# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
227# else
228# define ATTRIBUTE_NULL_PRINTF(m, n)
229# endif /* GNUC >= 3.3 */
230# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
231# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
232# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
233# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
234# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
235#endif /* ATTRIBUTE_NULL_PRINTF */
236
237/* Attribute `sentinel' was valid as of gcc 3.5. */
238#ifndef ATTRIBUTE_SENTINEL
239# if (GCC_VERSION >= 3005)
240# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
241# else
242# define ATTRIBUTE_SENTINEL
243# endif /* GNUC >= 3.5 */
244#endif /* ATTRIBUTE_SENTINEL */
245
246
247#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
248# if (GCC_VERSION >= 3000)
249# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
250# else
251# define ATTRIBUTE_ALIGNED_ALIGNOF(m)
252# endif /* GNUC >= 3.0 */
253#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
254
255/* Useful for structures whose layout must much some binary specification
256 regardless of the alignment and padding qualities of the compiler. */
257#ifndef ATTRIBUTE_PACKED
258# define ATTRIBUTE_PACKED __attribute__ ((packed))
259#endif
260
261/* Attribute `hot' and `cold' was valid as of gcc 4.3. */
262#ifndef ATTRIBUTE_COLD
263# if (GCC_VERSION >= 4003)
264# define ATTRIBUTE_COLD __attribute__ ((__cold__))
265# else
266# define ATTRIBUTE_COLD
267# endif /* GNUC >= 4.3 */
268#endif /* ATTRIBUTE_COLD */
269#ifndef ATTRIBUTE_HOT
270# if (GCC_VERSION >= 4003)
271# define ATTRIBUTE_HOT __attribute__ ((__hot__))
272# else
273# define ATTRIBUTE_HOT
274# endif /* GNUC >= 4.3 */
275#endif /* ATTRIBUTE_HOT */
276
277/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
278#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
279# if (GCC_VERSION >= 4009)
280# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
281# else
282# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
283# endif /* GNUC >= 4.9 */
284#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
285
286/* We use __extension__ in some places to suppress -pedantic warnings
287 about GCC extensions. This feature didn't work properly before
288 gcc 2.8. */
289#if GCC_VERSION < 2008
290#define __extension__
291#endif
292
293/* This is used to declare a const variable which should be visible
294 outside of the current compilation unit. Use it as
295 EXPORTED_CONST int i = 1;
296 This is because the semantics of const are different in C and C++.
297 "extern const" is permitted in C but it looks strange, and gcc
298 warns about it when -Wc++-compat is not used. */
299#ifdef __cplusplus
300#define EXPORTED_CONST extern const
301#else
302#define EXPORTED_CONST const
303#endif
304
305/* Be conservative and only use enum bitfields with C++ or GCC.
306 FIXME: provide a complete autoconf test for buggy enum bitfields. */
307
308#ifdef __cplusplus
309#define ENUM_BITFIELD(TYPE) enum TYPE
310#elif (GCC_VERSION > 2000)
311#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
312#else
313#define ENUM_BITFIELD(TYPE) unsigned int
314#endif
315
316 /* This is used to mark a class or virtual function as final. */
317#if __cplusplus >= 201103L
318#define GCC_FINAL final
319#elif GCC_VERSION >= 4007
320#define GCC_FINAL __final
321#else
322#define GCC_FINAL
323#endif
324
325#ifdef __cplusplus
326}
327#endif
328
329#endif /* ansidecl.h */
diff --git a/src/libbacktrace/atomic.c b/src/libbacktrace/atomic.c
deleted file mode 100644
index cb0ad0298e..0000000000
--- a/src/libbacktrace/atomic.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/* atomic.c -- Support for atomic functions if not present.
2 Copyright (C) 2013-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33#include "config.h"
34
35#include <sys/types.h>
36
37#include "backtrace.h"
38#include "backtrace-supported.h"
39#include "internal.h"
40
41/* This file holds implementations of the atomic functions that are
42 used if the host compiler has the sync functions but not the atomic
43 functions, as is true of versions of GCC before 4.7. */
44
45#if !defined (HAVE_ATOMIC_FUNCTIONS) && defined (HAVE_SYNC_FUNCTIONS)
46
47/* Do an atomic load of a pointer. */
48
49void *
50backtrace_atomic_load_pointer (void *arg)
51{
52 void **pp;
53 void *p;
54
55 pp = (void **) arg;
56 p = *pp;
57 while (!__sync_bool_compare_and_swap (pp, p, p))
58 p = *pp;
59 return p;
60}
61
62/* Do an atomic load of an int. */
63
64int
65backtrace_atomic_load_int (int *p)
66{
67 int i;
68
69 i = *p;
70 while (!__sync_bool_compare_and_swap (p, i, i))
71 i = *p;
72 return i;
73}
74
75/* Do an atomic store of a pointer. */
76
77void
78backtrace_atomic_store_pointer (void *arg, void *p)
79{
80 void **pp;
81 void *old;
82
83 pp = (void **) arg;
84 old = *pp;
85 while (!__sync_bool_compare_and_swap (pp, old, p))
86 old = *pp;
87}
88
89/* Do an atomic store of a size_t value. */
90
91void
92backtrace_atomic_store_size_t (size_t *p, size_t v)
93{
94 size_t old;
95
96 old = *p;
97 while (!__sync_bool_compare_and_swap (p, old, v))
98 old = *p;
99}
100
101/* Do an atomic store of a int value. */
102
103void
104backtrace_atomic_store_int (int *p, int v)
105{
106 size_t old;
107
108 old = *p;
109 while (!__sync_bool_compare_and_swap (p, old, v))
110 old = *p;
111}
112
113#endif
diff --git a/src/libbacktrace/backtrace-supported.h.in b/src/libbacktrace/backtrace-supported.h.in
deleted file mode 100644
index ab34199fcd..0000000000
--- a/src/libbacktrace/backtrace-supported.h.in
+++ /dev/null
@@ -1,66 +0,0 @@
1/* backtrace-supported.h.in -- Whether stack backtrace is supported.
2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33/* The file backtrace-supported.h.in is used by configure to generate
34 the file backtrace-supported.h. The file backtrace-supported.h may
35 be #include'd to see whether the backtrace library will be able to
36 get a backtrace and produce symbolic information. */
37
38
39/* BACKTRACE_SUPPORTED will be #define'd as 1 if the backtrace library
40 should work, 0 if it will not. Libraries may #include this to make
41 other arrangements. */
42
43#define BACKTRACE_SUPPORTED @BACKTRACE_SUPPORTED@
44
45/* BACKTRACE_USES_MALLOC will be #define'd as 1 if the backtrace
46 library will call malloc as it works, 0 if it will call mmap
47 instead. This may be used to determine whether it is safe to call
48 the backtrace functions from a signal handler. In general this
49 only applies to calls like backtrace and backtrace_pcinfo. It does
50 not apply to backtrace_simple, which never calls malloc. It does
51 not apply to backtrace_print, which always calls fprintf and
52 therefore malloc. */
53
54#define BACKTRACE_USES_MALLOC @BACKTRACE_USES_MALLOC@
55
56/* BACKTRACE_SUPPORTS_THREADS will be #define'd as 1 if the backtrace
57 library is configured with threading support, 0 if not. If this is
58 0, the threaded parameter to backtrace_create_state must be passed
59 as 0. */
60
61#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 --git a/src/libbacktrace/backtrace.c b/src/libbacktrace/backtrace.c
deleted file mode 100644
index b89bf554ac..0000000000
--- a/src/libbacktrace/backtrace.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/* backtrace.c -- Entry point for stack backtrace library.
2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33#include "config.h"
34
35#include <sys/types.h>
36
37#include "unwind.h"
38#include "backtrace.h"
39#include "internal.h"
40
41/* The main backtrace_full routine. */
42
43/* Data passed through _Unwind_Backtrace. */
44
45struct backtrace_data
46{
47 /* Number of frames to skip. */
48 int skip;
49 /* Library state. */
50 struct backtrace_state *state;
51 /* Callback routine. */
52 backtrace_full_callback callback;
53 /* Error callback routine. */
54 backtrace_error_callback error_callback;
55 /* Data to pass to callback routines. */
56 void *data;
57 /* Value to return from backtrace_full. */
58 int ret;
59 /* Whether there is any memory available. */
60 int can_alloc;
61};
62
63/* Unwind library callback routine. This is passed to
64 _Unwind_Backtrace. */
65
66static _Unwind_Reason_Code
67unwind (struct _Unwind_Context *context, void *vdata)
68{
69 struct backtrace_data *bdata = (struct backtrace_data *) vdata;
70 uintptr_t pc;
71 int ip_before_insn = 0;
72
73#ifdef HAVE_GETIPINFO
74 pc = _Unwind_GetIPInfo (context, &ip_before_insn);
75#else
76 pc = _Unwind_GetIP (context);
77#endif
78
79 if (bdata->skip > 0)
80 {
81 --bdata->skip;
82 return _URC_NO_REASON;
83 }
84
85 if (!ip_before_insn)
86 --pc;
87
88 if (!bdata->can_alloc)
89 bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL);
90 else
91 bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
92 bdata->error_callback, bdata->data);
93 if (bdata->ret != 0)
94 return _URC_END_OF_STACK;
95
96 return _URC_NO_REASON;
97}
98
99/* Get a stack backtrace. */
100
101int
102backtrace_full (struct backtrace_state *state, int skip,
103 backtrace_full_callback callback,
104 backtrace_error_callback error_callback, void *data)
105{
106 struct backtrace_data bdata;
107 void *p;
108
109 bdata.skip = skip + 1;
110 bdata.state = state;
111 bdata.callback = callback;
112 bdata.error_callback = error_callback;
113 bdata.data = data;
114 bdata.ret = 0;
115
116 /* If we can't allocate any memory at all, don't try to produce
117 file/line information. */
118 p = backtrace_alloc (state, 4096, NULL, NULL);
119 if (p == NULL)
120 bdata.can_alloc = 0;
121 else
122 {
123 backtrace_free (state, p, 4096, NULL, NULL);
124 bdata.can_alloc = 1;
125 }
126
127 _Unwind_Backtrace (unwind, &bdata);
128 return bdata.ret;
129}
diff --git a/src/libbacktrace/backtrace.h b/src/libbacktrace/backtrace.h
deleted file mode 100644
index d209219d9a..0000000000
--- a/src/libbacktrace/backtrace.h
+++ /dev/null
@@ -1,199 +0,0 @@
1/* backtrace.h -- Public header file for stack backtrace library.
2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33#ifndef BACKTRACE_H
34#define BACKTRACE_H
35
36#include <stddef.h>
37#include <stdio.h>
38
39/* We want to get a definition for uintptr_t, but we still care about
40 systems that don't have <stdint.h>. */
41#if defined(__GLIBC__) && __GLIBC__ >= 2
42
43#include <stdint.h>
44
45#elif defined(HAVE_STDINT_H)
46
47#include <stdint.h>
48
49#else
50
51/* Systems that don't have <stdint.h> must provide gstdint.h, e.g.,
52 from GCC_HEADER_STDINT in configure.ac. */
53#include "gstdint.h"
54
55#endif
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/* The backtrace state. This struct is intentionally not defined in
62 the public interface. */
63
64struct backtrace_state;
65
66/* The type of the error callback argument to backtrace functions.
67 This function, if not NULL, will be called for certain error cases.
68 The DATA argument is passed to the function that calls this one.
69 The MSG argument is an error message. The ERRNUM argument, if
70 greater than 0, holds an errno value. The MSG buffer may become
71 invalid after this function returns.
72
73 As a special case, the ERRNUM argument will be passed as -1 if no
74 debug info can be found for the executable, but the function
75 requires debug info (e.g., backtrace_full, backtrace_pcinfo). The
76 MSG in this case will be something along the lines of "no debug
77 info". Similarly, ERRNUM will be passed as -1 if there is no
78 symbol table, but the function requires a symbol table (e.g.,
79 backtrace_syminfo). This may be used as a signal that some other
80 approach should be tried. */
81
82typedef void (*backtrace_error_callback) (void *data, const char *msg,
83 int errnum);
84
85/* Create state information for the backtrace routines. This must be
86 called before any of the other routines, and its return value must
87 be passed to all of the other routines. FILENAME is the path name
88 of the executable file; if it is NULL the library will try
89 system-specific path names. If not NULL, FILENAME must point to a
90 permanent buffer. If THREADED is non-zero the state may be
91 accessed by multiple threads simultaneously, and the library will
92 use appropriate atomic operations. If THREADED is zero the state
93 may only be accessed by one thread at a time. This returns a state
94 pointer on success, NULL on error. If an error occurs, this will
95 call the ERROR_CALLBACK routine. */
96
97extern struct backtrace_state *backtrace_create_state (
98 const char *filename, int threaded,
99 backtrace_error_callback error_callback, void *data);
100
101/* The type of the callback argument to the backtrace_full function.
102 DATA is the argument passed to backtrace_full. PC is the program
103 counter. FILENAME is the name of the file containing PC, or NULL
104 if not available. LINENO is the line number in FILENAME containing
105 PC, or 0 if not available. FUNCTION is the name of the function
106 containing PC, or NULL if not available. This should return 0 to
107 continuing tracing. The FILENAME and FUNCTION buffers may become
108 invalid after this function returns. */
109
110typedef int (*backtrace_full_callback) (void *data, uintptr_t pc,
111 const char *filename, int lineno,
112 const char *function);
113
114/* Get a full stack backtrace. SKIP is the number of frames to skip;
115 passing 0 will start the trace with the function calling
116 backtrace_full. DATA is passed to the callback routine. If any
117 call to CALLBACK returns a non-zero value, the stack backtrace
118 stops, and backtrace returns that value; this may be used to limit
119 the number of stack frames desired. If all calls to CALLBACK
120 return 0, backtrace returns 0. The backtrace_full function will
121 make at least one call to either CALLBACK or ERROR_CALLBACK. This
122 function requires debug info for the executable. */
123
124extern int backtrace_full (struct backtrace_state *state, int skip,
125 backtrace_full_callback callback,
126 backtrace_error_callback error_callback,
127 void *data);
128
129/* The type of the callback argument to the backtrace_simple function.
130 DATA is the argument passed to simple_backtrace. PC is the program
131 counter. This should return 0 to continue tracing. */
132
133typedef int (*backtrace_simple_callback) (void *data, uintptr_t pc);
134
135/* Get a simple backtrace. SKIP is the number of frames to skip, as
136 in backtrace. DATA is passed to the callback routine. If any call
137 to CALLBACK returns a non-zero value, the stack backtrace stops,
138 and backtrace_simple returns that value. Otherwise
139 backtrace_simple returns 0. The backtrace_simple function will
140 make at least one call to either CALLBACK or ERROR_CALLBACK. This
141 function does not require any debug info for the executable. */
142
143extern int backtrace_simple (struct backtrace_state *state, int skip,
144 backtrace_simple_callback callback,
145 backtrace_error_callback error_callback,
146 void *data);
147
148/* Print the current backtrace in a user readable format to a FILE.
149 SKIP is the number of frames to skip, as in backtrace_full. Any
150 error messages are printed to stderr. This function requires debug
151 info for the executable. */
152
153extern void backtrace_print (struct backtrace_state *state, int skip, FILE *);
154
155/* Given PC, a program counter in the current program, call the
156 callback function with filename, line number, and function name
157 information. This will normally call the callback function exactly
158 once. However, if the PC happens to describe an inlined call, and
159 the debugging information contains the necessary information, then
160 this may call the callback function multiple times. This will make
161 at least one call to either CALLBACK or ERROR_CALLBACK. This
162 returns the first non-zero value returned by CALLBACK, or 0. */
163
164extern int backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc,
165 backtrace_full_callback callback,
166 backtrace_error_callback error_callback,
167 void *data);
168
169/* The type of the callback argument to backtrace_syminfo. DATA and
170 PC are the arguments passed to backtrace_syminfo. SYMNAME is the
171 name of the symbol for the corresponding code. SYMVAL is the
172 value and SYMSIZE is the size of the symbol. SYMNAME will be NULL
173 if no error occurred but the symbol could not be found. */
174
175typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc,
176 const char *symname,
177 uintptr_t symval,
178 uintptr_t symsize);
179
180/* Given ADDR, an address or program counter in the current program,
181 call the callback information with the symbol name and value
182 describing the function or variable in which ADDR may be found.
183 This will call either CALLBACK or ERROR_CALLBACK exactly once.
184 This returns 1 on success, 0 on failure. This function requires
185 the symbol table but does not require the debug info. Note that if
186 the symbol table is present but ADDR could not be found in the
187 table, CALLBACK will be called with a NULL SYMNAME argument.
188 Returns 1 on success, 0 on error. */
189
190extern int backtrace_syminfo (struct backtrace_state *state, uintptr_t addr,
191 backtrace_syminfo_callback callback,
192 backtrace_error_callback error_callback,
193 void *data);
194
195#ifdef __cplusplus
196} /* End extern "C". */
197#endif
198
199#endif
diff --git a/src/libbacktrace/btest.c b/src/libbacktrace/btest.c
deleted file mode 100644
index 0506d2b112..0000000000
--- a/src/libbacktrace/btest.c
+++ /dev/null
@@ -1,721 +0,0 @@
1/* btest.c -- Test for libbacktrace library
2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33/* This program tests the externally visible interfaces of the
34 libbacktrace library. */
35
36#include <assert.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40
41#include "filenames.h"
42
43#include "backtrace.h"
44#include "backtrace-supported.h"
45
46/* Portable attribute syntax. Actually some of these tests probably
47 won't work if the attributes are not recognized. */
48
49#ifndef GCC_VERSION
50# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
51#endif
52
53#if (GCC_VERSION < 2007)
54# define __attribute__(x)
55#endif
56
57#ifndef ATTRIBUTE_UNUSED
58# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
59#endif
60
61/* Used to collect backtrace info. */
62
63struct info
64{
65 char *filename;
66 int lineno;
67 char *function;
68};
69
70/* Passed to backtrace callback function. */
71
72struct bdata
73{
74 struct info *all;
75 size_t index;
76 size_t max;
77 int failed;
78};
79
80/* Passed to backtrace_simple callback function. */
81
82struct sdata
83{
84 uintptr_t *addrs;
85 size_t index;
86 size_t max;
87 int failed;
88};
89
90/* Passed to backtrace_syminfo callback function. */
91
92struct symdata
93{
94 const char *name;
95 uintptr_t val, size;
96 int failed;
97};
98
99/* The backtrace state. */
100
101static void *state;
102
103/* The number of failures. */
104
105static int failures;
106
107/* Return the base name in a path. */
108
109static const char *
110base (const char *p)
111{
112 const char *last;
113 const char *s;
114
115 last = NULL;
116 for (s = p; *s != '\0'; ++s)
117 {
118 if (IS_DIR_SEPARATOR (*s))
119 last = s + 1;
120 }
121 return last != NULL ? last : p;
122}
123
124/* Check an entry in a struct info array. */
125
126static void
127check (const char *name, int index, const struct info *all, int want_lineno,
128 const char *want_function, int *failed)
129{
130 if (*failed)
131 return;
132 if (all[index].filename == NULL || all[index].function == NULL)
133 {
134 fprintf (stderr, "%s: [%d]: missing file name or function name\n",
135 name, index);
136 *failed = 1;
137 return;
138 }
139 if (strcmp (base (all[index].filename), "btest.c") != 0)
140 {
141 fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index,
142 all[index].filename);
143 *failed = 1;
144 }
145 if (all[index].lineno != want_lineno)
146 {
147 fprintf (stderr, "%s: [%d]: got %d expected %d\n", name, index,
148 all[index].lineno, want_lineno);
149 *failed = 1;
150 }
151 if (strcmp (all[index].function, want_function) != 0)
152 {
153 fprintf (stderr, "%s: [%d]: got %s expected %s\n", name, index,
154 all[index].function, want_function);
155 *failed = 1;
156 }
157}
158
159/* The backtrace callback function. */
160
161static int
162callback_one (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
163 const char *filename, int lineno, const char *function)
164{
165 struct bdata *data = (struct bdata *) vdata;
166 struct info *p;
167
168 if (data->index >= data->max)
169 {
170 fprintf (stderr, "callback_one: callback called too many times\n");
171 data->failed = 1;
172 return 1;
173 }
174
175 p = &data->all[data->index];
176 if (filename == NULL)
177 p->filename = NULL;
178 else
179 {
180 p->filename = strdup (filename);
181 assert (p->filename != NULL);
182 }
183 p->lineno = lineno;
184 if (function == NULL)
185 p->function = NULL;
186 else
187 {
188 p->function = strdup (function);
189 assert (p->function != NULL);
190 }
191 ++data->index;
192
193 return 0;
194}
195
196/* An error callback passed to backtrace. */
197
198static void
199error_callback_one (void *vdata, const char *msg, int errnum)
200{
201 struct bdata *data = (struct bdata *) vdata;
202
203 fprintf (stderr, "%s", msg);
204 if (errnum > 0)
205 fprintf (stderr, ": %s", strerror (errnum));
206 fprintf (stderr, "\n");
207 data->failed = 1;
208}
209
210/* The backtrace_simple callback function. */
211
212static int
213callback_two (void *vdata, uintptr_t pc)
214{
215 struct sdata *data = (struct sdata *) vdata;
216
217 if (data->index >= data->max)
218 {
219 fprintf (stderr, "callback_two: callback called too many times\n");
220 data->failed = 1;
221 return 1;
222 }
223
224 data->addrs[data->index] = pc;
225 ++data->index;
226
227 return 0;
228}
229
230/* An error callback passed to backtrace_simple. */
231
232static void
233error_callback_two (void *vdata, const char *msg, int errnum)
234{
235 struct sdata *data = (struct sdata *) vdata;
236
237 fprintf (stderr, "%s", msg);
238 if (errnum > 0)
239 fprintf (stderr, ": %s", strerror (errnum));
240 fprintf (stderr, "\n");
241 data->failed = 1;
242}
243
244/* The backtrace_syminfo callback function. */
245
246static void
247callback_three (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
248 const char *symname, uintptr_t symval,
249 uintptr_t symsize)
250{
251 struct symdata *data = (struct symdata *) vdata;
252
253 if (symname == NULL)
254 data->name = NULL;
255 else
256 {
257 data->name = strdup (symname);
258 assert (data->name != NULL);
259 }
260 data->val = symval;
261 data->size = symsize;
262}
263
264/* The backtrace_syminfo error callback function. */
265
266static void
267error_callback_three (void *vdata, const char *msg, int errnum)
268{
269 struct symdata *data = (struct symdata *) vdata;
270
271 fprintf (stderr, "%s", msg);
272 if (errnum > 0)
273 fprintf (stderr, ": %s", strerror (errnum));
274 fprintf (stderr, "\n");
275 data->failed = 1;
276}
277
278/* Test the backtrace function with non-inlined functions. */
279
280static int test1 (void) __attribute__ ((noinline, unused));
281static int f2 (int) __attribute__ ((noinline));
282static int f3 (int, int) __attribute__ ((noinline));
283
284static int
285test1 (void)
286{
287 /* Returning a value here and elsewhere avoids a tailcall which
288 would mess up the backtrace. */
289 return f2 (__LINE__) + 1;
290}
291
292static int
293f2 (int f1line)
294{
295 return f3 (f1line, __LINE__) + 2;
296}
297
298static int
299f3 (int f1line, int f2line)
300{
301 struct info all[20];
302 struct bdata data;
303 int f3line;
304 int i;
305
306 data.all = &all[0];
307 data.index = 0;
308 data.max = 20;
309 data.failed = 0;
310
311 f3line = __LINE__ + 1;
312 i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
313
314 if (i != 0)
315 {
316 fprintf (stderr, "test1: unexpected return value %d\n", i);
317 data.failed = 1;
318 }
319
320 if (data.index < 3)
321 {
322 fprintf (stderr,
323 "test1: not enough frames; got %zu, expected at least 3\n",
324 data.index);
325 data.failed = 1;
326 }
327
328 check ("test1", 0, all, f3line, "f3", &data.failed);
329 check ("test1", 1, all, f2line, "f2", &data.failed);
330 check ("test1", 2, all, f1line, "test1", &data.failed);
331
332 printf ("%s: backtrace_full noinline\n", data.failed ? "FAIL" : "PASS");
333
334 if (data.failed)
335 ++failures;
336
337 return failures;
338}
339
340/* Test the backtrace function with inlined functions. */
341
342static inline int test2 (void) __attribute__ ((always_inline, unused));
343static inline int f12 (int) __attribute__ ((always_inline));
344static inline int f13 (int, int) __attribute__ ((always_inline));
345
346static inline int
347test2 (void)
348{
349 return f12 (__LINE__) + 1;
350}
351
352static inline int
353f12 (int f1line)
354{
355 return f13 (f1line, __LINE__) + 2;
356}
357
358static inline int
359f13 (int f1line, int f2line)
360{
361 struct info all[20];
362 struct bdata data;
363 int f3line;
364 int i;
365
366 data.all = &all[0];
367 data.index = 0;
368 data.max = 20;
369 data.failed = 0;
370
371 f3line = __LINE__ + 1;
372 i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
373
374 if (i != 0)
375 {
376 fprintf (stderr, "test2: unexpected return value %d\n", i);
377 data.failed = 1;
378 }
379
380 check ("test2", 0, all, f3line, "f13", &data.failed);
381 check ("test2", 1, all, f2line, "f12", &data.failed);
382 check ("test2", 2, all, f1line, "test2", &data.failed);
383
384 printf ("%s: backtrace_full inline\n", data.failed ? "FAIL" : "PASS");
385
386 if (data.failed)
387 ++failures;
388
389 return failures;
390}
391
392/* Test the backtrace_simple function with non-inlined functions. */
393
394static int test3 (void) __attribute__ ((noinline, unused));
395static int f22 (int) __attribute__ ((noinline));
396static int f23 (int, int) __attribute__ ((noinline));
397
398static int
399test3 (void)
400{
401 return f22 (__LINE__) + 1;
402}
403
404static int
405f22 (int f1line)
406{
407 return f23 (f1line, __LINE__) + 2;
408}
409
410static int
411f23 (int f1line, int f2line)
412{
413 uintptr_t addrs[20];
414 struct sdata data;
415 int f3line;
416 int i;
417
418 data.addrs = &addrs[0];
419 data.index = 0;
420 data.max = 20;
421 data.failed = 0;
422
423 f3line = __LINE__ + 1;
424 i = backtrace_simple (state, 0, callback_two, error_callback_two, &data);
425
426 if (i != 0)
427 {
428 fprintf (stderr, "test3: unexpected return value %d\n", i);
429 data.failed = 1;
430 }
431
432 if (!data.failed)
433 {
434 struct info all[20];
435 struct bdata bdata;
436 int j;
437
438 bdata.all = &all[0];
439 bdata.index = 0;
440 bdata.max = 20;
441 bdata.failed = 0;
442
443 for (j = 0; j < 3; ++j)
444 {
445 i = backtrace_pcinfo (state, addrs[j], callback_one,
446 error_callback_one, &bdata);
447 if (i != 0)
448 {
449 fprintf (stderr,
450 ("test3: unexpected return value "
451 "from backtrace_pcinfo %d\n"),
452 i);
453 bdata.failed = 1;
454 }
455 if (!bdata.failed && bdata.index != (size_t) (j + 1))
456 {
457 fprintf (stderr,
458 ("wrong number of calls from backtrace_pcinfo "
459 "got %u expected %d\n"),
460 (unsigned int) bdata.index, j + 1);
461 bdata.failed = 1;
462 }
463 }
464
465 check ("test3", 0, all, f3line, "f23", &bdata.failed);
466 check ("test3", 1, all, f2line, "f22", &bdata.failed);
467 check ("test3", 2, all, f1line, "test3", &bdata.failed);
468
469 if (bdata.failed)
470 data.failed = 1;
471
472 for (j = 0; j < 3; ++j)
473 {
474 struct symdata symdata;
475
476 symdata.name = NULL;
477 symdata.val = 0;
478 symdata.size = 0;
479 symdata.failed = 0;
480
481 i = backtrace_syminfo (state, addrs[j], callback_three,
482 error_callback_three, &symdata);
483 if (i == 0)
484 {
485 fprintf (stderr,
486 ("test3: [%d]: unexpected return value "
487 "from backtrace_syminfo %d\n"),
488 j, i);
489 symdata.failed = 1;
490 }
491
492 if (!symdata.failed)
493 {
494 const char *expected;
495
496 switch (j)
497 {
498 case 0:
499 expected = "f23";
500 break;
501 case 1:
502 expected = "f22";
503 break;
504 case 2:
505 expected = "test3";
506 break;
507 default:
508 assert (0);
509 }
510
511 if (symdata.name == NULL)
512 {
513 fprintf (stderr, "test3: [%d]: NULL syminfo name\n", j);
514 symdata.failed = 1;
515 }
516 /* Use strncmp, not strcmp, because GCC might create a
517 clone. */
518 else if (strncmp (symdata.name, expected, strlen (expected))
519 != 0)
520 {
521 fprintf (stderr,
522 ("test3: [%d]: unexpected syminfo name "
523 "got %s expected %s\n"),
524 j, symdata.name, expected);
525 symdata.failed = 1;
526 }
527 }
528
529 if (symdata.failed)
530 data.failed = 1;
531 }
532 }
533
534 printf ("%s: backtrace_simple noinline\n", data.failed ? "FAIL" : "PASS");
535
536 if (data.failed)
537 ++failures;
538
539 return failures;
540}
541
542/* Test the backtrace_simple function with inlined functions. */
543
544static inline int test4 (void) __attribute__ ((always_inline, unused));
545static inline int f32 (int) __attribute__ ((always_inline));
546static inline int f33 (int, int) __attribute__ ((always_inline));
547
548static inline int
549test4 (void)
550{
551 return f32 (__LINE__) + 1;
552}
553
554static inline int
555f32 (int f1line)
556{
557 return f33 (f1line, __LINE__) + 2;
558}
559
560static inline int
561f33 (int f1line, int f2line)
562{
563 uintptr_t addrs[20];
564 struct sdata data;
565 int f3line;
566 int i;
567
568 data.addrs = &addrs[0];
569 data.index = 0;
570 data.max = 20;
571 data.failed = 0;
572
573 f3line = __LINE__ + 1;
574 i = backtrace_simple (state, 0, callback_two, error_callback_two, &data);
575
576 if (i != 0)
577 {
578 fprintf (stderr, "test3: unexpected return value %d\n", i);
579 data.failed = 1;
580 }
581
582 if (!data.failed)
583 {
584 struct info all[20];
585 struct bdata bdata;
586
587 bdata.all = &all[0];
588 bdata.index = 0;
589 bdata.max = 20;
590 bdata.failed = 0;
591
592 i = backtrace_pcinfo (state, addrs[0], callback_one, error_callback_one,
593 &bdata);
594 if (i != 0)
595 {
596 fprintf (stderr,
597 ("test4: unexpected return value "
598 "from backtrace_pcinfo %d\n"),
599 i);
600 bdata.failed = 1;
601 }
602
603 check ("test4", 0, all, f3line, "f33", &bdata.failed);
604 check ("test4", 1, all, f2line, "f32", &bdata.failed);
605 check ("test4", 2, all, f1line, "test4", &bdata.failed);
606
607 if (bdata.failed)
608 data.failed = 1;
609 }
610
611 printf ("%s: backtrace_simple inline\n", data.failed ? "FAIL" : "PASS");
612
613 if (data.failed)
614 ++failures;
615
616 return failures;
617}
618
619#if BACKTRACE_SUPPORTS_DATA
620
621int global = 1;
622
623static int
624test5 (void)
625{
626 struct symdata symdata;
627 int i;
628 uintptr_t addr = (uintptr_t) &global;
629
630 if (sizeof (global) > 1)
631 addr += 1;
632
633 symdata.name = NULL;
634 symdata.val = 0;
635 symdata.size = 0;
636 symdata.failed = 0;
637
638 i = backtrace_syminfo (state, addr, callback_three,
639 error_callback_three, &symdata);
640 if (i == 0)
641 {
642 fprintf (stderr,
643 "test5: unexpected return value from backtrace_syminfo %d\n",
644 i);
645 symdata.failed = 1;
646 }
647
648 if (!symdata.failed)
649 {
650 if (symdata.name == NULL)
651 {
652 fprintf (stderr, "test5: NULL syminfo name\n");
653 symdata.failed = 1;
654 }
655 else if (strcmp (symdata.name, "global") != 0)
656 {
657 fprintf (stderr,
658 "test5: unexpected syminfo name got %s expected %s\n",
659 symdata.name, "global");
660 symdata.failed = 1;
661 }
662 else if (symdata.val != (uintptr_t) &global)
663 {
664 fprintf (stderr,
665 "test5: unexpected syminfo value got %lx expected %lx\n",
666 (unsigned long) symdata.val,
667 (unsigned long) (uintptr_t) &global);
668 symdata.failed = 1;
669 }
670 else if (symdata.size != sizeof (global))
671 {
672 fprintf (stderr,
673 "test5: unexpected syminfo size got %lx expected %lx\n",
674 (unsigned long) symdata.size,
675 (unsigned long) sizeof (global));
676 symdata.failed = 1;
677 }
678 }
679
680 printf ("%s: backtrace_syminfo variable\n",
681 symdata.failed ? "FAIL" : "PASS");
682
683 if (symdata.failed)
684 ++failures;
685
686 return failures;
687}
688
689#endif /* BACKTRACE_SUPPORTS_DATA */
690
691static void
692error_callback_create (void *data ATTRIBUTE_UNUSED, const char *msg,
693 int errnum)
694{
695 fprintf (stderr, "%s", msg);
696 if (errnum > 0)
697 fprintf (stderr, ": %s", strerror (errnum));
698 fprintf (stderr, "\n");
699 exit (EXIT_FAILURE);
700}
701
702/* Run all the tests. */
703
704int
705main (int argc ATTRIBUTE_UNUSED, char **argv)
706{
707 state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
708 error_callback_create, NULL);
709
710#if BACKTRACE_SUPPORTED
711 test1 ();
712 test2 ();
713 test3 ();
714 test4 ();
715#if BACKTRACE_SUPPORTS_DATA
716 test5 ();