serenity icon indicating copy to clipboard operation
serenity copied to clipboard

can i gdb SerenityOS

Open YFJiang opened this issue 1 year ago • 3 comments

Hi, Can I gdb SerenityOS? Thanks.

YFJiang avatar May 02 '24 03:05 YFJiang

https://lab.bjg.io/serenityos/gdb-port.html

gdb: https://github.com/SerenityOS/serenity/pull/12676

sdb: https://github.com/SerenityOS/serenity/pull/1885

dotnetCarpenter avatar May 02 '24 07:05 dotnetCarpenter

Hi there!

It depends on what you mean.

If you want to run gdb on the entire OS, you can use Meta/serenity.sh gdb and that will let you debug the kernel.

If you want to debug an app inside SerenityOS, we have the sdb command which is similar to gdb. We also have a gdb port which you can install to run gdb. (Go to that directory and run the package.sh script to install it.)

AtkinsSJ avatar May 02 '24 07:05 AtkinsSJ

The serenity.sh script also provides a number of other commands. Run the script without arguments for a list.

$ ./Meta/serenity.sh

Usage: serenity.sh COMMAND [TARGET] [TOOLCHAIN] [ARGS...]
  Supported TARGETs: aarch64, x86_64, riscv64, lagom. Defaults to SERENITY_ARCH, or x86_64 if not set.
  Supported TOOLCHAINs: GNU, Clang. Defaults to SERENITY_TOOLCHAIN, or GNU if not set.
  Supported COMMANDs:
    gdb:        Same as run, but also starts a gdb remote session.
                TARGET lagom: serenity.sh gdb lagom LAGOM_EXECUTABLE [-ex 'any gdb command']...
                    Passes through '-ex' commands to gdb
                All other TARGETs: serenity.sh gdb [TARGET] [KERNEL_CMD_LINE] [-ex 'any gdb command']...
                    If specified, passes the KERNEL_CMD_LINE to the Kernel
                    Passes through '-ex' commands to gdb

Documentation: https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md#build

Further help: SerenityOS Discord

dotnetCarpenter avatar May 02 '24 07:05 dotnetCarpenter

Hi there!

It depends on what you mean.

If you want to run gdb on the entire OS, you can use Meta/serenity.sh gdb and that will let you debug the kernel.

If you want to debug an app inside SerenityOS, we have the sdb command which is similar to gdb. We also have a gdb port which you can install to run gdb. (Go to that directory and run the package.sh script to install it.)

Thanks. The first one is what i want. I will look into that.

YFJiang avatar May 04 '24 04:05 YFJiang

The serenity.sh script also provides a number of other commands. Run the script without arguments for a list.

$ ./Meta/serenity.sh

Usage: serenity.sh COMMAND [TARGET] [TOOLCHAIN] [ARGS...]
  Supported TARGETs: aarch64, x86_64, riscv64, lagom. Defaults to SERENITY_ARCH, or x86_64 if not set.
  Supported TOOLCHAINs: GNU, Clang. Defaults to SERENITY_TOOLCHAIN, or GNU if not set.
  Supported COMMANDs:
    gdb:        Same as run, but also starts a gdb remote session.
                TARGET lagom: serenity.sh gdb lagom LAGOM_EXECUTABLE [-ex 'any gdb command']...
                    Passes through '-ex' commands to gdb
                All other TARGETs: serenity.sh gdb [TARGET] [KERNEL_CMD_LINE] [-ex 'any gdb command']...
                    If specified, passes the KERNEL_CMD_LINE to the Kernel
                    Passes through '-ex' commands to gdb

Documentation: https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md#build

Further help: SerenityOS Discord

It helps. Thanks.

YFJiang avatar May 04 '24 05:05 YFJiang