4

I want to debug the C source code under test when use Ceedling. I found that the following command could be used, but I could not set breakpoint. It seems the symbol information is not generated. I use the default settings in project.yml and I checked -g option is enabled in defaults.rb config file.

gdb --args -S rake test:sample_program
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
Reading symbols from ruby...(no debugging symbols found)...done.
ks1322
  • 33,961
  • 14
  • 109
  • 164
SRAK
  • 91
  • 1
  • 5
  • Please check other questions in stackoverflow. Does this one work? http://stackoverflow.com/questions/5244509/no-debugging-symbols-found-when-using-gdb – jojo Jan 05 '17 at 15:38
  • Yes, I read that post, as mentioned, I verified '-g' option is enabled in the configuration. May be I am checking in wrong configuration file. I am new to Ceedling and Ruby, so it is not clear what is going wrong. Anyway Thanks for your suggestion. – SRAK Jan 05 '17 at 16:03
  • Possible duplicate of [gdb how to execute target program from script](http://stackoverflow.com/questions/25274752/gdb-how-to-execute-target-program-from-script/). – Mark Plotnick Jan 05 '17 at 17:45
  • Possible duplicate of [How do I print the full value of a long string in gdb?](http://stackoverflow.com/questions/233328/how-do-i-print-the-full-value-of-a-long-string-in-gdb) – Fueled By Coffee Jan 05 '17 at 19:25
  • Mark Plotnick I will try out your suggestion. I am getting some idea on where to look. Thanks! – SRAK Jan 06 '17 at 04:00
  • DoTheDew No, I think that one is a different topic! – SRAK Jan 06 '17 at 04:01

3 Answers3

5

Well, I find someway! In Ceedling project, the executable is located in \build\test\out\test_sample.out

I tried,

gdb build\test\out\test_sample.out

Now, all symbols are loaded and I can set breakpoint and step as well.

This may not be Ceedling way of debugging, but it works for me!!

SRAK
  • 91
  • 1
  • 5
1

For those of us using Visual Studio Code with the Ceedling Test Explorer extension, the following launch.json file (put inside the .vscode folder) can be used to debug with GDB:

{
    "version": "0.2.0",
    "configurations": [
        {
            // Use the following for the Ceedling Explorer Debug Configuration
            "name": "ceedling_gdb",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            // May omit the following if gdb is on the PATH
            "miDebuggerPath": "<path to gdb executable>",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

This will conveniently launch whichever test module you click the little bug icon.

Derived from https://gist.github.com/bd2357/b2d69ab18849c1e2f70959eef426ff09

mrtumnus
  • 347
  • 4
  • 17
0

Thanks SRAK

FYI, for MacOS, I used

lldb build/test/out/test_sample.out

since whichever gdb (installed by home brew) expects a different format.

Cheers,

Greg

greg.lund
  • 11
  • 2