RemoteGDB: add an m5 command line option for setting or disabling remote gdb.
This commit is contained in:
parent
9389ede894
commit
8c4f18f6f5
|
@ -102,6 +102,8 @@ add_option("--stats-file", metavar="FILE", default="m5stats.txt",
|
||||||
set_group("Debugging Options")
|
set_group("Debugging Options")
|
||||||
add_option("--debug-break", metavar="TIME[,TIME]", action='append', split=',',
|
add_option("--debug-break", metavar="TIME[,TIME]", action='append', split=',',
|
||||||
help="Cycle to create a breakpoint")
|
help="Cycle to create a breakpoint")
|
||||||
|
add_option("--remote-gdb-port", type='int', default=7000,
|
||||||
|
help="Remote gdb base port")
|
||||||
|
|
||||||
# Tracing options
|
# Tracing options
|
||||||
set_group("Trace Options")
|
set_group("Trace Options")
|
||||||
|
@ -256,6 +258,7 @@ def main():
|
||||||
internal.stats.initText(options.stats_file)
|
internal.stats.initText(options.stats_file)
|
||||||
|
|
||||||
# set debugging options
|
# set debugging options
|
||||||
|
internal.debug.setRemoteGDBPort(options.remote_gdb_port)
|
||||||
for when in options.debug_break:
|
for when in options.debug_break:
|
||||||
internal.debug.schedBreakCycle(int(when))
|
internal.debug.schedBreakCycle(int(when))
|
||||||
|
|
||||||
|
|
|
@ -31,16 +31,13 @@
|
||||||
%module debug
|
%module debug
|
||||||
|
|
||||||
%{
|
%{
|
||||||
// include these files when compiling debug_wrap.cc
|
|
||||||
#include "sim/host.hh"
|
#include "sim/host.hh"
|
||||||
|
#include "sim/debug.hh"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%include "stdint.i"
|
%include "stdint.i"
|
||||||
%include "sim/host.hh"
|
%include "sim/host.hh"
|
||||||
|
%include "sim/debug.hh"
|
||||||
%inline %{
|
|
||||||
extern void schedBreakCycle(Tick when);
|
|
||||||
%}
|
|
||||||
|
|
||||||
%wrapper %{
|
%wrapper %{
|
||||||
// fix up module name to reflect the fact that it's inside the m5 package
|
// fix up module name to reflect the fact that it's inside the m5 package
|
||||||
|
|
|
@ -108,3 +108,20 @@ eventqDump()
|
||||||
mainEventQueue.dump();
|
mainEventQueue.dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int remote_gdb_base_port = 7000;
|
||||||
|
|
||||||
|
int
|
||||||
|
getRemoteGDBPort()
|
||||||
|
{
|
||||||
|
return remote_gdb_base_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set remote GDB base port. 0 means disable remote GDB.
|
||||||
|
// Callable from python.
|
||||||
|
void
|
||||||
|
setRemoteGDBPort(int port)
|
||||||
|
{
|
||||||
|
remote_gdb_base_port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,13 @@
|
||||||
#ifndef __DEBUG_HH__
|
#ifndef __DEBUG_HH__
|
||||||
#define __DEBUG_HH__
|
#define __DEBUG_HH__
|
||||||
|
|
||||||
|
#include "sim/host.hh"
|
||||||
|
|
||||||
|
void schedBreakCycle(Tick when);
|
||||||
void debug_break();
|
void debug_break();
|
||||||
|
|
||||||
|
int getRemoteGDBPort();
|
||||||
|
// Remote gdb base port. 0 disables remote gdb.
|
||||||
|
void setRemoteGDBPort(int port);
|
||||||
|
|
||||||
#endif // __DEBUG_HH__
|
#endif // __DEBUG_HH__
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "mem/translating_port.hh"
|
#include "mem/translating_port.hh"
|
||||||
#include "params/Process.hh"
|
#include "params/Process.hh"
|
||||||
#include "params/LiveProcess.hh"
|
#include "params/LiveProcess.hh"
|
||||||
|
#include "sim/debug.hh"
|
||||||
#include "sim/process.hh"
|
#include "sim/process.hh"
|
||||||
#include "sim/process_impl.hh"
|
#include "sim/process_impl.hh"
|
||||||
#include "sim/stats.hh"
|
#include "sim/stats.hh"
|
||||||
|
@ -201,12 +202,14 @@ Process::registerThreadContext(ThreadContext *tc)
|
||||||
int myIndex = threadContexts.size();
|
int myIndex = threadContexts.size();
|
||||||
threadContexts.push_back(tc);
|
threadContexts.push_back(tc);
|
||||||
|
|
||||||
RemoteGDB *rgdb = new RemoteGDB(system, tc);
|
int port = getRemoteGDBPort();
|
||||||
GDBListener *gdbl = new GDBListener(rgdb, 7000 + myIndex);
|
if (port) {
|
||||||
gdbl->listen();
|
RemoteGDB *rgdb = new RemoteGDB(system, tc);
|
||||||
//gdbl->accept();
|
GDBListener *gdbl = new GDBListener(rgdb, port + myIndex);
|
||||||
|
gdbl->listen();
|
||||||
|
|
||||||
remoteGDB.push_back(rgdb);
|
remoteGDB.push_back(rgdb);
|
||||||
|
}
|
||||||
|
|
||||||
// return CPU number to caller
|
// return CPU number to caller
|
||||||
return myIndex;
|
return myIndex;
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "mem/physical.hh"
|
#include "mem/physical.hh"
|
||||||
#include "sim/byteswap.hh"
|
#include "sim/byteswap.hh"
|
||||||
#include "sim/system.hh"
|
#include "sim/system.hh"
|
||||||
|
#include "sim/debug.hh"
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
#include "arch/vtophys.hh"
|
#include "arch/vtophys.hh"
|
||||||
#include "kern/kernel_stats.hh"
|
#include "kern/kernel_stats.hh"
|
||||||
|
@ -183,9 +184,10 @@ System::registerThreadContext(ThreadContext *tc, int id)
|
||||||
threadContexts[id] = tc;
|
threadContexts[id] = tc;
|
||||||
numcpus++;
|
numcpus++;
|
||||||
|
|
||||||
if (rgdb_enable) {
|
int port = getRemoteGDBPort();
|
||||||
|
if (rgdb_enable && port) {
|
||||||
RemoteGDB *rgdb = new RemoteGDB(this, tc);
|
RemoteGDB *rgdb = new RemoteGDB(this, tc);
|
||||||
GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
|
GDBListener *gdbl = new GDBListener(rgdb, port + id);
|
||||||
gdbl->listen();
|
gdbl->listen();
|
||||||
/**
|
/**
|
||||||
* Uncommenting this line waits for a remote debugger to
|
* Uncommenting this line waits for a remote debugger to
|
||||||
|
|
Loading…
Reference in a new issue