GDB question on displaying cycles
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > GDB question on displaying cycles




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    GDB question on displaying cycles  
Christian Christmann


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-07 06:17 PM

Hi,

I'm simulating binaries (for a DSP) in gdb. Everything works fine.
Now I want to display the (approx.) consumed cycles for a specific
routine. Up to now, I was doing this manually, an example:
1) I set the breakpoint to the first instruction of the routine
2) continued execution to this point
3) displayed value of $cycles
4) set a breakpoint at the very last instruction of this function
5) continued execution to this point
6) run "stepi" to simulate the last instruction execution
7) displayed the value of $cycles

The difference between the second and first value of $cycles
was the execution time for this routine.

Now I want to automatize this process by putting all the
gdb commands into file that I pass with "--command=" to gdb.
My problem is 4). How can I set a breakpoint to the last
instruction of a routine (the routine name is known) without
looking at the code (and manually determine the instruction
address)?

Thank you.

Regards,
Chris






[ Post a follow-up to this message ]



    Re: GDB question on displaying cycles  
Paul Pluzhnikov


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-07 06:17 PM

Christian Christmann <plfriko@yahoo.de> writes:

> My problem is 4). How can I set a breakpoint to the last
> instruction of a routine (the routine name is known) without
> looking at the code (and manually determine the instruction
> address)?

Perhaps you don't need to -- if you "finish" instead, you'll be
stopped on the next instruction after the "last return", which may
be close enough.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.





[ Post a follow-up to this message ]



    Re: GDB question on displaying cycles  
Christian Christmann


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-07 12:22 AM

On Thu, 18 Jan 2007 08:06:21 -0800, Paul Pluzhnikov wrote:


> Perhaps you don't need to -- if you "finish" instead, you'll be
> stopped on the next instruction after the "last return", which may
> be close enough.

With "finish" you mean finishing the entire program execution?
The problem is that after returning from the main function, still
"exit code" is executed. This is more than just one instruction.

Regards,
Chris





[ Post a follow-up to this message ]



    Re: GDB question on displaying cycles  
Paul Pluzhnikov


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-07 12:22 AM

Christian Christmann <plfriko@yahoo.de> writes:

> With "finish" you mean finishing the entire program execution?

No; I mean gdb "finish" command:

`finish'
Continue running until just after function in the selected stack
frame returns.  Print the returned value (if any).

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.





[ Post a follow-up to this message ]



    Re: GDB question on displaying cycles  
Christian Christmann


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-07 12:22 PM

On Thu, 18 Jan 2007 15:56:12 -0800, Paul Pluzhnikov wrote:

> `finish'
>      Continue running until just after function in the selected stack
>      frame returns.  Print the returned value (if any).

Thank you. That's what I need.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:40 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register