PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > How to trace function calls?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to trace function calls?

Réponse
 
LinkBack Outils de la discussion
Vieux 30/05/2008, 03h54   #1
nospam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to trace function calls?

I have a C binary which is built from numerous .c and .h source files.
How can I trace through which functions are being called when I execute
the binary? Ideally I'd like to just see the function names accessed.
This is on an HP-UX system, but I'm curious as far as Linux is concerned.


-Thanks

  Réponse avec citation
Vieux 30/05/2008, 04h37   #2
Eric Sosman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

nospam wrote:
> I have a C binary which is built from numerous .c and .h source files.
> How can I trace through which functions are being called when I execute
> the binary? Ideally I'd like to just see the function names accessed.
> This is on an HP-UX system, but I'm curious as far as Linux is concerned.


There's no built-into-C facility to do this, but perhaps
you can find "test coverage" tools that run on the systems
that concern you. (Questions about how to use the tools should
be directed to forums about them or about their host systems;
they're not questions about the C language.)

--
Eric Sosman
esosman@ieee-dot-org.invalid
  Réponse avec citation
Vieux 30/05/2008, 04h54   #3
user923005
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

On May 29, 7:54pm, nospam <n...@spam.com> wrote:
> I have a C binary which is built from numerous .c and .h source files.
> How can I trace through which functions are being called when I execute
> the binary? Ideally I'd like to just see the function names accessed.
> This is on an HP-UX system, but I'm curious as far as Linux is concerned.


This is C++ code, but you can probably translate the idea to C:
http://www.codeproject.com/KB/cpp/cmtrace.aspx

I guess that for your environment, this is what you want:
http://www.tlug.org.za/wiki/index.ph...C_upon_SIGSEGV
  Réponse avec citation
Vieux 30/05/2008, 05h02   #4
Keith Thompson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

nospam <no@spam.com> writes:
> I have a C binary which is built from numerous .c and .h source files.
> How can I trace through which functions are being called when I execute
> the binary? Ideally I'd like to just see the function names accessed.
> This is on an HP-UX system, but I'm curious as far as Linux is concerned.


The C language doesn't define any way to do this. Try asking in
comp.sys.hp.hpux, comp.unix.programmer, or one of the Linux groups.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
  Réponse avec citation
Vieux 30/05/2008, 06h27   #5
CBFalconer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

nospam wrote:
>
> I have a C binary which is built from numerous .c and .h source
> files. How can I trace through which functions are being called
> when I execute the binary? Ideally I'd like to just see the
> function names accessed. This is on an HP-UX system, but I'm
> curious as far as Linux is concerned.


If you are using gcc, look up the -p (and -pg) options. For other
systems see if there are useful profiling commands. This is all
system specific, and thus off-topic here.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


** Posted from http://www.teranews.com **
  Réponse avec citation
Vieux 30/05/2008, 09h29   #6
Richard Tobin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

In article <oPSdnRSGRavj8aLVnZ2dnUVZ_qTinZ2d@comcast.com>,
nospam <no@spam.com> wrote:

>I have a C binary which is built from numerous .c and .h source files.
>How can I trace through which functions are being called when I execute
>the binary? Ideally I'd like to just see the function names accessed.


If all else fails, you can run it under a debugger.

-- Richard

--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
  Réponse avec citation
Vieux 30/05/2008, 15h19   #7
Kenny McCormack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

In article <g1odto$l6r$2@pc-news.cogsci.ed.ac.uk>,
Richard Tobin <richard@cogsci.ed.ac.uk> wrote:
>In article <oPSdnRSGRavj8aLVnZ2dnUVZ_qTinZ2d@comcast.com>,
>nospam <no@spam.com> wrote:
>
>>I have a C binary which is built from numerous .c and .h source files.
>>How can I trace through which functions are being called when I execute
>>the binary? Ideally I'd like to just see the function names accessed.

>
>If all else fails, you can run it under a debugger.


Excuse me. Noone here uses debuggers.

  Réponse avec citation
Vieux 31/05/2008, 17h35   #8
Richard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

user923005 <dcorbit@connx.com> writes:

> On May 29, 7:54Âpm, nospam <n...@spam.com> wrote:
>> I have a C binary which is built from numerous .c and .h source files.
>> How can I trace through which functions are being called when I execute
>> the binary? ÂIdeally I'd like to just see the function names accessed.
>> This is on an HP-UX system, but I'm curious as far as Linux is concerned.

>
> This is C++ code, but you can probably translate the idea to C:
> http://www.codeproject.com/KB/cpp/cmtrace.aspx
>
> I guess that for your environment, this is what you want:
> http://www.tlug.org.za/wiki/index.ph...C_upon_SIGSEGV


Just FYI also see "strace".
  Réponse avec citation
Vieux 02/06/2008, 21h06   #9
Herbert Rosenau
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to trace function calls?

On Fri, 30 May 2008 02:54:54 UTC, nospam <no@spam.com> wrote:

> I have a C binary which is built from numerous .c and .h source files.
> How can I trace through which functions are being called when I execute
> the binary? Ideally I'd like to just see the function names accessed.
> This is on an HP-UX system, but I'm curious as far as Linux is concerned.


It's simple. You'll needs 2 steps.

1. step:

tell the compiler to compile and bind the sources with bouded debug
information.

2. step:

You just starts the program under the control of a debug and tells the
debug what you want from it.

You can do much more now.

You can hold the program at each source line where an executeable
statement is.
You can let the debug show you the value of each variable in sight
when the execution of the debugee is frozen.
You can change the value of each variable in sight at this point too.
And many, many other things too.

The only hurde is: you have to learn how to control the debug.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,18352 seconds with 17 queries