[ABANDONED] J-Scope crashes with multiple C++ factory methods

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

  • [ABANDONED] J-Scope crashes with multiple C++ factory methods

    We have encountered a crash scenario with J-Scope V7.92f (version 7.70e is the last one that does not crash) during parsing of an ELF-file that contains a C++ class with more than one factory method (using arm-none-eabi-g++-12)

    Example code to reproduce:

    C Source Code: main.cpp

    1. #define MAKE_ME_FAIL
    2. class MyClass
    3. {
    4. public:
    5. MyClass() = default;
    6. MyClass(int i) : rawVal(i){};
    7. static MyClass Method(int i)
    8. {
    9. return MyClass(i);
    10. };
    11. #ifdef MAKE_ME_FAIL
    12. static MyClass AnotherMethod(int i)
    13. {
    14. return MyClass(i);
    15. };
    16. #endif
    17. int rawVal;
    18. };
    19. MyClass fixp;
    20. int main(void){
    21. return 0;
    22. }
    Display All

    Trying to load with MAKE_ME_FAIL defined will make max out the CPU usage of J-Scope, until it finally crashes. The screen freezes with this window:




    When only using one factory method (MAKE_ME_FAIL is false), the program does not crash, but there are already hints why it goes wrong: there seems to be a recursion when parsing the symbols:



    Please provide a fix so our teams can continue using this useful tool with our c++-codebase.

    You can use arm-none-eabi-g++ -gdwarf-4 -T linker.ld main.cpp -o main.elf to reproduce, with this minimum linker file:

    Source Code

    1. MEMORY
    2. {
    3. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
    4. RAM (rw) : ORIGIN = 0x20000000, LENGTH = 20K
    5. }
    6. ENTRY(main)
    7. SECTIONS
    8. {
    9. .text : {
    10. KEEP(*(.vector_table))
    11. *(.text)
    12. *(.text*)
    13. __data_source = .;
    14. . = ALIGN(4);
    15. } > FLASH
    16. .data : {
    17. __data_start = .;
    18. *(.data)
    19. . = ALIGN(4);
    20. __data_size = SIZEOF(.data);
    21. } > RAM AT> FLASH
    22. .bss : {
    23. __bss_start = .;
    24. *(.bss)
    25. *(.bss*)
    26. . = ALIGN(4);
    27. __bss_size = SIZEOF(.bss);
    28. } > RAM
    29. .stack (NOLOAD) : {
    30. . = . + 0x400; /* Stack size */
    31. __stack = .;
    32. } > RAM
    33. }
    Display All

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

  • Hello,

    thanks for the report. Could you provide the .ELF file for reproduction purposes?

    Best regards,
    Matthias Konegen
    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.