Re: line numbers in error messages are off wrt debuggers

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: line numbers in error messages are off wrt debuggers
Date: 2018-06-20 16:26:42
Message-ID: 20180620162641.irzf5psdlbj4mr6s@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2018-06-20 12:12:26 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I'm fairly frequently annoyed that when I see an error message in the
> > log, I can't just generally set a breakpoint on the included line
> > number. That's because the line number in the error message is from the
> > *end* of the message:
>
> IME it varies depending on which compiler you use; some report the line
> where the ereport is. So I'm doubtful that there's going to be much we
> can do about it. Probably this behavior is bound up with macro expansion
> vs. just when __LINE__ is expanded.
>
> (No, I won't hold still for a coding requirement that all ereport calls
> be smashed onto a single line ;-))

Hah, me neither ;)

> Personally, my habit is to set the breakpoint at errfinish, which works
> independently of just where the call is.

I do that too, occasionally. Doesn't really if there's a lot of error
messages before the bug you're waiting for happens though.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-06-20 16:38:57 Re: Avoiding Tablespace path collision for primary and standby
Previous Message Alvaro Herrera 2018-06-20 16:23:42 Re: pgsql: Store 2PC GID in commit/abort WAL recs for logical decoding