Display Date and Time in GDB


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Display Date and Time in GDB
# 1  
Old 05-10-2013
Display Date and Time in GDB

In gdb is there any way we can display date/time in first column while debugging or is there any command which will print date/time?
I am asking this just to know when exactly a breakpoint got hit.

Last edited by rupeshkp728; 05-10-2013 at 06:51 AM.. Reason: spelling mistale
# 2  
Old 05-10-2013
gdb?

What is gdb?
# 3  
Old 05-10-2013
printing the time from gdb

I don't know of a way to do it directly, but you can issue shell commands using the 'shell' command. e.g.

Code:
(undodb-gdb) shell date
Fri May 10 18:03:47 BST 2013
(undodb-gdb)

will tell you the time from the gdb prompt. To have this happen automagically each time a breakpoint is hit or whatever, you can use a stop hook:

Code:
(undodb-gdb) define hook-stop
Type commands for definition of "hook-stop".
End with a line saying just "end".
>shell date
>end
(undodb-gdb) next
Fri May 10 18:03:54 BST 2013
25          c++;
(undodb-gdb) next
Fri May 10 18:03:55 BST 2013
26          x = add (2);
(undodb-gdb) next
After +2 a=3, b=4, c=5
Fri May 10 18:03:56 BST 2013
27          a++;
(undodb-gdb)

Note that I'm using UndoDB above, but it's the same interface as gdb (actually, it uses gdb as a frontend). You can see more about UndoDB here at undo-software.com
This User Gave Thanks to gregthelaw For This Post:
# 4  
Old 05-10-2013
Thanks gregthelaw for the solution.
This is what I was looking for and it works wonders on gdb.

Last edited by rupeshkp728; 05-10-2013 at 02:34 PM.. Reason: more details
# 5  
Old 05-11-2013
No problem. Did you check out UndoDB? What did you think of it?
# 6  
Old 05-11-2013
No I never heard of UndoDB.
From where to doenload it?
# 7  
Old 05-11-2013
See undo-software.com
This User Gave Thanks to gregthelaw For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

I have a cluster of two Solaris server (veritas cluster). one working and the other is standby I am going to change the date on them , and am looking for a secure solution as it is giving an important service. my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies

2. Shell Programming and Scripting

Display files created on particular date & time

Hi , I have BASH system & i am trying to display the files created on a particular date and time, and after displaying those files I also want to delete all those files.Can anyone of you help me out for this............. Thanx Original post contents restored... Please do not erase the question... (3 Replies)
Discussion started by: rakeshtomar82
3 Replies

3. Shell Programming and Scripting

How to display a date, 30 days from the current date?

Well guys, I know the right syntax for displaying the current date is $(date). However, I am planning to send emails to some customers which displays their subscription date, and then the expiry. The expiry being 30 days from the current date. What would the right syntax be? (6 Replies)
Discussion started by: xxxx
6 Replies

4. UNIX for Dummies Questions & Answers

How to always display date/time regardless of directory?

I found via Google a way to show the date and time stamp once I log in. However, whenever I cd to another directory it doesn't display the correct path. Here are the relevant parts from my .kshrc : unset _h _m _s eval $(date "+_h=%H ;_m=%M ;_s=%S") ((SECONDS =... (3 Replies)
Discussion started by: Mike F.
3 Replies

5. Programming

Incorrect address display by GDB

Hi, On using GDB debugger on different executables, the address displayed for the symbols seem incorrect, as it shows me the same address in each prorgram, run simultaneoulsy. eg: Program: linkmain1.c Breakpoint 1, main () at linkmain1.c:14 14 printf("In linkmain1.c\n"); (gdb)... (0 Replies)
Discussion started by: karthikb23
0 Replies

6. Shell Programming and Scripting

date and time to display on the terminal

hi all, am trying to 'grep' some text from a log file and use the 'cut' command to read from that line i just grep'ed to extract date/time and response times. code sniplet i am using is : grep -i 'text to grep' Out.log | while read LINE; do ... (11 Replies)
Discussion started by: cesarNZ
11 Replies

7. UNIX for Dummies Questions & Answers

unable to display the souce line in gdb

Hi All, I am unable to display the code in gdb. When i put list command i dont get any line. I mean i am unable to display the source line in gdb. Can any body help me. Thanks & Regards Gauri (4 Replies)
Discussion started by: gauri
4 Replies

8. AIX

Unable to display the date-time in seconds on AIX

Hi, In unix the command "date +%s" displays the date-time in seconds since â00:00:00 1970-01-01 UTCâ (a GNU extension) when executed on unix: -sh-2.05b$ date +%s 1152092690 I tried with all the format control output but unable to display the date-time in seconds i,e as in unix format. Can... (6 Replies)
Discussion started by: me_haroon
6 Replies

9. Solaris

display date n Time

Hi Friends, Can any one guide me regarding 'Display the date and time' command other than the command 'date' thanks n regards SsRrIi (1 Reply)
Discussion started by: SsRrIi
1 Replies

10. UNIX for Dummies Questions & Answers

Script to display last login date/time?

I was wondering if anyone had a script that would display the last time a user logged into a particular machine. I know about the "last" command, but it gives too much info.... I just wanted to know the last time a user used his/her id. ANy help would be greatly appreciated. Ryan (3 Replies)
Discussion started by: ryaneverett5
3 Replies
Login or Register to Ask a Question