回溯功能 [英] Backtrace function

查看:214
本文介绍了回溯功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


任何人都可以建议在ANSI /

标准C中实现回溯功能的方法,如下面的链接所示?

http://pramode.net/2006/09/12/gettin...code/#more-144

Dear all,

can any one suggest ways of implementing a backtrace function in ANSI/
standard C as given in the following link ?

http://pramode.net/2006/09/12/gettin...code/#more-144

推荐答案

在文章< c3 ********************************** @ s8g2000prg.g ooglegroups.com> ;,

sophia< so ********** @ gmail.comwrote:
In article <c3**********************************@s8g2000prg.g ooglegroups.com>,
sophia <so**********@gmail.comwrote:

>亲爱的,

任何人都可以建议在ANSI /
标准C中实现回溯功能的方法,如下面的链接所示?

http://pramode.net/2006 /09/12/gettin...code/#more-144



神圣指导。


(嗯,eith)呃,或者在标准定义的范围之外踩得很好

来深入了解实施的内部结构,并找到你想要的信息。它可能在某个地方

(虽然有些情况下它可以在不破坏任何东西的情况下被遗漏掉),所以实际上找到它是一个简单的问题out

在哪里查看以及如何解释你所看到的内容,然后希望它在升级你的编译器时不会改变
。)

dave


-

爱斯基摩网上的Dave Vandervies dj3vande com

这是书中的立式喜剧。

这是比立式喜剧形式的立式喜剧更有趣。

- 奥玛丽施瓦茨在可怕的恶魔修道院中

Divine Guidance.

(Well, either that or stepping well outside what the Standard defines
to grovel through the implementation''s internal structures and finding
the information you want that way. It''s probably there somewhere
(though there are cases where it can be left out without breaking
anything), so actually getting to it is a simple matter of finding out
where to look and how to interpret what you see, and then hoping it
doesn''t change when you upgrade your compiler.)
dave

--
Dave Vandervies dj3vande at eskimo dot com
It''s standup comedy in book form.
Which is far more entertaining than standup comedy in standup comedy form.
--Omri Schwarz in the scary devil monastery


sophia说:
sophia said:

亲爱的,


可以任何人提出在ANSI /中实现回溯函数的方法

以下链接中给出的标准C?

Dear all,

can any one suggest ways of implementing a backtrace function in ANSI/
standard C as given in the following link ?

http://pramode.net/2006/09/12/gettin...code/#more-144


当实现backtrace(),backtrace_symbols()和

backtrace_symbols_fd()等函数时,最好的位置是

编译器 - 编写器。你*可以*在便携式ISO C

程序中做类似的事情,但AFAIK这样做的唯一方法是设置一个自愿的

机制,每个函数,在输入,将其名称推送到为此目的提供的类似于堆栈的数据结构 - 然后在返回之前再次弹出

名称。我自己在两个或两个
三个站点上完成了这个,并且看到它已经完成了几个。这并不是非常困难

- 最棘手的一点就是确保即使在低内存的情况下它仍能正常工作,这意味着要么转向malloc& co或者早点收到你的

内存请求。


-

Richard Heathfield< http:// www。 cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

http://pramode.net/2006/09/12/gettin...code/#more-144

When implementing functions such as backtrace(), backtrace_symbols(), and
backtrace_symbols_fd(), the best place to be sitting is the desk of the
compiler-writer. You *can* do something similar in a portable ISO C
program, but AFAIK the only way to do so is to set up a voluntary
mechanism whereby each function, on entry, pushes its name onto a
stack-like data structure provided for the purpose - and which then pops
the name off again just before returning. I''ve done this myself on two or
three sites, and seen it done on several more. It''s not terribly difficult
- the trickiest bit is making sure that it still works even in low-memory
situations, which means either steering clear of malloc&co or getting your
memory request in nice and early.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


sophia< so ********** @ gmail.comwrites:
sophia <so**********@gmail.comwrites:

任何人都可以建议在ANSI /

标准C中实现回溯函数的方法,如下面的链接所示?

http://pramode.net/ 2006/09/12 / gettin ...代码/#more-144



在标准C中没有可移植的方法。


-

Keith Thompson(The_Other_Keith)< ks *** @ mib.org>

诺基亚

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

There''s no portable way to do that in standard C.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于回溯功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆