Re: [HACKERS] “Core” function in Postgres

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Mingzhe Li <mingzhe0908(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] “Core” function in Postgres
Date: 2014-09-23 23:56:24
Message-ID: CAM3SWZR+yrugdC18Jix26x_JKUYdnLZgJimBtgAt56XdgMUFrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 23, 2014 at 4:29 PM, Mingzhe Li <mingzhe0908(at)gmail(dot)com> wrote:
> I want to know what's the "core" function used in Postgres server? I am
> looking for something corresponding to main() in a simple C program. I want
> to know the file path and the function name. I am using Postgres 9.3.5,
> however I assume the "core" function will be unchanged between different
> revisions.
>
> Please let me know if you are confused by my question.

I think that the tcop is the closest thing to what you're looking for
(which includes postgres.c/PostgresMain()). There is a very simple
stub entry point ("main(int argc, char *argv[])") within main.c, too,
which is the real entry point.

Why not just set some breakpoints in a place that seems interesting
from within GDB, and inspect the call stack? That can be a useful
technique for gaining understanding of the structure of complicated
codebases that you're totally unfamiliar with.

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-09-24 00:02:57 Re: "Core" function in Postgres
Previous Message Andres Freund 2014-09-23 23:42:53 Re: Scaling shared buffer eviction