-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macros Quirks and Issues #35
Comments
Another quirk: Imagine two files; test_file1.h and test_file1.cpp test_file1.cpp is defined as follows: /*
* test_file.cpp
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "test_file1.h"
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef __cplusplus
}
#endif Here are two scenarios for the definition of test_file1.h. Scenario #1 test_file.h is defined as follows: #include "stdint.h"
#define CFE_MISSION_ES_PERF_MAX_IDS 128
typedef struct CFE_ES_HousekeepingTlm_Payload
{
uint32_t PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFFLTRMASK
\brief Current Setting of Performance Analyzer Filter Masks */
uint32_t PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFTRIGMASK
\brief Current Setting of Performance Analyzer Trigger Masks */
} CFE_ES_HousekeepingTlm_Payload_t; After compiling with "gcc -g3 -c -gdwarf-4 test_file1.cpp -o test_file1_copy_dwarf4.o" and then running "dwarfdump test_file1_dwarf4.o > dwarf4_test_file1.txt". The Macro doe NOT show up in dwarf4_test_file1.txt. It does show up under the debug string table but not under the "debug_macro" section. Scenario #2 test_file.h is defined as follows:
#define CFE_MISSION_ES_PERF_MAX_IDS 128
#include "stdint.h"
typedef struct CFE_ES_HousekeepingTlm_Payload
{
uint32_t PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFFLTRMASK
\brief Current Setting of Performance Analyzer Filter Masks */
uint32_t PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFTRIGMASK
\brief Current Setting of Performance Analyzer Trigger Masks */
} CFE_ES_HousekeepingTlm_Payload_t; After compiling with "gcc -g3 -c -gdwarf-4 test_file1.cpp -o test_file1_dwarf4.o" and then running "dwarfdump test_file1_dwarf4.o > dwarf4_test_file1.txt". The Macro DOES show up in dwarf4_test_file1.txt. It does show up under the "debug_macro" section. Is there a reason why in order for macros to show up they have to be declared before the #include macro(s)? If I link the "test_file1.o" file with "gcc -g3 -nostartfiles -Llib -gdwarf-4 test_file1_copy.o -o test_file1_linked_dwarf4.o" the macro shows up in the DWARF, regardless of whether it is defined before/after the #include. |
Learned a few things going down this rabbit hole. |
* -Write macro records correctly. Fixes #7 * -Cleanup * -Update unit testing for draco patterns. WIP. * -Update eclipse project * -Minimally functional target_symbol * -Do not store row id for symbol target updates * -Update github CI * -Docker config for CI * -Point submodules to github * -Cleanup * -Add symbols and encoding mappings. WIP. * -Add symbols and encoding mappings. WIP. * Writer DWARF5 ecodings to encodings table * -Add minimally functional encodings implementation. -TODO:Cleanup. * -Update Makefile * -Update gitignore * -Cleanup * -Remove Ubuntu18 from github actions since it is not available anymore. -https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/ * -Remove dead code * -Cleanup * -Cleanup * -Cleanup * -Include unit test code in format checks. -Format unit test code. * -Update unit tests * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Update docs * -Update unit tests for new schema. WIP. -TODO:Add function to follow target symbols to test typdef'd types. -TODO:Add unit tests for new macro and elf image features. * -Add followTargetSymbol. Useful for testing typedef'd types. -Update unit tests. * -Use CFE_ES_HousekeepingTlm_Payload for unit testing. * -Update docs * -Update docs * -Extract ELF image data from 64-bit targets properly. -Add ElfClass to ElfFile * -Update docs * -Update unit-test test files * -Remove libdwarf from unit test code test file * -Remove dead code * -Remove dead code * -Add 32-bit make recipes. -Add 32-bit unit tests. * -Update 32-bit unit testing. * -Update docs * -Remove dead code * -Update Logger unit tests -Remove dead code * -Update unit tests * -Update docs * -Cleanup * -Cleanup * -Cleanup * -Add macro unit test. -Update Dockerfile * -Create test files that comply with DWARF4 and DWARF5. Allows us to verify support of DWARF4 as more features are added in the future. * -Unit test DWARF4 and DWARF5. WIP. * -Add DWARF4 testing to Dockerfile * -Cleanup * -Update docs * -Update docs * -Update Catch 2 due to issue on Ubuntu22:catchorg/Catch2#2178 * -pathIndex handling for DWARF5. TODO:This changes for DWARF4, so add alternative for DWARF4. -Remove DisplayDie function for now as it blows up the stack with big c++ names inside DWARF. -TODO:Rewrite DisplayDie function -Add include to src/Artifact.h, needed for Ubuntu22. * -Handle DWARF dbg source files for DWARF4 and 5. -TODO:Figure out what to do about Ubuntu 20/22 behavior producing different DWARF src file line number info for the same DWARF version. * -Add group number as CLI argument. WIP. -Issues of interest:#36, #35 * -Group number argument. Useful for getting DWARF data from multiple COMBAT sections, like macros inside of unlinked ELF files. * -Add unit tests for macros across multiple COMDAT groups. * -Cleanup * -Update docs * -Update unit tests. * -Update Dockerfile for Ubuntu22 * -Update CI * -Update Dockerfiles for Ubuntu20 and Ubuntu22 * -Update Makefile * -Update CI * -Update CI * -Test DWARF version in unit tests * -Update docs * -Update docs * -Update docs * -Update docs. WIP. * -Update docs * -Cleanup * -Cleanup * -Update docs. -Remove DECL code from pointer types. Pointer types do not have DECL coords. * -Add unit tests for artifacts * -Cleanup * -Update test_file1 * -Remove dead code * -Update tests in Docker files * -Update docs * -Update docs * -Update docs * -Update unit tests * -Fix Field constructors * -Minimal testing for bitfields. WIP. * -Update Docker files -Update Makefile * -Add Ubuntu18 to CI. -Update docs * -Update docs * -Update docs * -Update docs * -Update docs * -Update clang_format_all * -Add format checks to Dockerfile.ubuntu20 * -Update clang_format_all * -Format code * -Cleanup * -Add error-checking for groupNumber * -Push coveralls report * -Update docs * -Update CI --------- Co-authored-by: Mathew Benson <[email protected]>
* -Write macro records correctly. Fixes #7 * -Cleanup * -Update unit testing for draco patterns. WIP. * -Update eclipse project * -Minimally functional target_symbol * -Do not store row id for symbol target updates * -Update github CI * -Docker config for CI * -Point submodules to github * -Cleanup * -Add symbols and encoding mappings. WIP. * -Add symbols and encoding mappings. WIP. * Writer DWARF5 ecodings to encodings table * -Add minimally functional encodings implementation. -TODO:Cleanup. * -Update Makefile * -Update gitignore * -Cleanup * -Remove Ubuntu18 from github actions since it is not available anymore. -https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/ * -Remove dead code * -Cleanup * -Cleanup * -Cleanup * -Include unit test code in format checks. -Format unit test code. * -Update unit tests * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Configure coveralls.io for CI * -Update docs * -Update unit tests for new schema. WIP. -TODO:Add function to follow target symbols to test typdef'd types. -TODO:Add unit tests for new macro and elf image features. * -Add followTargetSymbol. Useful for testing typedef'd types. -Update unit tests. * -Use CFE_ES_HousekeepingTlm_Payload for unit testing. * -Update docs * -Update docs * -Extract ELF image data from 64-bit targets properly. -Add ElfClass to ElfFile * -Update docs * -Update unit-test test files * -Remove libdwarf from unit test code test file * -Remove dead code * -Remove dead code * -Add 32-bit make recipes. -Add 32-bit unit tests. * -Update 32-bit unit testing. * -Update docs * -Remove dead code * -Update Logger unit tests -Remove dead code * -Update unit tests * -Update docs * -Cleanup * -Cleanup * -Cleanup * -Add macro unit test. -Update Dockerfile * -Create test files that comply with DWARF4 and DWARF5. Allows us to verify support of DWARF4 as more features are added in the future. * -Unit test DWARF4 and DWARF5. WIP. * -Add DWARF4 testing to Dockerfile * -Cleanup * -Update docs * -Update docs * -Update Catch 2 due to issue on Ubuntu22:catchorg/Catch2#2178 * -pathIndex handling for DWARF5. TODO:This changes for DWARF4, so add alternative for DWARF4. -Remove DisplayDie function for now as it blows up the stack with big c++ names inside DWARF. -TODO:Rewrite DisplayDie function -Add include to src/Artifact.h, needed for Ubuntu22. * -Handle DWARF dbg source files for DWARF4 and 5. -TODO:Figure out what to do about Ubuntu 20/22 behavior producing different DWARF src file line number info for the same DWARF version. * -Add group number as CLI argument. WIP. -Issues of interest:#36, #35 * -Group number argument. Useful for getting DWARF data from multiple COMBAT sections, like macros inside of unlinked ELF files. * -Add unit tests for macros across multiple COMDAT groups. * -Cleanup * -Update docs * -Update unit tests. * -Update Dockerfile for Ubuntu22 * -Update CI * -Update Dockerfiles for Ubuntu20 and Ubuntu22 * -Update Makefile * -Update CI * -Update CI * -Test DWARF version in unit tests * -Update docs * -Update docs * -Update docs * -Update docs. WIP. * -Update docs * -Cleanup * -Cleanup * -Update docs. -Remove DECL code from pointer types. Pointer types do not have DECL coords. * -Add unit tests for artifacts * -Cleanup * -Update test_file1 * -Remove dead code * -Update tests in Docker files * -Update docs * -Update docs * -Update docs * -Update unit tests * -Add support for unions. WIP. * -Add support for unions. WIP. * -Update CI to build Ubuntu20 first. * -Update CI to build Ubuntu20 first. * -Format files * -Update union object used for unit tests * -Add user to docker dev configs * -Add support for unions. WIP. -Update unit tests for unions. WIP. * -Minimally functional union support. -TODO:Upgrade to C++17 and std::optional for union fields, which will be NULL (or empty). * -Remove dead code * -Upgrade to C++17. -Use optional for byte offset of fields. -When byte offset value is empty, write NULL to db. This allows to make a distinction between unions and structs. -TODO:Finish union unit testing. -TODO:Add union support documentation. * -Update docs * -Remove duplicate recipes from Makefile * -Handle default case in getdbgSourceFile * -Update unit testing for union support * -Update unit testing for union support * -Update docs * -Update docs * -Use std::optional for symbol encoding * -Add vscode config * -Add tests for padding. Fixes #21 * -Give root access to dev docker user * -Use std::optional for getdbgSourceFile * -Do not attempt to add padding for unions. -Add checks to padding function. * -Add warning message when field byte offsets do not exist * -Add warning message when field byte offsets do not exist * -Use git tag and latest commit as version value * -Log warning when there is no DW_AT_name attribute --------- Co-authored-by: Mathew Benson <[email protected]>
When redefining a macro like this:
For some reason that macro does not appear to be in the DWARF section anymore.
Tested this with:
dwarfdump 2020-01-14 10:13:32-08:00 Package Version "20200114"
.Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
VERSION="20.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
LOGO=distributor-logo-po
Some links of interest:
The text was updated successfully, but these errors were encountered: