Now we need to tell gdb what command line arguments need to be issued to actually run the executable, which for Uintah is the name of the input file. Reading symbols from /work/cdpi_uintah/opt/StandAlone/sus…done. This GDB was configured as “x86_64-unknown-linux-gnu”.įor bug reporting instructions, please see: There is NO WARRANTY, to the extent permitted by law. This is free software: you are free to change and redistribute it. License GPLv3+: GNU GPL version 3 or later ![]() This will launch gdb within emacs and you should see something like this in your window:Ĭurrent directory is /work/cdpi_uintah/opt/StandAlone/Ĭopyright (C) 2009 Free Software Foundation, Inc. Run gdb (like this): gdb –annotate=3 /work/cdpi_uintah/opt/StandAlone/sus In my case with Uintah, it looks like this: Now type the name of the executable that you want to debug and hit enter (you may have to first erase the default placed there by emacs). A dialog should appear at the bottom of the Emacs screen. Inside emacs type ‘M-x’, which means holding down your ‘meta’ key, which is usually ‘Alt’, and press x). This will open Emacs in a separate window in the background so that your terminal is still usable. Open a terminal and “cd” to the directory where you executable lives and type If you are using a different compiler you are on your own to figure out what options you need. Another important note is that the executable you wish to debug must be compiled with the ‘-g’ option if you are using g++. If you do not have sudo access to your machine, ask your system administrator to install them, or you can build them locally (yuk!). If you are using Ubuntu simply issue “sudo apt-get install gdb Emacs” and you should be home free. I think gdb comes with Emacs, but I could be wrong. Make sure you have gdb and Emacs installed. I’ve recently become a convert to Emacs, and found that the gdb interface in Emacs is especially nice. It turned out to be very, very helpful and surprisingly easy to use. A colleague suggested that I use gdb to find out where the problem was occurring. ![]() ![]() The code was suddenly crashing with an allocation error and giving no useful backtrace information. After several months of wading through the code I finally came across a problem that “cout” just could not help me solve. Recently I have been working with the Uintah MPM code, which is MUCH larger and more complex than any code I’ve ever written. It seemed cool, but honestly with the types of programs I was writing at the time, using print statement seemed to be effective enough and less of a hassle. We learned to program in Fortran 90, and used a Microsoft debugger. I remember learning how to use a debugger and Utah State University as an undergraduate.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |