Build ELF linux/dump_syms everywhere (also for macOS and for Windows with MinGW)#20
Build ELF linux/dump_syms everywhere (also for macOS and for Windows with MinGW)#20illwieckz wants to merge 11 commits into
Conversation
|
When running it on Wine I get: So maybe it fails on some |
78ae084 to
05f7742
Compare
|
It now works. It was a mistake with flags in the When generating symbol files with the Linux native |
05f7742 to
dffe3ab
Compare
dffe3ab to
0ba693b
Compare
|
So, after having rebased the code over: I symbolized a |
0ba693b to
6cd2cb2
Compare
|
Actually merging this would make far easier to solve some merge conflicts from: Because then we can revert 4678e20: So even if “this code isn't doing anything for us anyhow”, the specialization of the code is generating annoying conflicts. |
|
Anyway, since that's just a copy of the Linux
|
6cd2cb2 to
48d9427
Compare
|
MinGW is now building |
|
Today I learnt that we cannot even build Windows' |
48d9427 to
5a6e226
Compare
d78f4ac to
8a9ff22
Compare
|
It now builds on macOS too. It builds and runs. The symbol files may have some difference, but that is not a bug: 1599c1599
< FUNC cc0 300 0 Cvar::Cvar<float>::Cvar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int, float)
---
> FUNC cc0 300 0 Cvar::Cvar<float>::Cvar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, float)
…
592676c592676
< PUBLIC 660140 0 std::exception_ptr std::make_exception_ptr[abi:ne210000]<std::__1::future_error>(std::__1::future_error)::'lambda'(void*)::__invoke(void*)
---
> PUBLIC 660140 0 std::make_exception_ptr[abi:ne210000]<std::__1::future_error>(std::__1::future_error)::{lambda(void*)#1}::__invoke(void*)
Since the tool now builds everywhere, I could deduplicate this easily. |
33c22d8 to
f19bed4
Compare
|
In fact, now that I did nice compatibility layers, adding support for FreeBSD was straightforward… The ELF |
f19bed4 to
afe3f3a
Compare
|
I checked the master branch on Mac and it already builds a working dump_syms for ELF. So a port is only needed for Windows. |
|
Do you mean our master branch or Google upstream? |
|
Never mind, I confused myself by using the release mode of I will try to build this branch and use the script's non-release mode to test it. |
|
It works with |
| static inline char* breakpad_realpath(const char* path, | ||
| char* resolved) | ||
| { | ||
| DWORD len = GetFullPathNameA(path, MAX_PATH, resolved, nullptr); |
There was a problem hiding this comment.
The size constant is supposed to be PATH_MAX.
| return resolved; | ||
| } | ||
|
|
||
| #ifndef realpath |
There was a problem hiding this comment.
Is there some reason to assume this function would be defined as a macro when it is present?
| Configuration ?= Debug | ||
| all-local: | ||
| cd $(top_srcdir)/src ; ./tools/gyp/gyp --no-circular-check --no-parallel --depth=. -f make client/windows/breakpad_client.gyp | ||
| cd $(top_srcdir)/src ; GYP_DEFINES='OS=win' ./tools/gyp/gyp --no-circular-check --no-parallel --depth=. -f make client/windows/breakpad_client.gyp |
There was a problem hiding this comment.
Where does GYP_DEFINES come from?
There was a problem hiding this comment.
$ grep -r GYP_DEFINES src/tools/gyp/
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = \
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-define-override.py:os.environ['GYP_DEFINES'] = 'OS=fakeos'
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py: os.environ['GYP_DEFINES'] = 'value=50'
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py: os.environ['GYP_DEFINES'] = ''
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py: os.environ['GYP_DEFINES'] = 'value=10'
src/tools/gyp/test/defines/gyptest-defines-env.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py: os.environ['GYP_DEFINES'] = 'value=20'
src/tools/gyp/test/defines/gyptest-defines-env.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py: os.environ['GYP_DEFINES'] = 'value=30'
src/tools/gyp/test/defines/gyptest-defines-env.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py: os.environ['GYP_DEFINES'] = 'value=40'
src/tools/gyp/test/defines/gyptest-defines-env.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/gyp-defines/gyptest-multiple-values.py:os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3'
src/tools/gyp/test/gyp-defines/gyptest-multiple-values.py:os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
src/tools/gyp/test/gyp-defines/gyptest-regyp.py:os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
src/tools/gyp/test/lib/TestGyp.py: # Clear $GYP_DEFINES for the same reason.
src/tools/gyp/test/lib/TestGyp.py: if 'GYP_DEFINES' in os.environ:
src/tools/gyp/test/lib/TestGyp.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/msvs/external_builder/gyptest-all.py: os.environ['GYP_DEFINES'] = 'use_external_builder=1'
src/tools/gyp/test/msvs/external_builder/gyptest-all.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/msvs/external_builder/gyptest-all.py: os.environ['GYP_DEFINES'] = 'use_external_builder=1'
src/tools/gyp/test/msvs/external_builder/gyptest-all.py: del os.environ['GYP_DEFINES']
src/tools/gyp/test/variables/commands/gyptest-commands-ignore-env.py:os.environ['GYP_DEFINES'] = 'FOO=BAR'
There was a problem hiding this comment.
Oh, damn, those are fetched with ./fetch-externals… We should really get rid of gyp!
| endif | ||
|
|
||
| if MACOS_HOST | ||
| AM_CPPFLAGS += -Wno-deprecated-declarations |
There was a problem hiding this comment.
Warnings should just be non-fatal rather than disabled completely. See #22 (this warning is already there on master).
There was a problem hiding this comment.
Can replace that with -Wno-error=deprecated-declarations instead.
| return -1; | ||
| } | ||
|
|
||
| #define sys_mmap mmap |
There was a problem hiding this comment.
The function could be named sys_mmap directly instead of having a function and a macro.
There was a problem hiding this comment.
Yes but there is still original code calling mmap() without sys_ prefix. I preferred to keep the patch smaller and requiring less rewrite.
|
With the addition of #23, the full |
Build ELF
linux/dump_symseverywhere (also for macOS and for Windows with MinGW).It builds and works for both Windows and macOS.
How to build:
You then get:
It makes possible to symbolize NaCl nexe binaries on Windows and on macOS.
Disclaimer: I was assisted by ChatGPT when I was writing and debugging the
posix_compat.hfile, this was done through a discussion with the bot, by explaining the various shortcomings I was facing in my trial and error attempts. For example when I pushed the branch at first there was still a mistake and the tool didn't do anything despite building successfully. After extensive debugging (I even found a bug unrelated to this patch, I'll report) ChatGPT identified the mistake in themmap()compatibility wrapper. The bot also suggested API conversion advises and short snippets I had to adapt in the making of those wrappers. The chat bot didn't have access to the repository (neither read, neither write) and only answered my questions based on my descriptions and its general knowledge of upstream breakpad and APIs from Linux, Windows and MinGW. Once the patch was ready I pasted the diff in the bot conversation and the chat bot identified some shortcomings like redundant things I cleaned-up.