| 62 | |
| 63 | |
| 64 | === USING GDB FOR DEBUG |
| 65 | |
| 66 | If you have a really vicious bug in your code, you may want to use the gdb tool. Here is some advice to use it, but it is not exhaustive, so please complete this info as it pleases you. You can also find more details in the [https://sourceware.org/gdb/current/onlinedocs/gdb/GNU-Free-Documentation-License.html#GNU-Free-Documentation-License GDB documentation] |
| 67 | |
| 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 | }}} |
| 73 | |
| 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 : |
| 75 | |
| 76 | {{{ |
| 77 | (gdb) break aeropacity_mod.f:183 |
| 78 | (gdb) run |
| 79 | Starting program:... |
| 80 | ..... |
| 81 | ..... |
| 82 | Breakpoint 1, aeropacity_mod::aeropacity (ngrid=3010, nlayer=54, nq=11, zday=0.0041666666666666666, pplay=..., pplev=..., ls=3.723693225921032e-05, pq=..., pt=..., |
| 83 | tauscaling=..., dust_rad_adjust=..., irtoviscoef=..., tau_pref_scenario=..., tau_pref_gcm=..., tau=..., taucloudtes=..., aerosol=..., dsodust=..., reffrad=..., |
| 84 | qrefvis3d=..., qrefir3d=..., omegarefir3d=..., totstormfract=..., clearatm=4294967295, dsords=..., dsotop=..., alpha_hmons=..., nohmons=4294967295, clearsky=.FALSE., |
| 85 | totcloudfrac=...) |
| 86 | 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:183 |
| 87 | 183 tau(1:ngrid,1:naerkind)=0 |
| 88 | Missing separate debuginfos, use: debuginfo-install glibc-2.17-324.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 numactl-devel-2.0.12-5.el7.x86_64 zlib-1.2.7-19.el7_9.x86_64 |
| 89 | (gdb) break aeropacity_mod.f:266 |
| 90 | Breakpoint 2 at 0x13e792a: file /scratch/cnt0027/lmd1167/abierjon/simurefs_topflows_GCM6/trunk_r2577/LMDZ.COMMON/libo/X64_OCCIGEN_64x48x54_phymars_para.e/.config/ppsrc/phys/aeropacity_mod.f, line 266. |
| 91 | (gdb) continue |
| 92 | Continuing. |
| 93 | ..... |
| 94 | ..... |
| 95 | }}} |