<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi there,</p>
    <p><br>
    </p>
    <p>I'm currently using dwarfdump "2020-01-14 10:13:32-08:00  
      Package Version "20200114"" to look at macros inside the DWARF.</p>
    <p><br>
    </p>
    <p>Imagine two files; test_file1.h and test_file1.cpp<br>
    </p>
    <p>test_file1.cpp is defined as follows:</p>
    <p><br>
    </p>
    <blockquote>
      <p>/*<br>
         * test_file.cpp<br>
         *<br>
         */<br>
        <br>
        #ifdef __cplusplus<br>
        extern "C" {<br>
        #endif<br>
        <br>
        #include "test_file1.h"<br>
        <br>
        #include <fcntl.h><br>
        #include <stdio.h><br>
        #include <sys/stat.h><br>
        #include <sys/types.h><br>
        #include <unistd.h><br>
        <br>
        Square                                         sq              =
        {};<br>
        Circle                                         ci              =
        {};<br>
        #ifdef __cplusplus<br>
        }<br>
        #endif</p>
      <p><br>
      </p>
      <p><br>
      </p>
    </blockquote>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Here are two scenarios for the definition of test_file1.h.</p>
    <p><br>
    </p>
    <p>Scenario #1</p>
    <p>  test_file.h is defined as follows:</p>
    <blockquote>#include "stdint.h"<br>
      <br>
      #define CFE_MISSION_ES_PERF_MAX_IDS 128<br>
      <br>
      <br>
      <br>
      typedef struct CFE_ES_HousekeepingTlm_Payload<br>
      {<br>
          uint32_t PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; 
      /**< \cfetlmmnemonic \ES_PERFFLTRMASK<br>
                                                                 \brief
      Current Setting of Performance Analyzer Filter Masks */<br>
          uint32_t PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32];
      /**< \cfetlmmnemonic \ES_PERFTRIGMASK<br>
                                                                  
      \brief Current Setting of Performance Analyzer Trigger Masks */<br>
      } CFE_ES_HousekeepingTlm_Payload_t;<br>
      <br>
      <br>
      <br>
    </blockquote>
    <p>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.</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Scenario #2</p>
    <p>  test_file.h is defined as follows:</p>
    <p>        <br>
              #define CFE_MISSION_ES_PERF_MAX_IDS 128</p>
    <blockquote>#include "stdint.h"<br>
      <br>
      <br>
      <br>
      typedef struct CFE_ES_HousekeepingTlm_Payload<br>
      {<br>
          uint32_t PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; 
      /**< \cfetlmmnemonic \ES_PERFFLTRMASK<br>
                                                                 \brief
      Current Setting of Performance Analyzer Filter Masks */<br>
          uint32_t PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32];
      /**< \cfetlmmnemonic \ES_PERFTRIGMASK<br>
                                                                  
      \brief Current Setting of Performance Analyzer Trigger Masks */<br>
      } CFE_ES_HousekeepingTlm_Payload_t;<br>
      <br>
      <br>
      <br>
    </blockquote>
    <p>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.</p>
    <p><br>
    </p>
    <p>Is there a reason why in order for macros to show up they have to
      be declared <i>before </i>the #include macro(s)?</p>
    <p><br>
    </p>
    <p>Perhaps I'm missing something obvious?</p>
    <p>Some more info about my system(x86 Intel CPU):</p>
    <p>NAME="Pop!_OS"<br>
      VERSION="20.04 LTS"<br>
      ID=pop<br>
      ID_LIKE="ubuntu debian"<br>
      PRETTY_NAME="Pop!_OS 20.04 LTS"<br>
      VERSION_ID="20.04"<br>
      HOME_URL=<a class="moz-txt-link-rfc2396E" href="https://pop.system76.com">"https://pop.system76.com"</a><br>
      SUPPORT_URL=<a class="moz-txt-link-rfc2396E" href="https://support.system76.com">"https://support.system76.com"</a><br>
      BUG_REPORT_URL=<a class="moz-txt-link-rfc2396E" href="https://github.com/pop-os/pop/issues">"https://github.com/pop-os/pop/issues"</a><br>
      PRIVACY_POLICY_URL=<a class="moz-txt-link-rfc2396E" href="https://system76.com/privacy">"https://system76.com/privacy"</a><br>
      VERSION_CODENAME=focal<br>
      UBUNTU_CODENAME=focal<br>
      LOGO=distributor-logo-pop-os<br>
      <br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Thanks</p>
    <p>Lorenzo<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p></p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>    <br>
    </p>
    <p><br>
    </p>
    <p> <br>
    </p>
  </body>
</html>