Jack,


Thanks for your response.  Ali had also responded on the Q&A site with the same 
suggestion.



It took me a couple days to get around to trying it out, but I can now confirm 
that this does indeed work.   I may add something to the wiki 
(http://www.m5sim.org/Debugger_Based_Debugging) to make it more clear that you 
have to actually modify code and recompile in order to have this work.



Along those lines, I found that you also need to modify a variable 
(current_debugger) if you want the "call debugger()" to work.



A few comments on the Q&A thread 
(http://qa.gem5.org//351/gdb-debugging-in-syscall-mode<http://qa.gem5.org/351/gdb-debugging-in-syscall-mode>)
 are suggesting that something should be done to make this a little easier to 
use (e.g. command line option) and avoid needing to recompile - I agree J



Thanks!

-Dan





From: gem5-users-boun...@gem5.org [mailto:gem5-users-boun...@gem5.org] On 
Behalf Of Jack Harvard
Sent: Friday, February 07, 2014 3:01 PM
To: gem5 users mailing list
Subject: Re: [gem5-users] GDB debugging of simulated program



Hi Dan,



Does the following not work?



If you would like to have the simulator wait for gdb to attach before executing 
you just need to change a line in src/sim/system.cc:
int rgdb_wait = -1;
to rgdb_wait = 0 (If you only have one cpu or the cupid for the one you want to 
wait for it to attach to).



Jack




Jack Harvard



On Wed, Feb 5, 2014 at 10:16 PM, Walters, Dan 
<dwalt...@mitre.org<mailto:dwalt...@mitre.org>> wrote:



What is the recommended way to attach a remote GDB to Gem5 in order to debug 
the program being run in simulation, particularly when the simulated program 
finishes execution very quickly?



I've read through http://www.m5sim.org/Debugger_Based_Debugging and was able to 
get it working with an example program (hello-world in an infinite loop),  but 
the program that I actually want to debug does not have an infinite loop, so it 
finishes executing in the simulation before I have a chance to connect the 
remote debugger.



I've tried using gem5.debug with the  -debug-break cmdline option, but since 
that causes gem5 itself to hit a breakpoint, the remote GDB's attempt to 
connect times-out.  I've tried various experiments with trying to resume gem5 
at the same time as telling the remote GDB to connect, but the race condition 
is too tight so I never get the simulated program to break before finishing 
execution... there must be a better way.



Has anyone else done something like this with any success?  I'd appreciate any 
ideas.

BTW, I'm using gem5-stable to simulate an ARM platform in SE mode.



Also, this same question was asked on the gem5 Q&A website a couple weeks ago 
(http://qa.gem5.org/351/gdb-debugging-in-syscall-mode ), but it hasn't gotten 
much attention...  it seems like all questions to the mailing list in general 
get more attention... should I avoid the Q&A site?



Thanks,

Dan








_______________________________________________
gem5-users mailing list
gem5-users@gem5.org<mailto:gem5-users@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to