user1054186
user1054186

Reputation:

Stepping through working and buggy code simultaniously with gdb

I have a C code that has a bug and an older version that does not show the bug. Now, I'd like to use two gdb sessions simultaneously, side by side, to step though the codes. I am looking for a way to do that without having to type, say, n in each gdb session. In other words I am looking for a method to link the sessions that when I press a gdb command in one it will be propagated to the other. Can that be done?

Thanks.

Upvotes: 0

Views: 184

Answers (2)

ks1322
ks1322

Reputation: 35708

I guess you can do it in single gdb session using Multiple Inferiors (not tested).

First you can create 2 inferiors, one for new buggy version and another for older one. Then you will need to define Command Hook for next command something like this:

define hookpost-next
inferior 2
next
inferior 1
end

Upvotes: 2

cdk
cdk

Reputation: 6778

you can do this with two panes open in tmux/screen. see this link http://www.wikivs.com/wiki/Screen_vs_tmux and the section on synchronize panes. for tmux:

ctrl-b :set-window-option synchronize-panes on|off 

should do the trick

Upvotes: 1

Related Questions