Re: PostgreSQL stops when adding a breakpoint in CLion

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Stanislav Bashkyrtsev <stanislav(dot)bashkirtsev(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL stops when adding a breakpoint in CLion
Date: 2022-01-03 18:52:09
Message-ID: a0add4d2-3668-c19a-d7d4-d54312c484e9@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/3/22 16:54, Stanislav Bashkyrtsev wrote:
> I tried debugging PostgreSQL to better understand how it works. It
> worked fine a day ago, but for some reason I have issues with debugging now:
>
> - If I put a breakpoint before I start the process then everything works
> fine
> - But if I put/remove a breakpoint after it's fully initialized - the
> process just stops
>
> And when reading the next command postgres.c, I see that
> input_message is empty. I assume CLion sends a signal which awakens
> PostgreSQL, but there's no data on the input? But should PostgreSQL quit
> in such a situation?
>

Why do you think postgres quits? AFAIK CLion uses gdb or lldb for
debugging, which are the debugger of choice for many (most?) hackers on
this list. So that should work fine.

> The way I build and start:
> make clean
> ./configure --enable-cassert --enable-debug CFLAGS="-ggdb -O0 -g3
> -fno-omit-frame-pointer"
> make
> make install
> /usr/local/pgsql/bin/initdb -D /Users/stas/projects/postgres/data
>
> Starting command:
> /usr/local/pgsql/bin/postgres --single -D
> /Users/stas/projects/postgres/data postgres

Now sure why you start it in single-user mode, but I don't think that
should affect debugging. Try redirecting the output to a log file, maybe
that'll tell you what happened.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Benesch 2022-01-03 18:54:58 Re: Remove inconsistent quotes from date_part error
Previous Message Gunnar "Nick" Bluth 2022-01-03 18:42:55 Re: [PATCH] pg_stat_toast v0.4