Re: Stack trace

Lists: pgsql-hackers
From: "Bramandia Ramadhana" <bramandia(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Stack trace
Date: 2008-11-04 04:11:28
Message-ID: 700260640811032011x530b8716se82ad37757fbfee3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

Is there any way to print out the stack trace of the current location?

I am looking for something like print_stack_trace(); that I can insert in
arbitrary location in the code.

Thank you,

Regards,

Bramandia R.


From: Emmanuel Cecchet <manu(at)frogthinker(dot)org>
To: Bramandia Ramadhana <bramandia(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stack trace
Date: 2008-11-04 04:26:09
Message-ID: 490FCEE1.9050401@frogthinker.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bramandia Ramadhana wrote:
> Is there any way to print out the stack trace of the current location?
Not sure if Postgres has something in the utils for that.
You can use backtrace() in glibc. Solaris 9 libc has printstack(). Not
sure what's available for Windows.
> I am looking for something like print_stack_trace(); that I can insert
> in arbitrary location in the code.
Some references:
http://www.tlug.org.za/wiki/index.php/Obtaining_a_stack_trace_in_C_upon_SIGSEGV
http://www.delorie.com/gnu/docs/glibc/libc_665.html

manu

--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu(at)frogthinker(dot)org
Skype: emmanuel_cecchet


From: "Bramandia Ramadhana" <bramandia(at)gmail(dot)com>
To: "Emmanuel Cecchet" <manu(at)frogthinker(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stack trace
Date: 2008-11-17 06:08:57
Message-ID: 700260640811162208u31dec815gc1def290d8f9a30d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hm the backtrace() method does not give the line numbers of the methods in
the stack trace, it only gives the hexadecimal offset. Is there anyway to
retrieve the line numbers?

I have tried to Google it but to no avail.

Regards,

Bramandia R.

On Tue, Nov 4, 2008 at 12:26 PM, Emmanuel Cecchet <manu(at)frogthinker(dot)org>wrote:

> Bramandia Ramadhana wrote:
>
>> Is there any way to print out the stack trace of the current location?
>>
> Not sure if Postgres has something in the utils for that.
> You can use backtrace() in glibc. Solaris 9 libc has printstack(). Not sure
> what's available for Windows.
>
>> I am looking for something like print_stack_trace(); that I can insert in
>> arbitrary location in the code.
>>
> Some references:
>
> http://www.tlug.org.za/wiki/index.php/Obtaining_a_stack_trace_in_C_upon_SIGSEGV
> http://www.delorie.com/gnu/docs/glibc/libc_665.html
>
> manu
>
> --
> Emmanuel Cecchet
> FTO @ Frog Thinker Open Source Development & Consulting
> --
> Web: http://www.frogthinker.org
> email: manu(at)frogthinker(dot)org
> Skype: emmanuel_cecchet
>
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bramandia Ramadhana" <bramandia(at)gmail(dot)com>
Cc: "Emmanuel Cecchet" <manu(at)frogthinker(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stack trace
Date: 2008-11-17 06:11:57
Message-ID: 18499.1226902317@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Bramandia Ramadhana" <bramandia(at)gmail(dot)com> writes:
> Hm the backtrace() method does not give the line numbers of the methods in
> the stack trace, it only gives the hexadecimal offset. Is there anyway to
> retrieve the line numbers?

Did you build with --enable-debug?

regards, tom lane


From: "Bramandia Ramadhana" <bramandia(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Emmanuel Cecchet" <manu(at)frogthinker(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stack trace
Date: 2008-11-17 08:47:18
Message-ID: 700260640811170047ia1b1875k9c559f6bd3569ad2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Yes, I use --enable-debug as an option in configure

Regards,

Bramandia R.

On Mon, Nov 17, 2008 at 2:11 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "Bramandia Ramadhana" <bramandia(at)gmail(dot)com> writes:
> > Hm the backtrace() method does not give the line numbers of the methods
> in
> > the stack trace, it only gives the hexadecimal offset. Is there anyway to
> > retrieve the line numbers?
>
> Did you build with --enable-debug?
>
> regards, tom lane
>


From: "Hannes Eder" <hannes(at)hanneseder(dot)net>
To: "Bramandia Ramadhana" <bramandia(at)gmail(dot)com>
Cc: "Emmanuel Cecchet" <manu(at)frogthinker(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stack trace
Date: 2008-11-17 10:19:08
Message-ID: 154e089b0811170219p3884d696n1f42d2c48424cc61@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 17, 2008 at 7:08 AM, Bramandia Ramadhana
<bramandia(at)gmail(dot)com> wrote:
> Hm the backtrace() method does not give the line numbers of the methods in
> the stack trace, it only gives the hexadecimal offset. Is there anyway to
> retrieve the line numbers?

the binutil addr2line should do the trick.

Best,
Hannes