Tracing function calls


#1

Hi,
I needed to trace the functions that Asterisk calls when an event, such as a new call occurs.
I tried using ddd to debug the Asterisk process…But whenever I instruct ddd to run the program, instead of Asterisk working, it exits.
I even tried running Asterisk beforehand and then running ddd and trying to attach it to the already existing process. It does get attached but when I try to run the program again, Asterisk exits.

Is there something that I am missing out on?
What am I doing wrong??
All I want to do is debug the process and trace the function calls.

HELP! :frowning:

Thanks in advance…
Neokrish.


#2

When I tried to trace some functions, I used most stupid debuging - writing messages in console.
And this is working.
As I know, there are special way to compile Asterisk - as one thread or something like this - just for debuging.


#3

Umm… Okay. Could you just provide a little bit of clarification please…
is it the CLI console you are talking about or the console of linux? ( shell ).
And the magic you did to make that happen would be??? :smile:
I tried this for more than 3 days and I give up cos I see no way to make DDD run this.
Pretty please with cherry on top. You gotto tell me how you got the trace of the calls.
I mean like
First it calls handle_request. Then handle_request_invite is called… and so on.
Thanks in advance.
bye :smile:


#4

I am speacking about CLI.
There is function in Asterisk which writes in CLI:
ast_log(LOG_WARNING, "Setting IDLE polarity due " “to ring. Old polarity was %d\n”, p->polarity);
A year ago I need to trace reverce polarity - this is the reason I am giving this as example.
My approach mean you must know ahead which functions are involved.
Then in every function you must put ast_log with parameters you wish to trace.
After thet - recompilation, reinstalation, restart.
Very havy approach - it could be OK only if you can’t find something better.
Of cource at evry single step, you will learn more about functions, then you will put more trace strings etc.
Time consuming - really - and of cource without any guarantee you will find what you are looking for.
You could loose a week or more this way.


#5

Okay… That indeed is a heavy procedure. And also, it requires for me to know my functions beforehand which is exactly what I hope to achieve by tracing. Its a full circle now. Trace functions manually seems like the bottom line for me. :frowning:
Thanks a ton for the help :smile: If you do find any other approach, please do let me know.
Byee


#6

Normally during the call you could get some clues - meaning to orient yourself which functions are called.
Then looking at functions, looking at Asterisk documentation, looking…
You could get idea where to … look :smile:)))
After that you will get idea what to look for.
Then - somebody will solve the problem :smile:)))
Just as it happend with reverce polarity.
But I had some other problem - with astcc (calling cards) and account code.
According requirements of one client, I decided to use 20 digit account code - surprise - in CLI I can see only 19 digits. Then search files with accountcode in them, then find where is defined length of account code - and problem is solved.

These are just examples.