Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gdbinit breakpoints executed but not shown on GUI #37

Closed
amireldor opened this issue Dec 13, 2013 · 2 comments
Closed

.gdbinit breakpoints executed but not shown on GUI #37

amireldor opened this issue Dec 13, 2013 · 2 comments

Comments

@amireldor
Copy link

When you set a breakpoint, the line number on the cgdb GUI turns red.

I set a breakpoint and saved it using "save breakpoints .gdbinit". .gdbinit is executed automatically by gdb on startup to restore a previous debugging 'session'. Upon starting cgdb, the gdb prompt at the bottom reports that the breakpoint from .gdbinit has been set, but the GUI is not updated as if no breakpoint is set.

Typing any command (or even just an empty one) at the gdb prompt will update the GUI view at the top, reavling the magnificent breakpoint in its red glory.

@mikesart
Copy link
Contributor

mikesart commented May 5, 2016

start_gdb() in cgdb.cpp does the following:

tgdb_initialize() ...
tgdb_request_current_location()...

tgdb_initialize winds up calling down into a2_initialize(), which does:

commands_issue_command( .... ANNOTATE_INFO_BREAKPOINTS .... )

When process_commands() gets the TGDB_UPDATE_BREAKPOINTS response, it's before the TGDB_UPDATE_FILE_POSITION response comes in, so we don't have any source information yet and the breakpoint info is dropped.

I added a a2_get_current_location() call right before the INFO_BREAKPOINTS call in a2_initialize and it fixed the issue, but I'm not sure it's the best fix. Need to have Bob review this one...

diff --git a/lib/tgdb/annotate-two/a2-tgdb.cpp b/lib/tgdb/annotate-two/a2-tgdb.cpp
index 76bca13..7e2c17a 100644
--- a/lib/tgdb/annotate-two/a2-tgdb.cpp
+++ b/lib/tgdb/annotate-two/a2-tgdb.cpp
@@ -220,6 +220,12 @@ int a2_initialize(void *ctx,

     a2_open_new_tty(a2, inferior_stdin, inferior_stdout);

+    /* Need to get source information before breakpoint information otherwise
+     * the TGDB_UPDATE_BREAKPOINTS event will be ignored in process_commands()
+     * because there are no source files to add the breakpoints to.
+     */
+    a2_get_current_location(a2, 1);
+
     /* gdb may already have some breakpoints when it starts. This could happen
      * if the user puts breakpoints in there .gdbinit.
      * This makes sure that TGDB asks for the breakpoints on start up.

brasko pushed a commit that referenced this issue Aug 6, 2016
#37

Need to request source information before breakpoints.

Signed-off-by: Michael Sartain <mikesart@gmail.com>
Signed-off-by: Bob Rossi <bob@brasko.net>
@brasko
Copy link
Contributor

brasko commented Aug 12, 2016

Thanks to Michael Sartain, this has been fixed in master.

A release will most likely be done in a month or two.

@brasko brasko closed this as completed Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants