Commit Graph

415 Commits

Author SHA1 Message Date
Jeremy
e1fb3527a4
Fix an issue with split dwarf on clang 2024-07-11 19:10:16 -05:00
Jeremy
611660de5b
Fix use after free during cleanup of split dwarf information, fixes #141 2024-07-02 21:56:35 -06:00
Jeremy
1f19c31e02
Fix bug with dladdr1 not being used, silly typo 2024-06-19 15:15:51 -05:00
Jeremy Rifkin
2fb0a6fd2e
Fix trace generation for cpptrace exception objects on armv7hf (#138)
noexcept on get_raw_trace_and_absorb seems to somehow interfere with
unwinding on armv7hf, possibly due to unwind tables not being generated
for the function. Fixes #134.
2024-06-13 11:17:44 -05:00
Jeremy
bb83fa922c
Merge branch 'dev' 2024-06-11 22:30:27 -05:00
Jeremy
8d7a85c447
Update flatten_inlines to properly move inline frames instead of copying them and also clarify a comment 2024-06-04 23:21:14 -05:00
Infko
72b0e467d7
fix compile error in gcc 4.8.5. (#133) 2024-06-04 23:16:34 -05:00
Jeremy
b8a6e8446a
Quick microfmt fix for an old msvc bug 2024-06-02 12:47:53 -05:00
Jeremy
44ddc1b72f
Merge branch 'main' into dev 2024-06-02 11:35:01 -05:00
Jeremy
59ef49f1a3
Update microfmt 2024-06-02 11:31:43 -05:00
Jeremy
70634cb6f4
Undo temporary change printing object addresses in stack traces 2024-05-28 21:44:13 -05:00
Jeremy
9d1c592f0c
Remove CPPTRACE_CONDA_LIBDWARF_WEIRDNESS bodge and better support libdwarf via pkgconfig, resolves #131 2024-05-28 21:32:54 -05:00
Jeremy Rifkin
b2bff57d81
Debug Fission (#132)
Implement support for debug fission, closes #129
2024-05-28 20:39:34 -05:00
Jeremy
5556aedddb
Refactor cu lookup out of pc resolution 2024-05-25 16:20:41 -05:00
Jeremy
8bff5dc9fe
Quick fix 2024-05-25 14:32:34 -05:00
Jeremy
810b74ecaa
Refactor symbols_with_libdwarf indo separate files 2024-05-25 14:29:55 -05:00
Jeremy
5171e87a51
Refactor logic in the libdwarf resolver's resolve_frames, pull out trace flattening 2024-05-25 13:38:06 -05:00
Jeremy
a9f72c6f67
Refactor logic in the libdwarf resolver's resolve_frames, pull out resolver management 2024-05-25 13:02:25 -05:00
Jeremy
dcd9a31ce4
Refactor collate_frames 2024-05-25 12:38:34 -05:00
Jeremy
dad3bd1843
Some comments regarding dlfcn logistics and comment cleanup 2024-05-25 00:40:08 -05:00
Jeremy
7916f10278
Attempt to fallback to dladdr if dladdr1 is not available 2024-05-24 23:04:20 -05:00
Jeremy
f8d28a6469
Fix incorrect handling of lazy_trace_holder's union, I can't believe I wrote such egregious code 2024-05-23 22:33:56 -05:00
Jeremy
6307700710
Fix ASSERT macro under -Wpedantic 2024-05-23 22:33:33 -05:00
Jeremy Rifkin
b3836e9318
Support -Wpedantic if someone sets the flag globally while using FetchContent (#127)
Closes #107
2024-05-23 21:18:11 -05:00
Jeremy
7c9b24ca72
Fix dwarf_ranges handling of lowpc == pc, it's not correct to jump the gun and not check the high-pc. I think I erroneously added this in c94b03ae6e. Discovered as part of #123. 2024-05-19 17:00:44 -05:00
Jeremy
4884c4e99b
Fix frame pointer calculation for symbol frames under libunwind, #123 2024-05-19 16:36:07 -05:00
Jeremy
b2fe396d70
Fix address formatting, somehow it was left-aligned 2024-05-19 16:28:41 -05:00
Jeremy
323ab5814e
Merge branch 'main' into dev 2024-05-12 22:00:45 -05:00
Ben Dunkin
a70cf7935a
Fix missing cxxabi.h include on Windows when using libc++ (#122)
Make operator precedence explicit so the
`CPPTRACE_HAS_CXX_EXCEPTION_TYPE` define is a dominant switch to use
cxxabi.h, rather than one that only applies when `__GLIBCXX__` is
defined.

Fixes https://github.com/jeremy-rifkin/cpptrace/issues/121
2024-05-12 21:56:38 -05:00
Jeremy
74ed6afc0a
Add cpptrace::system_error 2024-05-06 23:01:11 -05:00
Jeremy
da0aa4d5c0
Split a bunch of internal headers into .cpp/.hpp 2024-05-05 17:44:27 -05:00
Jeremy
d7c19a5544
Updates for conda 2024-05-03 20:07:09 -05:00
Jeremy
abbc77dcea
Clean up logic a bit 2024-05-02 11:17:41 -05:00
Jeremy
d3c7e7351c
Remove guard for resolve_l_name 2024-05-02 11:09:37 -05:00
Jeremy
ce19421bb5
Update for macos 2024-05-02 11:05:22 -05:00
Jeremy
b125248b32
Update dladdr path to not use dli_fname as it's unreliable in the case of a non-standard argv[0] 2024-05-02 10:47:31 -05:00
Jeremy
0527cea39f
For the libbacktrace back-end don't treat missing debug info in ELFs as a critical error; fixes #114 2024-04-28 19:51:52 -05:00
Jeremy
c871c2a43c
Grab new microfmt changes and fix #113 2024-04-27 01:29:39 -05:00
Jeremy
599d6abd6c
Workaround bug for old msvc 2024-03-31 23:51:41 -05:00
Jeremy
0dd71cebb7
Mac fixes 2024-03-31 22:01:14 -05:00
Jeremy
06372b772f
Fix another warning 2024-03-31 16:42:51 -05:00
Jeremy
40696e8d02
Handle MSVC warning treated as error 2024-03-31 16:37:29 -05:00
Jeremy
ffb1b8ed68
A little more error handling cleanup 2024-03-31 16:02:39 -05:00
Jeremy
dc9cee98fb
Move error when returning 2024-03-31 15:52:45 -05:00
Jeremy
124607e7bf
Resolve some TODOs with error handling for mach-o stuff 2024-03-31 15:24:01 -05:00
Jeremy
b04fc09682
Update internal error messages 2024-03-31 14:18:21 -05:00
Jeremy
8007413ff6
Print Result(E) if not absorbing trace exceptions 2024-03-31 14:15:19 -05:00
Jeremy
4db73b1856
Fix assertion failure format string 2024-03-30 23:19:13 -05:00
Jeremy
50483783cb
Fix bug with non-recursive inline walking 2024-03-30 23:18:55 -05:00
Jeremy
ab63c34827
Replace most stream use with new formatting system 2024-03-30 20:25:06 -05:00
Jeremy Rifkin
acaa4f42e6
Add a Result type and replace some exceptions with it (#109) 2024-03-30 13:35:52 -05:00
Jeremy
47e7ee79eb
Formatting update 2024-03-30 11:11:07 -05:00
Jeremy
fa6155ff47
Remove awful stringf system 2024-03-29 23:12:26 -05:00
Jeremy
411fdff8fa
Merge branch 'dev' 2024-03-20 22:08:33 -05:00
Jeremy
d1199dc325
Fix potential null dereference issue, thanks @eyalgolan1337. Resolves #106. 2024-03-20 22:08:21 -05:00
Billy O'Neal
37e6cef4f9
Defend against min and max macros from windows.h (#105)
Alternative to
https://github.com/microsoft/vcpkg/pull/37512/files#diff-9f533b43a5faabaa6b5a0e046f0ae425cd85736808604dd61dc9a955db3d060aR9

I left the examples in mach-o.hpp as they are guarded by #if IS_APPLE
2024-03-18 23:03:26 -05:00
Jeremy
a841a1b74a
Fix msvc warning treated as error 2024-03-16 19:23:03 -05:00
Jeremy
a528aa8e0b
Fix object address resolution with _dl_find_object, #104 2024-03-16 16:17:27 -05:00
Jeremy
3e0689a5e6
Resolve object address for dbghelp frames by default, handles #100 2024-03-09 22:15:41 -06:00
Jeremy
8d6326da07
Update locking in dbghelp_syminit_manager 2024-03-08 17:39:08 -06:00
Jeremy
c896d70f79
Small reorganization 2024-03-05 17:47:55 -06:00
Jeremy
da739d30c5
Add can_signal_safe_unwind and update some documentation surrounding signal-safe stack tracing 2024-03-03 12:15:27 -06:00
Jeremy
ec264aa0eb
Cleanup and improve snippet code a bit 2024-03-03 11:49:15 -06:00
Jeremy
862b546532
Update margin handling 2024-03-03 11:34:09 -06:00
Jeremy
9da2b3f556
Refactor object.hpp, separate out module base logic which greatly cleans things up 2024-03-03 11:31:06 -06:00
Jeremy
f11e119d32
Refactor stacktrace conversion code 2024-03-03 10:54:23 -06:00
Jeremy
389f788b57
Add get_object_info method to stacktrace frames, adding onto the previous work for #97 2024-03-03 10:54:03 -06:00
Jeremy Rifkin
d99f1745d2
Basic source code snippet system (#98) 2024-02-28 23:29:24 -06:00
Jeremy
736643358b
Implement a non-recursive get_inlines_info 2024-02-28 22:30:47 -06:00
Jeremy
0fda4a88ed
Refactor stack trace frame printing 2024-02-28 20:53:28 -06:00
Jeremy
a31d35c04e
Fixes 2024-02-27 19:12:55 -06:00
Jeremy
a24c140baf
Add object address resolution for libdl backend 2024-02-27 19:00:08 -06:00
Jeremy
d17fe33abf
Try to fix build errors 2024-02-27 00:39:58 -06:00
Jeremy
3c7a677689
Add an object address to stacktrace_frame entries, addresses #97 (no pun intended) 2024-02-27 00:34:45 -06:00
Jeremy
d5b2646283
Merge branch 'main' into dev 2024-02-27 00:23:10 -06:00
Bruce Mitchener
a144002bf0
Tweaks from clang-tidy (#92)
This is (perhaps) mainly for discussion as I saw you removed
`clang-tidy` checks last year. These fix a variety of minor things.

With one of the options that I was using, these still remain:

```
/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:235:22: warning: noexcept specifier on the move constructor evaluates to 'false' [performance-noexcept-move-constructor]
  235 |             noexcept(std::is_nothrow_move_constructible<T>::value)
      |                      ^
/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:250:64: warning: noexcept specifier on the move assignment operator evaluates to 'false' [performance-noexcept-move-constructor]
  250 |             noexcept(std::is_nothrow_move_assignable<T>::value && std::is_nothrow_move_constructible<T>::value)
      |                                                                ^
```
2024-02-18 11:21:48 -06:00
Bruce Mitchener
1488460172
Use defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE). (#94)
This is set by the build system when it is available and not set when
not available (and not set to 1/0 respectively).

The current code can generate a warning when this preprocessor
definition is not defined.
2024-02-18 11:16:04 -06:00
Bruce Mitchener
aa446b0540
Fix typos. (#90) 2024-02-18 00:10:21 -06:00
Jeremy
d52b80301a
Make sure to at least show object frame info even if resolution fails for libdwarf, resolves #87
Co-authored-by: eyalgolan1337
2024-02-15 19:40:11 -06:00
Jeremy
22b326ba7e
Small optimization, doesn't really matter but doesn't hurt 2024-02-11 22:22:29 -06:00
Jeremy
e6627b760d
Implement better logic for handling scrfile indices, related to #86 2024-02-11 21:02:48 -06:00
Jeremy
cb92c9fdfa
Small optimization to reduce unnecessary frame copying 2024-02-11 15:59:56 -06:00
Jeremy
36a16df075
Handle an edge case with dwarf file indices, identified in #86 2024-02-11 15:25:18 -06:00
Jeremy
9a7c45bda7
remove return that wasn't needed 2024-02-11 02:05:00 -06:00
Jeremy
cdaab64be2
Revert "Printbug"
This reverts commit 2e9c586ba7.
2024-02-11 01:58:29 -06:00
Jeremy
612d5e6d65
Fix architecture handling in load_mach 2024-02-11 01:53:57 -06:00
Jeremy
2e9c586ba7
Printbug 2024-02-11 01:49:46 -06:00
Jeremy
37630f479d
Try to make fat mach architecture handling more robust 2024-02-08 00:38:56 -06:00
Jeremy
59272bccd6
printbug... 2024-02-07 22:37:55 -06:00
Jeremy
68f919f292
Add ctrace documentation 2024-02-07 00:11:48 -06:00
Jeremy
78dd053f21
Light ctrace refactoring 2024-02-06 23:10:02 -06:00
Jeremy
8f9e8c5c1b
Some formatting consistency tweaks 2024-02-04 13:58:57 -06:00
Jeremy
a3e3916daa
Fix issue with trying to call detail::enable_virtual_terminal_processing_if_needed unconditionally on print 2024-02-04 13:56:46 -06:00
Jeremy
ab2d440a00
Update cpptrace exceptions to defer trace generation to the callsite with a default argument 2024-02-04 13:40:12 -06:00
Jeremy
2f7f5107a5
Add ctrace interface for enable_inlined_call_resolution 2024-02-04 11:10:37 -06:00
Jeremy
d7aac52f8b
Add configuration to control resolution of inlined calls 2024-02-04 11:03:03 -06:00
Jeremy
b8c66cd855
Remove old comment 2024-01-29 22:29:35 -06:00
Jeremy Rifkin
79931c8823
Parsing of mach-o symbol tables, generation of debug maps, and resolution through object files (#82) 2024-01-29 22:12:59 -06:00
eightfold
218957dfb0
New C api (#80)
Updated C API following the requested scheme. May implement "exceptions"
later...

Closes #38

---------

Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>
2024-01-23 00:16:20 -06:00
Jeremy
cfdd311e15
Fix warning for gcc on windows 2024-01-14 23:51:41 -06:00
Jeremy Rifkin
a654f2082e
Mach-o refactoring (#77)
This is the first step towards a more comprehensive mach-o system. Next
step will be to add support for symbol table parsing.
2024-01-14 23:36:30 -06:00
Jeremy
e8c857d6c2
Small tweak for a couple aggregate initializations 2024-01-14 22:27:25 -06:00
Jeremy
2100723312
Another attempt to resolve libdwarf header issues 2024-01-14 19:56:11 -06:00
Jeremy
3e46d2a570
Fix typo 2024-01-14 18:05:31 -06:00
Jeremy
399e52f460
Try again to fix libdwarf #includes 2024-01-14 15:23:02 -06:00
Jeremy
ca76080968
Updates to better support external libdwarf, because nothing about how libdwarf's cmake is setup is consistent 2024-01-13 01:31:10 -06:00
Jeremy
e8fd01bbe1
Fallback to the cu cache or walking cu's if aranges lookup fails 2023-12-06 00:21:44 -05:00
Jeremy
56b50d279a
Update msvc bug workaround to not produce build warnings 2023-12-04 11:30:37 -05:00
Jeremy
6db9794dc6
Workaround a msvc bug affecting msvc 19.38 2023-12-03 21:33:31 -05:00
Jeremy
3a0db500d0
Fixes 2023-11-21 21:32:42 -06:00
Jeremy
64a60f227d
Resolve a couple compilation warnings 2023-11-21 12:11:16 -06:00
Jeremy
e889fa7acf
Use dlfo_link_map->l_addr over dlfo_map_start 2023-11-21 09:41:56 -06:00
Jeremy
0ee29d0855
Use CPPTRACE_PATH_MAX more consistently, and another small refactor 2023-11-20 23:37:49 -06:00
Jeremy
87cd24438b
Use _dl_find_object over dladdr when possible in object resolution, it's so much faster 2023-11-20 23:36:55 -06:00
Jeremy
9113cc5ffc
Some refactoring, bring object_frame in line with safe_object_frame. Also renamed address_relative_to_object_base_in_memory. 2023-11-20 23:13:21 -06:00
Jeremy
2a4a8066d3
Rework the object trace interface a bit and clarify their purpose. Also rename minimal_object_trace to safe_object_trace 2023-11-20 23:01:19 -06:00
Jeremy
7c49e64ba6
Updated documentation, added documentation for new stuff, and updated cpptrace.hpp a bit 2023-11-20 22:14:13 -06:00
Jeremy
6c6d915414
Removed raw_trace::from_buffer, not happy with that api 2023-11-19 23:45:51 -06:00
Jeremy
0b48df7f22
Fix windows build warning 2023-11-19 23:20:31 -06:00
Jeremy
24e64ab385
Check for _dl_find_object support 2023-11-19 23:17:11 -06:00
Jeremy
ac7db48cef
Really fix it this time 2023-11-19 23:07:41 -06:00
Jeremy
f4237c75df
Try to fix build 2023-11-19 22:54:08 -06:00
Jeremy
16ec7c5855
Fix oversight, demangle in object_trace resolution 2023-11-19 22:52:43 -06:00
Jeremy
ac13e71877
Implement signal-safe resolution of basic object information 2023-11-19 22:49:58 -06:00
Jeremy
327a6e8318
Fix two more includes 2023-11-18 23:42:49 -06:00
Jeremy
88319b13a7
Turns out one of the includes was needed 2023-11-18 23:39:59 -06:00
Jeremy
6da8ee0773
Fix a couple includes 2023-11-18 23:38:03 -06:00
Jeremy
5657a07ed4
Remove some no longer needed includes 2023-11-18 23:35:43 -06:00
Jeremy
0e462c7b03
Some restructuring of the directory layout 2023-11-18 23:28:48 -06:00
Jeremy
77a2e3a22b
Rework the exception interface 2023-11-18 09:00:57 -06:00
Jeremy
0de366f7d6
Add column support for libdwarf 2023-11-15 22:50:10 -05:00
Jeremy
140166a4a7
Updated nested exception what message 2023-11-15 21:50:10 -05:00
Jeremy
a518cd8874
Walk subprogram children to handle lambdas better and also cast better 2023-11-15 21:30:11 -05:00
Jeremy
ab7e71f1b2
Add exception wrapping utilities, will help issues like #60 2023-11-15 21:24:26 -05:00
Jeremy
61d536bc02
Put noinline macro in header 2023-11-15 15:22:59 -05:00
Jeremy
520962162c
Improvement for trace printing with missing symbols or filenames 2023-11-15 15:10:22 -05:00
Jeremy
79bc580519
Handle multiple symbol back-ends better 2023-11-15 15:09:08 -05:00
Jeremy
fec5324502
Fix 2023-11-15 12:50:37 -05:00
Jeremy
f6468b7a01
Update _Unwind to not rely on a hard max frames 2023-11-15 12:48:01 -05:00
Jeremy
15572b029d
Bump hard max frames from 100 to 200 2023-11-15 12:47:36 -05:00
Jeremy
0084de0f05
Some tweaks and fixes 2023-11-15 12:17:18 -05:00
Jeremy
feef9a3265
Fix 2023-11-15 11:55:59 -05:00
Jeremy
aed456bc63
Handle null lines / columns better 2023-11-15 11:52:24 -05:00
Jeremy
c6ea891629
Address -Wmissing-field-initializers warnings 2023-11-14 22:58:10 -05:00
Jeremy
96a55fc686
Fix windows build, and prevent future warnings 2023-11-12 23:42:26 -05:00
Jeremy
e80afd460b
Add safe tracing interface 2023-11-12 23:31:41 -05:00
Jeremy Rifkin
5541ec5519
Add libunwind back-end (#62) 2023-11-12 17:15:59 -05:00
Jeremy
259d596f76
Re-enable warnings 2023-11-08 23:59:48 -05:00
Jeremy
4c1c42c61d
Add frame_ptr alias 2023-11-08 21:32:34 -05:00
Jeremy
7929d239bd
Create a cache for CU srcfiles 2023-11-08 20:47:29 -05:00