apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.61k stars 3.26k forks source link

[Enhancement] Doc about How to DEBUG using VSCODE? #32423

Open AcKing-Sam opened 7 months ago

AcKing-Sam commented 7 months ago

Search before asking

Description

Hi, everyone. I want to debug backend of Doris by using VSCODE. However, I tried the official doc, I still can't lauch the GDB to debug. Could I get some help? The below is my lauch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/qfshen/workspace/doris/output/be/lib/doris_be",
            "args": [],
            "stopAtEntry": false,
            "cwd": "/home/qfshen/workspace/doris/output/be",
            "environment": [{"name":"PALO_HOME","value":"/home/qfshen/workspace/doris/output/be/"},
                            {"name":"UDF_RUNTIME_DIR","value":"/home/qfshen/workspace/doris/output/be/lib/udf-runtime"},
                            {"name":"LOG_DIR","value":"/home/qfshen/workspace/doris/output/be/log"},
                            {"name":"PID_DIR","value":"/home/qfshen/workspace/doris/output/be/bin"}
                           ],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

The doris location is correct: 0x03 Also, my gdb version is : 0x05

Solution

No response

Are you willing to submit PR?

Code of Conduct

koarz commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

koarz commented 7 months ago

But it looks like the documentation's PALO_HOME hasn't been changed to DORIS_HOME, so I reckon I should need to use DORIS_HOME instead of PALO_HOME now

AcKing-Sam commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

Thanks for your help! I will try using attach instead of launch to debug.

AcKing-Sam commented 7 months ago

But it looks like the documentation's PALO_HOME hasn't been changed to DORIS_HOME, so I reckon I should need to use DORIS_HOME instead of PALO_HOME now

Yes, I noticed this problem and I changed to DORIS_HOME, however it still did not work ;)

AcKing-Sam commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

Could you please tell me your dev environment, like size of RAM and number of cores? I doubt that it can't run because of the machine(for me, it's 4c8g ubuntu) :)

koarz commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

Could you please tell me your dev environment, like size of RAM and number of cores? I doubt that it can't run because of the machine(for me, it's 4c8g ubuntu) :)

My machine is 16c16g, despite that sometimes there's not enough RAM, 4c8g doesn't look like it's up to the minimum configuration

AcKing-Sam commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

Could you please tell me your dev environment, like size of RAM and number of cores? I doubt that it can't run because of the machine(for me, it's 4c8g ubuntu) :)

My machine is 16c16g, despite that sometimes there's not enough RAM, 4c8g doesn't look like it's up to the minimum configuration

Thanks a lot for your kind help! It seems the machine setting is a reason.

koarz commented 7 months ago

I haven't used Launch debugging, but attach debugging doris is very convenient, maybe you can try to use lldb's attach debugging here is my config

        {
            "name": "CodeLLDB attach",
            "type": "lldb",
            "request": "attach",
            "program": "${workspaceFolder}/output/be/lib/doris_be",
            "pid": "${command:pickMyProcess}"
        }

Simply select the be process that has been started and you're done!

Could you please tell me your dev environment, like size of RAM and number of cores? I doubt that it can't run because of the machine(for me, it's 4c8g ubuntu) :)

My machine is 16c16g, despite that sometimes there's not enough RAM, 4c8g doesn't look like it's up to the minimum configuration

Thanks a lot for your kind help! It seems the machine setting is a reason.

You're welcome. Try again with a new machine.

AcKing-Sam commented 7 months ago

@koarz Thanks again for your help! I used my local machine with LLDB's attach mode and it can debug successfully!

AcKing-Sam commented 7 months ago

For this issue, it seems that the doc mentioned the machine request is at least 10c16g to run debugger successfully.

codeDing18 commented 7 months ago

For this issue, it seems that the doc mentioned the machine request is at least 10c16g to run debugger successfully.

hi,Is your BE compiled by yourself(BUILD_TYPE=Debug sh build.sh) or is it an official package?

AcKing-Sam commented 7 months ago

@codeDing18 Hi, thanks for your suggestion! I compiled the BE by myself. The problem was handled after I changed another machine. ;)

m719030572 commented 6 months ago

When try to gdb attach with process id, i get "DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array [in module /root/doris/output/be/lib/doris_be] (No debugging symbols found in output/be/lib/doris_be)"