How to set a breakpoint for ClickHouse code? - lldb

I am building ClickHouse like this:
$ cmake -DCMAKE_C_COMPILER=$(which clang-14) -DCMAKE_CXX_COMPILER=$(which clang++-14) -DCMAKE_BUILD_TYPE=Debug ..
Launching debugger
$ lldb ./clickhouse -- server
Current executable set to '/home/user/ClickHouse/build/programs/clickhouse' (x86_64).
Trying to set a breakpoint
$ breakpoint set --file /home/user/ClickHouse/src/Storages/MergeTree/MergeTreeData.cpp --line 3564
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
But unable to do it. How to set a breakpoint?
Versions:
Commit 075bcf3f5fce73f8f554a5c132730d0f79c77707
Ubuntu 20.04.2 LTS
lldb version 10.0.0
Ubuntu clang version 14.0.0-++20220309053128+569b773323a3-1~exp1~20220309053228.98
cmake version 3.16.3
ninja version 1.10.0

Related

Unable to use breakpoints and other features in lldb [duplicate]

I'm on Windows 10, compiled llvm 11 with MSVC 16.
This is main.cpp:
#include <iostream>
int main()
{
std::cout << "Hello world" << std::endl;
}
These are the commands I run
clang -g -O0 main.cpp -o a.exe
lldb a.exe
(lldb) target create "a.exe
Current executable set to 'C:\a.exe' (x86_64).
(lldb) b main.cpp:5
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) b main
Breakpoint 2: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint set --name main
Breakpoint 3: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
What am I doing wrong?
I succeeded by recompiling llvm with these detailed instructions for compiling lldb on windows.
Specifically:
Installed Visual Studio sdk for Visual Studio Community 2019
Installed the latest Windows 10 sdk
Registered the Debug Interface Access DLLs with regsvr32 (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\msdia140.dll and C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64\msdia140.dll)

LLDB warning : Unable to resolve the breakpoint location

I am trying to debug a program with lldb and clang.
Error is thrown
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations
I am trying it on Windows 10 and have latest version of clang (8.0)
I am trying with a command to compile a program with this clang -g -O0 test.c -o test and to debug I am giving lldb test and for breakpoint
b test.c:3
I am actually looking for debug information . But nothing seems to be working fine...any solution for this ?
I tried the same thing on ubuntu , with same command and everything works correctly.
I think Windows version of LLDB still under development.

gdb Debugger stuck on 62% during initialization in Eclipse

I am new to coding and trying to get eclipse neon running on my macbook air. I am having trouble getting the debugger to work. I installed gdb with homebrew, created a certificate and signed gdb as per the instructions in the link:
https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html
I then configured eclipse debugger settings with the location of the newly installed gdb. However now when I try to start the debugger, the initialization process starts but gets stuck forever on 62%. Any tips on how to solve this? Could it be a memory issue? MBA has 4gb RAM...
This is a known bug in CDT - Bug #509737
The problem in summary is that CDT version 9.2.0 cannot work with GDB version 7.12.
One way to resolve this is to use an older version of GDB, for example GDB version 7.11
Another way to workaround this is to pretend GDB 7.12 is actually version 7.11.
Create the following executable script:
#!/bin/sh
if [ "$1" = "--version" ]; then
echo "GNU gdb (Debian 7.11-1) 7.11"
exit
fi
exec /usr/local/bin/gdb "$#"
and configure eclipse to run it instead of gdb.

Debugging C with Code::Blocks

I made my code as a standalone .c file and read that, in order to debug, the file must be in a project. So I made an empty project and added my file to it, set some breakpoints and, when i run the debugger, I get this on console:
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 13112
Error in re-setting breakpoint 2: PC register is not available
Error in re-setting breakpoint -3: PC register is not available
In ()
Tried some tutorials and whatched some videos without success. Does somebody knows a fix for that? Is there a simpler way to debug a .c file?
For linux system you could use gdb as debugger in this way:
$ vim hello.c
# include <stdio.h>
int main()
{
printf("hello \n");
}
$ gcc -o hello hello.c
$ ./hello
$ gdb hello
(gdb) break main
(gdb) run
and then you can use:
c or continue
n or next
s or step
For more details see this.
Updated MinGW downloading it from its sourceforge repositor.
Downloaded the 6.2.0 version that is available in this link.
Then I unziped it to C:\ and modified the environment variable Path to add the new C:\MinGW\bin folder. To know if you made it correctly just open CMD and type gcc --version.
After that, I modified the compiller and debugger settings of Code::Blocks to use the new version of MinGW and its executables.
Now it is compiling and debugging properly.
According to Free Pascal's GDB Debugger Tips the problem is with GDB and they cite Bug 14018.
It appears you should use a different version of GDB. They suggest downgrading to 7.2. Now I believe other versions are now available, like 8.0. I don't know if GDB 8.0 suffers it too.

/lib/libc.so.6: version `GLIBC_2.17' not found

I am trying to compile a program to put on a BeagleBone black, but im getting this error
when running the program on my board:
/lib/libc.so.6: version `GLIBC_2.17' not found
I made sure that i cross compiled for ARM (arm-linux-gnueabi-gcc).
On my desktop, I have EGLIBC 2.17-9.
What did i do wrong?
Had face the same problem.
Solved it by the following steps.
Downloaded "libc6_2.17-0ubuntu5.1_i386.deb"
sudo dpkg -i ipts libc6_2.17-0ubuntu5.1_i386.deb
sudo dpkg -i ipts libc6_2.17-0ubuntu5.1_i386.deb
Download 64 bit package from this site https://launchpad.net/ubuntu/raring/amd64/libc6/2.17-0ubuntu4
Install libc6 2.17 by the command ,
sudo dpkg -i libc6_2.17-0ubuntu4_amd64.deb
Cheers !
You don't have glibc 2.17 installed on your target board. You need to ensure that you have the SAME version of glibc (for ARM) installed on both the target board and on your build machine (your desktop). You can do this by either installing 2.17 on the target board or by figuring out what version you have installed there and installing that same version on your build machine (and linking with it).
This shell script worked for me: https://groups.google.com/forum/#!category-topic/beagleboard/oPq-Xt0TVdY
see the response from "A P" which is a script that installs a later version on the beaglebone black:
I am running a beaglebone black rev C with debian wheezy.
#!/bin/sh
echo "deb http://ftp.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get update
apt-get -t sid install libc6 libc6-dev libc6-dbg
echo "Please remember to hash out sid main from your sources list. /etc/apt/sources.list"

Resources