C++: Difference between revisions

From Flooxs
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= What's Under the Hood? =
FLOOXS is written in c++ and the 2008 release uses both the finite volume and finite element discretization methods.  The newest version (not released yet) is implemented solely in the finite element method, which allows fully-coupled, self-consistent solutions of electronic pde's (the Poisson, hole and electron continuity equations), the heat equation, and mechanical pde's (modeling strain due to the inverse piezoelectric effect, thermal expansion mismatch, and lattice mismatch).  The Developers Wiki[http://www.flooxs.ece.ufl.edu/index.php?title=What_is_Under_the_Hood_-_Detailed&action=edit&redlink=1] discusses the c++ code for the new version in more detail.
= Using the gdb debugger =
You can't use a debugger directly on your tcl script. But you can use a debugger on flooxs as it is running, because flooxs is c++ under the hood. Below gives an example of how to use [http://en.wikipedia.org/wiki/GNU_Debugger gdb], the GNU debugger. From the Unix command line, type:
You can't use a debugger directly on your tcl script. But you can use a debugger on flooxs as it is running, because flooxs is c++ under the hood. Below gives an example of how to use [http://en.wikipedia.org/wiki/GNU_Debugger gdb], the GNU debugger. From the Unix command line, type:
  $ gdb $FLXHSOME/src/flooxs.new
  $ gdb $FLXHSOME/src/flooxs.new
Line 30: Line 34:
  (gdb) set var UpdateDebug=1 (continues)
  (gdb) set var UpdateDebug=1 (continues)


=== Good Reference ===
Website for other gdb commands: [http://www.yolinux.com/TUTORIALS/GDB-Commands.html]
Website for other gdb commands: [http://www.yolinux.com/TUTORIALS/GDB-Commands.html]
=== If you're in Dr. Law's Group ===
You need to be added to the "Developers" user group on the macs in our lab. You need an administrator to type for you
dseditgroup -p -o edit -a <newusernametoadd> -t <adminusername> _developer
Where -p will prompt a password from <adminusername>, and _developer is the group name. For me, it looked like this:
dseditgroup -p -o edit -a nrowsey -t law _developer
and then Dr. Law typed his password, and then I could use the gdb debugger on the macs in our lab.

Latest revision as of 18:56, 8 July 2011

What's Under the Hood?

FLOOXS is written in c++ and the 2008 release uses both the finite volume and finite element discretization methods. The newest version (not released yet) is implemented solely in the finite element method, which allows fully-coupled, self-consistent solutions of electronic pde's (the Poisson, hole and electron continuity equations), the heat equation, and mechanical pde's (modeling strain due to the inverse piezoelectric effect, thermal expansion mismatch, and lattice mismatch). The Developers Wiki[1] discusses the c++ code for the new version in more detail.

Using the gdb debugger

You can't use a debugger directly on your tcl script. But you can use a debugger on flooxs as it is running, because flooxs is c++ under the hood. Below gives an example of how to use gdb, the GNU debugger. From the Unix command line, type:

$ gdb $FLXHSOME/src/flooxs.new

Gdb takes as its argument the compiled C++ executable flooxs.new. "floods" is an alias, and because it comes second on the command line it wouldn't get expanded. Aliases only expand when they get used as the first thing.

You'l then see the gdb prompt:

(gdb)

at least it looks like that on most systems.

You can then run the code with:

(gdb) run -device zerobias.tcl

or some variation of that. Anything after the run command will be passed as arguments for flooxs. flooxs.new -device is what floods is aliased to.

You probably want to set a break point in FLPS_panic.

(gdb) break FLPS_panic

Once you hit the break point, the execution will stop and put you back at the gdb prompt. From here, you can type a variety of commands:

where - it will do a stack trace and show the calling sequence.
cont - continue executing
step - step over a single line of code
next - step over a subroutine call
print var - print a variable named var
list - list the code where you are
list device_tcl - list the code in that subroutine (for classes, you have to do something like Node::Size)
list 10,30 list line 10 to 30 in the current file

You should be able to use these to figure out what the pdb call was the created the problem.

Some other options are:

(gdb) break Newton::Solve  (run code)
(gdb) set var UpdateDebug=1 (continues)

Good Reference

Website for other gdb commands: [2]


If you're in Dr. Law's Group

You need to be added to the "Developers" user group on the macs in our lab. You need an administrator to type for you

dseditgroup -p -o edit -a <newusernametoadd> -t <adminusername> _developer

Where -p will prompt a password from <adminusername>, and _developer is the group name. For me, it looked like this:

dseditgroup -p -o edit -a nrowsey -t law _developer

and then Dr. Law typed his password, and then I could use the gdb debugger on the macs in our lab.