gpt4 book ai didi

Attaching debugger with Apache Age - MACOS(将调试器与ApacheAge-MACOS连接)

转载 作者:bug小助手 更新时间:2023-10-25 17:17:57 24 4
gpt4 key购买 nike



I'm trying to debug my code on MacOS using a debugger. I attempted to attach gdb debugger, but it didn't work, and running gdb in the terminal returns the following error:

我正在尝试使用调试器在MacOS上调试我的代码。我尝试附加gdb调试器,但不起作用,在终端运行gdb返回以下错误:


syed@syeds-mbp ~ % gdb
zsh: command not found: gdb

How can I attach AGE with a debugger like gdb for development purposes?

为了开发的目的,我如何将AGE与像GDB这样的调试器联系起来?


更多回答
优秀答案推荐

Upon some research I found that Apple switched from gcc to clang and stopped including gdb in MacOS.
The debugger for clang is lldb (Low Level Debugger) and is available in MacOS.

在一些研究中,我发现苹果从GCC改为CLANG,并停止在MacOS中包含GDB。Clang的调试器是lldb(低级调试器),在MacOS中可用。


NOTE: Make sure debugging is enabled in your PostgreSQL configuration and lldb flag is set. If not , run the following:

注意:确保在您的PostgreSQL配置中启用了调试,并且设置了lldb标志。如果没有,请运行以下命令:


./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-glldb"

Steps to attach lldb with PostgreSQL processes:

将lldb与PostgreSQL进程相关联的步骤:



  1. Open a new terminal and type the follwing:


ps auxwww | grep postgres | grep -v grep

This command filters out the currently running processes and only returns those containing the word "postgres" in them. Copy the PID of your postgres process.

该命令过滤掉当前运行的进程,并且只返回其中包含单词“postgres”的进程。复制您的postgres进程的PID。



  1. Running lldb by typing the following in the terminal to launch lldb.


lldb


  1. Attach your postgres process with lldb by running:


attach PID      //replace PID with your postgres PID

You can now use lldb for debugging similar to gdb.

您现在可以使用lldb进行类似于gdb的调试。



Firstly, you need to install gdb using homebrew:

首先,您需要使用自制软件安装GDB:


brew install gdb

After that run the Apache AGE server using GDB with debug symbol enabled.

之后,使用启用了调试符号的gdb运行Apacheage服务器。


gdb -ex run --args age <AGE_ARGUMENTS>

Also, you can use the GDB commands to set breakpoints and inspect through the code.

此外,您还可以使用gdb命令设置断点并检查代码。


更多回答

If you are primarily a gdb user new to lldb you might find this page handy: lldb.llvm.org/use/map.html

如果您主要是一个新接触lldb的gdb用户,您可能会发现这个页面很方便:lldb.llvm.org/use/map.html

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com