Page 1 of 1

Using GDB with Zeus

Posted: Thu Feb 08, 2024 6:53 am
by jussij
The Zeus Workspace, Debugger menu launched the GDB debugger, and that debugger should work with any compiler that can produce DWARF debug information.
debugger.png
debugger.png (27.83 KiB) Viewed 3681 times
With the debugger running it can then be controlled using the resulting Debugger Control dialog:
gdb-controls.png
gdb-controls.png (15.52 KiB) Viewed 3678 times
NOTE: Other Zeus, D language specific features can be found here:
DCD Autocomplete
Using dfmt on Save
Using Dscanner Inside Zeus

Re: Using GDB with Zeus

Posted: Thu Feb 08, 2024 6:57 am
by jussij
C Language Debugging Example
Consider the following test.c single file application:

Code: Select all

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
  printf("Hello world!\n");

  for (int i = 0; i < argc; ++i)
  {
      printf("%d: => %s\n", i, argv[i]);
  }

  return 0;
}
Assuming the GCC compiler has been installed, the compiler details found in the C/C++ Document Type need to be changed to be changed to be:

Code: Select all

gcc -ggdb "$fn" -o "$fb".exe
With the test.c file active the Compiler, Compile menu will run this compiler command line:

Code: Select all

gcc -ggdb test.c -o test.exe 
That command line will produce a test.exe file containing DWARF symbolic information.

And with the test.c file active the Workspace, Debugger menu will run the GDB compiler for that test.exe file as shown below:
c-gdb.png
c-gdb.png (55.44 KiB) Viewed 3674 times

Re: Using GDB with Zeus

Posted: Thu Feb 08, 2024 7:09 am
by jussij
D Language Debugging Example
Consider the following test.d single file application:

Code: Select all

import std.stdio;

void test(int index)
{
    writeln("Hello: ", index);
}

void main()
{
    writeln("Hello, World!");

    for (int i = 0; i < 10  ; ++i)
    {
        test(i);
    }
}
Assuming the LDC compiler has been installed, the compiler details found in the D Document Type need to be changed to be changed to be:

Code: Select all

ldc2.exe -gdwarf "$fn"
With the test.d file active the Compiler, Compile menu will run this compiler command line:

Code: Select all

ldc2.exe -gdwarf test.d
That command line will produce a test.exe file containing DWARF symbolic information.

And with the test.d file active the Workspace, Debugger menu will run the GDB compiler for that test.exe file as shown below:
d-gdb.png
d-gdb.png (55.63 KiB) Viewed 3672 times