|
[Sponsors] |
question on conditional breakpoint in using gdb |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 18, 2002, 12:13 |
question on conditional breakpoint in using gdb
|
#1 |
Guest
Posts: n/a
|
Hi, friends:
I'm trying to use GNU gdb to detect a floating exception in my code. That exception occurs only when my time step is 2520 and iteration step is 3. So I have to wait a very long time(one day) to reach that exception point. Seems there is a trick called "conditional breakpoint" in gdb. Below is a brief fram of my code: c------------------------- c program my_prog 1 do it=1, it_max 2 do iter=1,iter_max 3 4 some tri-diagonal solver stuff 5 6 some convergence creterion 7 enddo 8 enddo 9 end c------------------------- I launch the gdb, and run the program, then I want to use the following GDB command to put a conditional breakpoint on line 1: //-------- break 1 if it.ge.2520 //-------- it gives me back an error message saying: //---- No symbol "it" in current context. //---- Seems that the gdb doesn't recognize the variable "it" for me. What's the metter? I looked into some manu of gdb, saying that it's because "it" is out of the scope of something, but I don't quite understand and don't know how to get through. Thank you very much if you can give me a hand. wen long |
|
April 18, 2002, 12:32 |
Re: question on conditional breakpoint in using gd
|
#2 |
Guest
Posts: n/a
|
You are likely to get a much better response posting this to a gnu/gcc/cc/... newsgroup.
I do not use gdb (i.e. I do not know if your command syntax/semantics is OK) but your code looks like Fortran and the added line some C/Fortran hybrid? If you have not built a symbol table then the debugger will not be able to do much when you refer to "it". A symbol table is not usually built by default. Have you passed the "-g" flag when you compiled? I would suggest better options for understanding your problems are: (a) read the core file to find where and why the exception occurred. This is usually sufficient to find the odd underflow/overflow/divide_by_zero exceptions. (b) add exception handlers (routines to be called when an exception occurs). This is the most flexible solution enabling you to do pretty much whatever you want. |
|
April 18, 2002, 13:59 |
Re: question on conditional breakpoint in using gd
|
#3 |
Guest
Posts: n/a
|
Dear Andy:
Thanks for your reply. I did use -g option to enable the gdb. My code is purely Fortran, not easy to hook some exception handler onto it. There is a core file generated, but I don't know how to open it. Can you give more directions? Thanks again, Wen |
|
April 18, 2002, 14:44 |
Re: question on conditional breakpoint in using gd
|
#4 |
Guest
Posts: n/a
|
>> My code is purely Fortran, not easy to hook some exception handler onto it.
On the unix workstations that I have used it has always been very easy to add exception handlers to Fortran code. A quick google is a bit negative for g77 though: http://www.delorie.com/gnu/docs/g77/g77_630.html It looks doable but messy. >> There is a core file generated, but I don't know how to open it. Can you give more directions? "man gdb" says the command is "gdb -c core" |
|
April 18, 2002, 15:56 |
Re: question on conditional breakpoint in using gd
|
#5 |
Guest
Posts: n/a
|
Andy, Thanks a lot. Now I got the basic idea. The gdb I'm using doesn't support variables stored in common blocks or EQUIVALENCE. While I'm using many many common blocks.
That's why when I use "p it", it doesn't show me the value of variable "it" since it's in a common block. Wen |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unanswered question | niklas | OpenFOAM | 2 | July 31, 2013 16:03 |
OpenFOAM14 for Mac OSX Darwin 104 | gschaider | OpenFOAM Installation | 118 | July 20, 2008 05:19 |
Including a new utility in OF 13 | alondono | OpenFOAM Running, Solving & CFD | 7 | April 11, 2008 09:17 |
Gdb newbie question about printing strings out and confusion about Word bs | unoder | OpenFOAM Running, Solving & CFD | 0 | September 3, 2006 21:17 |
question | K.L.Huang | Siemens | 1 | March 29, 2000 04:57 |