{"id":3702,"date":"2018-09-13T13:49:28","date_gmt":"2018-09-13T12:49:28","guid":{"rendered":"http:\/\/roboblog.fatal-fury.de\/?p=3702"},"modified":"2018-09-14T09:10:44","modified_gmt":"2018-09-14T08:10:44","slug":"fortran-gdb-conditional-watchpoint","status":"publish","type":"post","link":"http:\/\/roboblog.fatal-fury.de\/?p=3702","title":{"rendered":"FORTRAN: GDB conditional watchpoint"},"content":{"rendered":"<p>To set a conditional watchpoint on local variable i.<br \/>\nExample Code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsubroutine func\r\n  integer :: i\r\n\r\n  do i=1, 100\r\n    write(*,*) i\r\n  end do\r\nend subroutine\r\n\r\nprogram test\r\n  implicit none\r\n\r\n  call func()\r\nend program\r\n<\/pre>\n<p>Compile with -ggdb<br \/>\nSet a breakpoint on subroutine \"func\". After the debugger stop on this point, the local variable \"i\" is in scope so one can set a watchpoint.<\/p>\n<p>$ gdb .\/example<br \/>\n(gdb) break func<br \/>\nBreakpoint 1 at 0x8bb: file gdb.F90, line 4.<\/p>\n<p>ODER<br \/>\n(gdb) break example.F90:4<\/p>\n<p>(gdb) run<br \/>\nStarting program: \/home\/kater\/example<br \/>\nBreakpoint 1, func () at example.F90:4<br \/>\n4         do i=1, 100<br \/>\n(gdb) watch i if i.gt.10<br \/>\nHardware watchpoint 2: i<br \/>\n(gdb) c<br \/>\ncontinuing.<br \/>\n           1<br \/>\n           2<br \/>\n           3<br \/>\n           4<br \/>\n           5<br \/>\n           6<br \/>\n           7<br \/>\n           8<br \/>\n           9<br \/>\n          10<\/p>\n<p>Hardware watchpoint 2: i<\/p>\n<p>Old value = 10<br \/>\nNew value = 11<br \/>\n0x0000555555554948 in func () at gdb.F90:4<br \/>\n4         do i=1, 100<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set a conditional watchpoint on local variable i. Example Code: subroutine func integer :: i do i=1, 100 write(*,*) i end do end subroutine program test implicit none call func() end program Compile with -ggdb Set a breakpoint on subroutine \"func\". After the debugger stop on this point, the local variable \"i\" is in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[30],"class_list":["post-3702","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-fortran"],"_links":{"self":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3702"}],"version-history":[{"count":5,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3702\/revisions"}],"predecessor-version":[{"id":3708,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/3702\/revisions\/3708"}],"wp:attachment":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3702"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}