473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

stack tracing

Is there anything in php that lets me trace the call stack or do I have to
implement something like that on my own?

e.g., I could insert somethign like $callstack[sizeof($callstack)] =
__FUNCTION__; at the top of every function and
unset($callstack[sizeof($callstack)-1]);

So that I could trace the to code to where an error occured and know the
function "path" that created it. Of course its probalby not worth it if I
have to clutter up all the code very every return statement will need to
have that coupled with it.

Thanks,
Jon
May 14 '07 #1
17 3105
Jon Slaughter schrieb:
Is there anything in php that lets me trace the call stack or do I have to
implement something like that on my own?
How about googling for "php call stack"?

*SCNR*

OLLi

--
"Well, lady I must say-- (admiring smile) You're my kinda stupid."
[Mal, firefly 113]
May 14 '07 #2
On 14.05.2007 04:00 Oliver Grätz wrote:
Jon Slaughter schrieb:
>Is there anything in php that lets me trace the call stack or do I have to
implement something like that on my own?

How about googling for "php call stack"?

*SCNR*

OLLi
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 14 '07 #3
On 14.05.2007 02:06 Jon Slaughter wrote:
Is there anything in php that lets me trace the call stack or do I have to
implement something like that on my own?

e.g., I could insert somethign like $callstack[sizeof($callstack)] =
__FUNCTION__; at the top of every function and
unset($callstack[sizeof($callstack)-1]);

So that I could trace the to code to where an error occured and know the
function "path" that created it. Of course its probalby not worth it if I
have to clutter up all the code very every return statement will need to
have that coupled with it.

Thanks,
Jon

hi, look for debug_backtrace in manual

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 14 '07 #4
At Mon, 14 May 2007 10:13:43 +0200, gosha bine let his monkeys type:
On 14.05.2007 04:00 Oliver Grätz wrote:
>Jon Slaughter schrieb:
>>Is there anything in php that lets me trace the call stack or do I
have to implement something like that on my own?

How about googling for "php call stack"?

*SCNR*

OLLi

Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)
You could try a php debugger, such as Gubed, Xdebug.
May 14 '07 #5
Jon Slaughter wrote:
So that I could trace the to code to where an error occured and know the
function "path" that created it.
Use Exceptions:

throw new Exception("Argh!");

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 14 '07 #6
gosha bine wrote:
On 14.05.2007 04:00 Oliver Grätz wrote:
>Jon Slaughter schrieb:
>>Is there anything in php that lets me trace the call stack or do I
have to implement something like that on my own?

How about googling for "php call stack"?

*SCNR*

OLLi

Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)
Take a look at debug_backtrace();

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 14 '07 #7
gosha bine schrieb:
>How about googling for "php call stack"?

*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)
I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi

--
According to my calculations the problem doesn't exist.
May 14 '07 #8
Oliver Grätz wrote:
gosha bine schrieb:
>>How about googling for "php call stack"?

*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)

I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi
http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?

if you rtfm someone, be prepared to be rtfm'd yourself. ;)


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 14 '07 #9
At Mon, 14 May 2007 23:06:05 +0200, gosha bine let his monkeys type:
Oliver Grätz wrote:
>gosha bine schrieb:
>>>How about googling for "php call stack"?

*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)

I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi

http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?

if you rtfm someone, be prepared to be rtfm'd yourself. ;)
Gosha, I'm not sure what your gripe with Olli or his reply to OP is, but
on my system and ENGLISH google it's the 2nd hit (probably since a few
here checked the link). So his reply hit the mark, I suppose. Perhaps you
checked in a non-enlish version? Or are ou referring to something
completely different (in which case I apologize for the confusion)

Sh.

May 14 '07 #10

"gosha bine" <st********@gmail.comwrote in message
news:46**********************@read.cnntp.org...
Oliver Grätz wrote:
>gosha bine schrieb:
>>>How about googling for "php call stack"?

*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)

I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi

http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?

if you rtfm someone, be prepared to be rtfm'd yourself. ;)


Technically your right!! I think Oliver owes you an apology ;)
May 14 '07 #11
Schraalhans Keukenmeester wrote:
Gosha, I'm not sure what your gripe with Olli or his reply to OP is, but
on my system and ENGLISH google it's the 2nd hit (probably since a few
here checked the link). So his reply hit the mark, I suppose. Perhaps you
checked in a non-enlish version? Or are ou referring to something
completely different (in which case I apologize for the confusion)
http://www.google.com/search?q=php+call+stack
-vs-
http://www.google.com/search?q=%22php+call+stack%22

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 15 '07 #12
At Tue, 15 May 2007 06:19:37 +0100, Toby A Inkster let his monkeys type:
Schraalhans Keukenmeester wrote:
>Gosha, I'm not sure what your gripe with Olli or his reply to OP is, but
on my system and ENGLISH google it's the 2nd hit (probably since a few
here checked the link). So his reply hit the mark, I suppose. Perhaps you
checked in a non-enlish version? Or are ou referring to something
completely different (in which case I apologize for the confusion)

http://www.google.com/search?q=php+call+stack
-vs-
http://www.google.com/search?q=%22php+call+stack%22
Yep, I missed that. Not sure that's what Olli intended by "php call stack"
but it's feasable one would use the quoted string.
Thanks for clearing that up Toby!

I'll crawl back under my rock now.
Sh.
May 15 '07 #13
On 15.05.2007 01:13 Schraalhans Keukenmeester wrote:
At Mon, 14 May 2007 23:06:05 +0200, gosha bine let his monkeys type:
>Oliver Grätz wrote:
>>gosha bine schrieb:
How about googling for "php call stack"?
>
*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)
I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi
http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?

if you rtfm someone, be prepared to be rtfm'd yourself. ;)

Gosha, I'm not sure what your gripe with Olli or his reply to OP is, but
on my system and ENGLISH google it's the 2nd hit (probably since a few
here checked the link). So his reply hit the mark, I suppose. Perhaps you
checked in a non-enlish version? Or are ou referring to something
completely different (in which case I apologize for the confusion)

Sh.
Schraalhans,

I have no gripe with Olli personally, I just don't like "google for xyz"
kind of replies. They do nothing but show disrespect to OP and to the
group as whole. Hope you understand this.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
May 15 '07 #14
At Tue, 15 May 2007 10:03:29 +0200, gosha bine let his monkeys type:
On 15.05.2007 01:13 Schraalhans Keukenmeester wrote:
>At Mon, 14 May 2007 23:06:05 +0200, gosha bine let his monkeys type:
>>Oliver Grätz wrote:
gosha bine schrieb:
>How about googling for "php call stack"?
>>
>*SCNR*
Well, this brings up 4 links none of which have to do with the question.
Got another google? ;)
I switched my Google settings to the original english google.com to
check this BEFORE answering so don't try to pull one on me. Result
number 2 is

http://www.php.net/debug_backtrace

OLLi

http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?

if you rtfm someone, be prepared to be rtfm'd yourself. ;)

Gosha, I'm not sure what your gripe with Olli or his reply to OP is, but
on my system and ENGLISH google it's the 2nd hit (probably since a few
here checked the link). So his reply hit the mark, I suppose. Perhaps you
checked in a non-enlish version? Or are ou referring to something
completely different (in which case I apologize for the confusion)

Sh.

Schraalhans,

I have no gripe with Olli personally, I just don't like "google for xyz"
kind of replies. They do nothing but show disrespect to OP and to the
group as whole. Hope you understand this.
I see what you mean Gosha. Personally I lean towards sympathizing
with the one writing such a response to a question that OP simply could at
least have tried to find an answer to. Some people (if the shoe fits....)
tend to (ab)use newsgroups as their first source of information.
How to tell them to do their homework first next time is a matter of
personal preference, mood of the day, social skills, the desire to
please, the weather perhaps and then some. With you I am all for a polite
approach, unless someone clearly and repeatedly disregards any advice
given. And yes, I know using the plonk button in these cases is better
than writing a flame, but sometimes the itch is too intense not to scratch
it.

Thanks for your explanation Gosha!
Sh.

P.S. Jon, have you by now found what you were looking for? In the "heat of
the debate" the threat wandered off a little...

May 15 '07 #15
gosha bine schrieb:

http://www.google.com/search?q=%22php+call+stack%22
isn't that what you said?
Nope. Strings in PHP have to be enclosed in quotes (and we are talking
PHP, aren't we?). So if I wanted him to search for the exact term "php
call stack", then I would have told him to google for '"php call stack"'
or "\"php call stack \"". Since I didn't...

OLLi
--
Tancredi: "I’m supposed to give you a physical this evening. Let me
apologize in advance for the heavy dose of irony we’re about to
participate in."
Burrows: "It’s all right, just doing your job."
Tancredi: "Yeah, well letting the State know that you’re healthy enough
to execute is not why I went to medical school."
[Prison Break 105]
May 15 '07 #16
gosha bine wrote:
I have no gripe with Olli personally, I just don't like "google for xyz"
kind of replies.
If people don't want answers like "Google for XYZ" then they should Google
for XYZ before they ask the question.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 15 '07 #17
Toby A Inkster schrieb:

If people don't want answers like "Google for XYZ" then they should Google
for XYZ before they ask the question.
Thanks.

OLLi

--
"Haben deine Träume jetzt Untertitel?"
[Medium 112, und ja, haben sie ;-)]
May 16 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: kevin.hall | last post by:
Is there a way with Linux x86 to report a way the current stack trace for a thread during runtime without a debugger? (I couldn't find anything searching Google.) For Windows this is possible. ...
0
by: Hananiel | last post by:
Is there a way to somehow generate a stack trace for every change to the stack? That is, I want the snapshot of the stacktrace for the whole program, but i dont want to write a traceline method in...
1
by: | last post by:
Hi all i posted this question yesterday. no answers yet. please do reply if you have any ideas. thanks a lot. Subject: stack frame stack trace can the information from the stack be obtained...
2
by: deepukutty | last post by:
Hi all, I know tht we can do tracing in two ways.one in application level and the other is at Page level. I am able to see the details of trace either on the page itself or .../trace.axd page....
6
by: saju.prabhakaran | last post by:
We have an application developed in c++ and the development environment is visual studio .net 2003. We have added a cpp program to the application which will create a log file containing the trace...
2
by: PengYu.UT | last post by:
Usually assert only print the current function. But I also need to know which function called the current function. Is there anyway to make it print out the whole stack? Thanks, Peng
2
by: abubakarm | last post by:
Hi, There is a strang bug appearing not-so-often in my application. I'm pasting the stack calls window contents when my app crashes. Following it is: msvcr80d.dll!fastcopy_I(void *...
5
by: James Stroud | last post by:
Hello All, The built-in mac osx vecLib is segfaulting in some cases--A very fun fact to find out the hard way over two nights of work. I also spent an embarrassing amount of time figuring out...
62
by: jt | last post by:
hello everyone.. int fun() { /* anything */ } int main(void) { fun(); }
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.