[SOLVED] Inability to show variable definition/declaration.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Inability to show variable definition/declaration.

    Hello

    Just bumped into strange behaviour of Ozone debugger (I am a new user). I created a project on the base of Keil (v5.30) 'axf' file and tried to navigate thru source project variables and definitions but was unable to do it. Right click and 'Show definition' or 'Show declaration' failed to show anything. The only I could get is 'Show.Declaration ("VarName"): No source code declaration information.' and 'Show.Definition ("VarName"): No source code definition information.'. Some variables have an option 'Show value in Source' but it fails too. The same goes for symbol definitions (#define Something).
    In the same time when I hover mouse pointer on specific variable the tooltip appears and shows correct information (see attached picture) but not all #definitions show such tooltip and what is more strange, ver 3.10j shows tooltips while ver 3.30d doesn't for the same definition.
    All source files are loaded ('Source File' widget) so entire information is available. Debug and browse information is enabled for this Keil project ('axf' file contains all the symbols). I am a bit confused of this. Maybe I missed something? Google and forum reading couldn't help me.

    Regards,
    sckare
    Images
    • ozone.png

      14.32 kB, 1,567×122, viewed 803 times
  • Hi sckare,
    it appears to be the case that for some symbols Ozone is not capable of identifying the location in the source code. But it appears to be able to find the place where that symbol resides in the target (i.e. the memory address or register), because Ozone is capable of displaying the correct value of that symbol.
    So...
    If you right-click onto a function invocation in the source window and select "Show Definition" the expected behavior is that Ozone opens the source file where that callee-function is implemented and moves the cursor the 1st line of that function. Ozone can do so only in case that file name is known and exists.
    If you experience that this does not work, please open the functions window, navigate to the line containing the information for that callee-function and check the column "Source". Is there a proper file name displayed? If so, please check what happens in case you double-click onto that line. The expected behavior is that the source file is opened and the cursor is moved to the 1st line of that function. Does that happen?
    It might be that you built your binary on a remote build server and the file paths in the AXF/ELF file are those from the build server. If debugging takes place on a different machine (e.g. your local desktop PC) the paths for the same source file is likely to be different. Ozone does know only the locations at build time but not those you use at execution time. In that case Section 5.14. of the Ozone user's manual would be worth reading.
    Does that help you in resolving your issue(s)?
    Best regards.
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex. Thank you for your reply.

    SEGGER - AlexD wrote:


    If you right-click onto a function invocation in the source window and select "Show Definition" the expected behavior is that Ozone opens the source file where that callee-function is implemented and moves the cursor the 1st line of that function. Ozone can do so only in case that file name is known and exists.
    "Show Definition" works only if corresponding function definition exists in the same file it is invoked from. Meanwhile "Show Declaration" works regardless where function definition is. Except of those which are macro substitution but it is not a big deal.

    SEGGER - AlexD wrote:

    please open the functions window, navigate to the line containing the information for that callee-function and check the column "Source". Is there a proper file name displayed? If so, please check what happens in case you double-click onto that line. The expected behavior is that the source file is opened and the cursor is moved to the 1st line of that function. Does that happen?
    This feature works right, exactly like you said.

    SEGGER - AlexD wrote:

    It might be that you built your binary on a remote build server and the file paths in the AXF/ELF file are those from the build server. If debugging takes place on a different machine (e.g. your local desktop PC) the paths for the same source file is likely to be different. Ozone does know only the locations at build time but not those you use at execution time.
    No, the project was built locally. I looked into axf file and all the paths seem correct,
    Regarding Section 5.14 I found some odd lines in the Ozone project:

    Source Code

    1. Project.AddPathSubstitute ("C:/Work/Path", "$(ProjectDir)");
    2. Project.AddPathSubstitute ("c:/work/path", "$(ProjectDir)");
    I.e. these lines are almost the same, the only difference that the second one has low case. Is it all right?
    There's no other file aliases nor search paths in the Ozone project file. Only File.Open for the axf file.
    Anyway, functions resolution works good so it is not sources/paths issue.
  • Hi sckare and happy new year!

    now I'm a bit confused. In your initial post you stated that "show definition" and "show declaration" do not work at all. In your last post you state that this works for functions that reside in the same source file. So in your AXF there are symbols where everything works well and other symbols where the "show definition" and "show declaration" do not work?

    Did you check the functions window working well for symbols where "show definition" and "show declaration" do not work? If so: Can you provide a reproducer project where we can reproduce the issue locally in our labs?

    Best regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex. Happy New Year!

    Actually, I said that only variables and (macro) definitions couldn't be shown. I didn't mention functions because these are mostly ok (so there's no point to check the functions window). At the same time the global variables window is not working properly - double click doesn't show variable's definition/declaration in source code (Show.Source ("Var"): No source info).
    I have prepared a project with same issue (please find in attachment). Not global nor local variables work (No source code definition information etc) as well as macro definitions. The only information I can retrieve of these is tooltip when hovering on it.

    Regards,
    sckare
    Files
    • OzoneTest.zip

      (868.71 kB, downloaded 568 times, last: )
  • Hi Sckare,

    thanks for providing the additional information. On which eval board did you perform your tests?

    Best regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex,

    That project is based on STM32L496ZG microcontroller. Could be used on Nucleo-L496Z etc. But I think it makes no difference because all what you need is just open the project (no physical board is needed).

    Regards
    sckare
  • Hi Sckare,
    thank you. Please provide infos on which steps exactly I need to perform to reproduce the issue. I assume I shall open the Ozone project, bring the "Global Data" window to the front and then double-click on any of the variables listed there. Correct?
    Best regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Sckare,
    thanks! Will any variable do or do I need to use some special variable for that?
    Regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Sckare,

    Finally I found the time to look into this topic.

    Ozone relies on the debug information provided by the build tool chain in the ELF file. This debug information tells Ozone where exactly a symbol is declared. Here's that information for a symbol from a project where everything is fine:

    Source Code

    1. < 1><0x0000002a> DW_TAG_variable
    2. DW_AT_name Counters
    3. DW_AT_type <0x0000003b>
    4. DW_AT_external yes(1)
    5. DW_AT_decl_file 0x00000001 C:\Reproducer\ManyCurves/Source/main.c
    6. DW_AT_decl_line 0x00000012
    7. DW_AT_location len 0x0005: 0x0320050020:
    8. DW_OP_addr 0x20000520
    And here's the corresponding debug information from the ELF file you provided:

    Source Code

    1. < 1><0x00000095> DW_TAG_variable
    2. DW_AT_name SomeArg
    3. DW_AT_type <0x00000091>
    4. DW_AT_const_value 100
    As you can see, the information specifying where to find a symbol is missing (i.e. the attributes `DW_AT_decl_file` for the file name and `DW_AT_decl_line` for the line number in that file).

    Please adapt your toolchain such that the required debug information is created, and Ozone will be able to navigate your code as expected.

    Does that answer your question?

    Best regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex.

    Thank you for info. That sheds some light on the issue. But there are some questions remain. I used fromelf utility of Keil bundle and tried to analyze guts of the ELF (axf) file. Indeed, there are no "decl_file", "decl_line" ("decl_column" too) attributes for "DW_TAG_variable" data. So that is clear to me why Ozone doesn't show a variable position. But what I found else:


    Source Code

    1. 01f7e1: 19 = 0x4 (DW_TAG_enumeration_type)
    2. 01f7e2: DW_AT_sibling 0xc6 (0x1f7fe)
    3. 01f7e4: DW_AT_byte_size 0x1
    4. 01f7e5: 20 = 0x28 (DW_TAG_enumerator)
    5. 01f7e6: DW_AT_name AE_0
    6. 01f7eb: DW_AT_const_value indirect DW_FORM_data1 0x0
    7. 01f7ed: 20 = 0x28 (DW_TAG_enumerator)
    8. 01f7ee: DW_AT_name AE_1
    9. 01f7f3: DW_AT_const_value indirect DW_FORM_data1 0x64
    10. 01f7f5: 20 = 0x28 (DW_TAG_enumerator)
    11. 01f7f6: DW_AT_name AE_2
    12. 01f7fb: DW_AT_const_value indirect DW_FORM_data1 0xc8
    13. 01f7fd: 0 null
    14. 01f7fe: 80 = 0x16 (DW_TAG_typedef)
    15. 01f7ff: DW_AT_name AnotherEnumT
    16. 01f80c: DW_AT_type indirect DW_FORM_ref2 0xa9 (0x1f7e1)
    17. 01f80f: DW_AT_decl_file 0x1
    18. 01f810: DW_AT_decl_line 0x23
    19. 01f811: DW_AT_decl_column 0x3
    Display All
    Enum AnotherEnumT has data to show its placement but still Ozone refuses to do that. Any suggestion?

    Also I tried to find appropriate compiler option to overcome the issue but had no success. Initially, the project has settings like this:




    I.e. debug information is already added (this corresponds to compiler option -g) but no file/line data is there as we could see earlier. Armcc User Guide gives no clue (the only option of interest: "--debug" does nothing useful to me).


    So could you please give some advice what is possible to do? (as Keil v.5 toolchain is considered as supported, according to this).

    P.S. "Browse information" makes it possible navigation in Keil IDE itself (also creates additional crf files) but doesn't affect ELF (axf) file.

    Best regards
    sckare

    The post was edited 1 time, last by sckare ().

  • Hi sckare,

    please find attached a sample project for our Embedded Studio IDE. With this project you can see that Ozone is capable of navigating to the place where an enum is declared.

    Kindly understand that SEGGER cannot provide support for 3rd party tools. In case of questions concerning your tool-chain please contact the respective vendor.

    Does that answer your questions?

    Best regards
    -- AlexD
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex.

    Thank you for response and the sample project. Enum declaration is really navigable (actually, only variable itself but not enum values like enumValX. As well as Struture_t fields.)

    And I understand that it is very difficult to provide support for lots of toolchains. But in that case it would be fair to mention that there is only partial support of Keil/Armcc toolchain (as it has issues due to incomplete DWARF file generation). Because now one might get the impression that it was tested and all features are supported as it is mentioned here.

    So, if there is no solution, please close the thread.

    Best regards
    sckare
  • Hi sckare,
    as stated beforehand: We do not support the 3rd party tool chain. However, so far we did not receive any inquiries by our customers that this quite commonly used feature does not work with Keil/Armcc. So we can assume that this tool chain in general is capable of generating ELF files that contain the required information. The root cause is likely to be found inside your build environment.
    Therefore I strongly recommend to get in touch with your tool chain vendor (or a build manager inside your organization) to get that resolved.
    Best regards
    -- AlexD
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.