{"id":5041,"date":"2014-03-30T18:21:28","date_gmt":"2014-03-30T18:21:28","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/debugging-tracing-inside-a-shared-library-during-runtime-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:21:28","modified_gmt":"2014-03-30T18:21:28","slug":"debugging-tracing-inside-a-shared-library-during-runtime-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/debugging-tracing-inside-a-shared-library-during-runtime-collection-of-common-programming-errors\/","title":{"rendered":"Debugging\/tracing inside a shared library during runtime?-Collection of common programming errors"},"content":{"rendered":"<p>There are two cases to consider (and your question doesn&#8217;t make it clear which case you have): &#8211; your executable is linked with the shared library directly:<\/p>\n<p>this means that <code>GDB<\/code> will &#8220;see&#8221; the symbols (and sources) from shared library when you stop on main<\/p>\n<p>\n&#8211; your executable dynamically loads the shared library (e.g. via <code>dlopen<\/code>):<br \/>\nin that case, <code>GDB<\/code> will not &#8220;see&#8221; your shared library until after <code>dlopen<\/code> completes.<\/p>\n<p>Since you can&#8217;t see the symbols when you stop at main, I am guessing you have the second case. You can do <code>\"set stop-on-solib-events 1\"<\/code> at the <code>(gdb)<\/code> prompt, and <code>GDB<\/code> will stop every time a new shared library is loaded (or unloaded).<\/p>\n<p>You can see which libraries <code>GDB<\/code> &#8220;knows&#8221; about via <code>info shared<\/code> command.<br \/>\nJust wait until you see your target library in that list, before attempting to set breakpoints in it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are two cases to consider (and your question doesn&#8217;t make it clear which case you have): &#8211; your executable is linked with the shared library directly: this means that GDB will &#8220;see&#8221; the symbols (and sources) from shared library when you stop on main &#8211; your executable dynamically loads the shared library (e.g. via [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5041","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5041"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5041\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}