68 | | To use gdb, go in your simulation repository (where your have all your .def and start files, and your gcm executable ''gcm_exec.e''), and source your arch.env from your trunk/LMDZ.COMMON to have the required librairies to run the model. |
69 | | Then, run the command |
70 | | {{{ |
71 | | gdb gcm_exec.e |
72 | | }}} |
| 68 | To use gdb, you have to compile your model with the {{{-debug}}} option. |
| 69 | Once it's done, go in your simulation repository (where your have all your .def and start files, and your gcm executable ''gcm_exec_debug.e''), and source your arch.env from your trunk/LMDZ.COMMON to have the required librairies to run the model. |
| 70 | Then, run the command {{{ gdb gcm_exec_debug.e }}} |
74 | | It opens a gdb session. You can now run the model and interact with it while it runs. For instance, you can create ''break points'', which stop the run at a given point. You can then look at some variables via the ''print'' command, then continue the run. Here is an example below : |
| 72 | It opens a gdb session. You can now run the model and interact with it while it runs. For instance, you can create ''break points'', which stop the run at a given point. **Be careful** : if you specify a break point at a given line of the code, it has to be the line number from the **compiled** version of the program! (.f or .f90, in LMDZ.COMMON/tmp_src/). |
| 73 | |
| 74 | You can then look at some variables via the ''print'' command, then continue the run. Here is an example below : |
82 | | Breakpoint 1, aeropacity_mod::aeropacity (ngrid=3010, nlayer=54, nq=11, zday=0.0041666666666666666, pplay=..., pplev=..., ls=3.723693225921032e-05, pq=..., pt=..., |
| 85 | Breakpoint 1, aeropacity_mod::aeropacity (ngrid=3010, nlayer=54, nq=11, zday=0.0041666666666666666, pplay=..., pplev=..., ls=3.723693225921032e-05, pq=..., pt=..., ###<--- reach break point 1 |
83 | 86 | tauscaling=..., dust_rad_adjust=..., irtoviscoef=..., tau_pref_scenario=..., tau_pref_gcm=..., tau=..., taucloudtes=..., aerosol=..., dsodust=..., reffrad=..., |
84 | 87 | qrefvis3d=..., qrefir3d=..., omegarefir3d=..., totstormfract=..., clearatm=4294967295, dsords=..., dsotop=..., alpha_hmons=..., nohmons=4294967295, clearsky=.FALSE., |
| 99 | Breakpoint 2, aeropacity_mod::aeropacity (ngrid=3010, nlayer=54, nq=11, zday=0.0041666666666666666, pplay=..., pplev=..., ls=3.723693225921032e-05, pq=..., pt=..., ###<--- reach break point 2 |
| 100 | tauscaling=..., dust_rad_adjust=..., irtoviscoef=..., tau_pref_scenario=..., tau_pref_gcm=..., tau=..., taucloudtes=..., aerosol=..., dsodust=..., reffrad=..., |
| 101 | qrefvis3d=..., qrefir3d=..., omegarefir3d=..., totstormfract=..., clearatm=4294967295, dsords=..., dsotop=..., alpha_hmons=..., nohmons=4294967295, clearsky=.FALSE., |
| 102 | totcloudfrac=...) |
| 103 | at /scratch/cnt0027/lmd1167/abierjon/simurefs_topflows_GCM6/trunk_r2577/LMDZ.COMMON/libo/X64_OCCIGEN_64x48x54_phymars_para.e/.config/ppsrc/phys/aeropacity_mod.f:271 |
| 104 | 271 IF(iaervar.eq.1) THEN |
| 105 | |
| 106 | (gdb) print iaervar ###<--- print the value of a local variable of aeropacity at break point 2 |
| 107 | $1 = 4 |
| 108 | |
| 109 | (gdb) quit ###<--- quit gdb |