{"id":647,"date":"2022-01-31T13:05:09","date_gmt":"2022-01-31T16:05:09","guid":{"rendered":"https:\/\/gladiston.net.br\/?page_id=647"},"modified":"2023-03-09T11:09:02","modified_gmt":"2023-03-09T14:09:02","slug":"de-ola-ao-fpdebug","status":"publish","type":"page","link":"https:\/\/gladiston.net.br\/en\/programacao\/lazarus-ide\/de-ola-ao-fpdebug\/","title":{"rendered":"Say hello to FpDebug"},"content":{"rendered":"<p>Prior to version 2.2, Lazarus IDE (only Lazarus from now on) used a GNU tool called GDB. As of version 2.2 Lazarus now has an internal debugger that according to many opinions is better and faster, it&#039;s called FpDebug.<\/p>\n\n\n\n<p>First of all, switching to FpDebug is not mandatory, GDB is still possible and on some occasions you will still see a warning message for the lack of GDB installed like this one:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"417\" src=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug_missing.png\" alt=\"\" class=\"wp-image-648\" srcset=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug_missing.png 622w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug_missing-300x201.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><figcaption class=\"wp-element-caption\">The IDE still misses the GDB on the system, but can ignore it.<\/figcaption><\/figure>\n\n\n\n<p>After the IDE is installed, go to Tools|Options|Debugger|General and you will see this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"532\" src=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug1.png\" alt=\"\" class=\"wp-image-649\" srcset=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug1.png 802w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug1-300x199.png 300w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug1-768x509.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><figcaption class=\"wp-element-caption\">&#039;Additional search path&#039; should have the path to gdb.exe but is no longer needed<\/figcaption><\/figure>\n\n\n\n<p>Traditionally the location now called &#039;Additional search path&#039; should have the path to gdb.exe, but as I said, it&#039;s not gdb.exe anymore so for now we can leave it blank. Here are some options that I think are useful to have checked:<\/p>\n\n\n\n<p><strong>Show message on stop with Error(Exit-code&lt;&gt;0)<\/strong>: The posix standard for any program whether it is windows or linux environment is to end with &#039;exit code&#039; equal to zero to indicate to the operating system and\/or subsequent programs that the program has finished without errors, any other code will indicate an alert(warning) or fatal error(fatal error). Windows usually returns values less than zero or greater than 255 to refer to alerts and greater than 1\u2026254 to indicate errors, but in my experience as a programmer analyzing other programs I come to the conclusion that in this environment there is no standard except for commands (TUI) commands that usually repeat the MSDOS &#039;exit code&#039;, for example &#039;exit code&#039; equals &#039;2&#039; to indicate &#039;file not found&#039;. Pascaleiros, Javeiros, PHPeiros,\u2026 and a legion of programmers develop their own logging and debugging pattern, but it would be great if error messages went to stderr\/stdout and that every program had an &#039;exit code&#039; documented and following some pattern , so it would be much easier to program and <em>debug <\/em>program crashes using the operating system itself without needing assistance from other programs or &#039;inhouse&#039; solutions made by the programmers themselves. That&#039;s why I keep this option turned on.<\/p>\n\n\n\n<p><strong>Automatically close the assembler windows, after source not found<\/strong>: When we are <em>debugging <\/em>line by line (step by step) the source code is triggered and even jumps to other codes that may not be available and in this case a window of <em>debugger <\/em>which shows the current code in assembly. Unfortunately my knowledge of assembler language has been lost over time so although useful, I have nothing to do when debugging it. That&#039;s why I keep this option turned on.<\/p>\n\n\n\n<p>Now go to Tools|Options|Debugger|Debugger backend and you will see this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"577\" src=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug3.png\" alt=\"\" class=\"wp-image-651\" srcset=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug3.png 802w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug3-300x216.png 300w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug3-768x553.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/figure>\n\n\n\n<p>Se n\u00e3o estiver vendo o fpDebug, \u00e9 provavel que o gdb ainda seja o padr\u00e3o da sua IDE, se desejar trocar(e vai querer) siga as orienta\u00e7\u00f5es:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ir em Tools|Options|Debugger|Debugger Backend e clicar em &#8220;Add&#8221;:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"532\" src=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2023\/03\/lazarus_debug_add.png\" alt=\"\" class=\"wp-image-2154\" srcset=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2023\/03\/lazarus_debug_add.png 802w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2023\/03\/lazarus_debug_add-300x199.png 300w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2023\/03\/lazarus_debug_add-768x509.png 768w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2023\/03\/lazarus_debug_add-18x12.png 18w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><figcaption class=\"wp-element-caption\">Voc\u00ea precisa adicionar o debugger desejado.<\/figcaption><\/figure>\n\n\n\n<p>once indicated <strong>FPDebug Internal DWarf-debugger<\/strong>, there is not much more settings, the basic pre-configured is enough.<\/p>\n\n\n\n<p>The breakpoints will still be the same as in the previous version:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"182\" src=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug4.png\" alt=\"\" class=\"wp-image-652\" srcset=\"https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug4.png 479w, https:\/\/gladiston.net.br\/wp-content\/uploads\/2022\/01\/lazarus_debug4-300x114.png 300w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><figcaption class=\"wp-element-caption\">Breakpoints will still be the same as they were<\/figcaption><\/figure>\n\n\n\n<p>The breakpoints you were used to in previous versions will still be the same, nothing has changed. Welcome to FpDebug!<\/p>\n\n\n\n<p>Source: <a href=\"https:\/\/wiki.lazarus.freepascal.org\/Debugger_Setup\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/wiki.lazarus.freepascal.org\/Debugger_Setup<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Antes da vers\u00e3o 2.2, o Lazarus IDE (apenas Lazarus daqui em diante) utilizava uma ferramenta GNU chamada GDB. A partir da vers\u00e3o 2.2 agora o Lazarus tem um debugger interno que segundo muitas opini\u00f5es \u00e9 melhor e mais r\u00e1pido, chama-se FpDebug. Antes de mais nada, a mudan\u00e7a para FpDebug n\u00e3o \u00e9 obrigat\u00f3ria, ainda \u00e9 poss\u00edvel [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"parent":159,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/template-full-width.php","meta":{"footnotes":""},"class_list":["post-647","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/pages\/647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/comments?post=647"}],"version-history":[{"count":7,"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/pages\/647\/revisions"}],"predecessor-version":[{"id":2157,"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/pages\/647\/revisions\/2157"}],"up":[{"embeddable":true,"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/pages\/159"}],"wp:attachment":[{"href":"https:\/\/gladiston.net.br\/en\/wp-json\/wp\/v2\/media?parent=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}