{"id":18781,"date":"2025-05-26T13:01:24","date_gmt":"2025-05-26T13:01:24","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=18781"},"modified":"2025-05-26T13:02:27","modified_gmt":"2025-05-26T13:02:27","slug":"conditional-breakpoints","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=18781","title":{"rendered":"Conditional breakpoints (C++)"},"content":{"rendered":"<h2>Showcase<\/h2>\n<pre class=\"brush: cpp; title: main.cpp; notranslate\" title=\"main.cpp\">\r\n#include &lt;iostream&gt;\r\n\r\nint main() {\r\n    for (int i = 0; i &lt; 10; ++i) {\r\n        std::cout &lt;&lt; &quot;i = &quot; &lt;&lt; i &lt;&lt; std::endl;\r\n    }\r\n    return 0;\r\n}\r\n<\/pre>\n<hr>\n<h2>Debugging<\/h2>\n<pre>\r\n$ g++ -g main.cpp\r\n$ gdb a.out\r\n(gdb) b main.cpp:5 if i == 5\r\nBreakpoint 1 at 0xa24: file main.cpp, line 5.\r\n(gdb) r\r\nStarting program: \/workspace\/a.out\r\ni = 0\r\ni = 1\r\ni = 2\r\ni = 3\r\ni = 4\r\n\r\nBreakpoint 1, main () at main.cpp:5\r\n5\t        std::cout << \"i = \" << i << std::endl;\r\n(gdb) c\r\nContinuing.\r\ni = 5\r\ni = 6\r\ni = 7\r\ni = 8\r\ni = 9\r\n[Inferior 1 (process 33) exited normally]\r\n(gdb) q\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Showcase Debugging $ g++ -g main.cpp $ gdb a.out (gdb) b main.cpp:5 if i == 5 Breakpoint 1 at 0xa24:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[28],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/18781"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18781"}],"version-history":[{"count":18,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/18781\/revisions"}],"predecessor-version":[{"id":18806,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/18781\/revisions\/18806"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18781"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}