# Revision history [back]

I'll try to answer with an example:

Let's assume that you want to inspect a variable in the LinearBatteryPlugin that is shipped with Gazebo. You can launch Gazebo with the linear_battery_demo.world for loading the plugin. Let's assume that your goal is to inspect the member variable LinearBatteryPlugin::q within the function LinearBatteryPlugin::OnUpdateVoltage(). Here are the steps for doing it usinggdb:

• Make sure that you compiled Gazebo (or your plugin) with debugging symbols. See this reference tutorial.
• Start gdb with specifying gzserver as the executable program:

gdb gzserver

• Start gzserver with:

run worlds/linear_battery_demo.world

• You should see some gdb messages indicating that the program has started.

• Interrupt the execution of gzserver by pressing CTRL-C.
• We're going to create a breakpoint on a function. We can double check that gdb has the definition of the function (note that we have to indicate the entire namespace):

list gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should show a partial view of the source code:

123 this->Init(); 124 } 125 126 ///////////////////////////////////////////////// 127 double LinearBatteryPlugin::OnUpdateVoltage(const common::BatteryPtr &_battery) 128 { 129 double dt = this->world->GetPhysicsEngine()->GetMaxStepSize(); 130 double totalpower = 0.0; 131 double k = dt / this->tau; 132

• Now, you can create your breakpoint:

break gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should confirm that the breakpoint was created. It's time to resume the gzserver execution:

continue

• Your execution should be interrupted when the code entered OnUpdateVoltage() and gdb should tell you that your breakpoint was hit:

Continuing. [Switching to Thread 0x7fff797f7700 (LWP 20446)]

Thread 31 "gzserver" hit Breakpoint 1, gazebo::LinearBatteryPlugin::OnUpdateVoltage (this=0x7fff44005a40, _battery= std::shared_ptr (count 4, weak 1) 0x180ed20) at /home/caguero/workspace/gazebo/plugins/LinearBatteryPlugin.cc:128 128 {

• Now you can inspect your q variable:

print q

• And gdb should tell you the value:

(gdb) print q $1 = 1.1660311540299606 Hopefully this is what you're looking for. Alternatively, if you're using Gazebo 8 we put in place an introspection system that is described in this tutorial (currently under review). I'll try to answer with an example: Let's assume that you want to inspect a variable in the LinearBatteryPlugin that is shipped with Gazebo. You can launch Gazebo with the linear_battery_demo.world for loading the plugin. Let's assume that your goal is to inspect the member variable LinearBatteryPlugin::q within the function LinearBatteryPlugin::OnUpdateVoltage(). Here are the steps for doing it usinggdb: • Make sure that you compiled Gazebo (or your plugin) with debugging symbols. See this reference tutorial. • Start gdb with specifying gzserver as the executable program: gdb gzserver  • Start gzserver •  Start gzserver with: run worlds/linear_battery_demo.worldworlds/linear_battery_demo.world You should see some gdb messages indicating that the program has started. Interrupt the execution of gzserver by pressing CTRL-C. We're going to create a breakpoint on a function. We can double check that gdb has the definition of the function (note that we have to indicate the entire namespace): list gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&) gazebo::common::BatteryPtr&) gdb should show a partial view of the source code:   123 this->Init(); 124 } 125 126 ///////////////////////////////////////////////// 127 double LinearBatteryPlugin::OnUpdateVoltage(const common::BatteryPtr &_battery) 128 { 129 double dt = this->world->GetPhysicsEngine()->GetMaxStepSize(); 130 double totalpower = 0.0; 131 double k = dt / this->tau; 132 132 Now, you can create your breakpoint: break gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)gazebo::common::BatteryPtr&) gdb should confirm that the breakpoint was created. It's time to resume the gzserver execution: continuecontinue Your execution should be interrupted when the code entered OnUpdateVoltage() and gdb should tell you that your breakpoint was hit: Continuing. [Switching to Thread 0x7fff797f7700 (LWP 20446)] 20446)] Thread 31 "gzserver" hit Breakpoint 1, gazebo::LinearBatteryPlugin::OnUpdateVoltage (this=0x7fff44005a40, _battery= std::shared_ptr (count 4, weak 1) 0x180ed20) at /home/caguero/workspace/gazebo/plugins/LinearBatteryPlugin.cc:128 128 {{ Now you can inspect your q variable: print qq And gdb should tell you the value: (gdb) print q$1 = 1.16603115402996061.1660311540299606 Hopefully this is what you're looking for. Alternatively, if you're using Gazebo 8 we put in place an introspection system that is described in this tutorial (currently under review). 


 3 No.3 Revision updated 2017-04-04 19:07:07 -0500 
 I'll try to answer with an example:

Let's assume that you want to inspect a variable in the LinearBatteryPlugin LinearBatteryPlugin that is shipped with Gazebo. You can launch Gazebo with the linear_battery_demo.world for loading the plugin. Let's assume that your goal is to inspect the member variable LinearBatteryPlugin::q within the function LinearBatteryPlugin::OnUpdateVoltage(). LinearBatteryPlugin::OnUpdateVoltage(). Here are the steps for doing it usinggdb:using gdb:

• Make sure that you compiled Gazebo (or your plugin) with debugging symbols. See this reference tutorial.
• Start gdb with specifying gzserver as the executable program:

gdb gzserver

• Start gzserver with:

run worlds/linear_battery_demo.world

• You should see some gdb messages indicating that the program has started.

• Interrupt the execution of gzserver by pressing CTRL-C.
• We're going to create a breakpoint on a function. We can double check that gdb has the definition of the function (note that we have to indicate the entire namespace):

list gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should show a partial view of the source code:

123  this->Init();
124 }
125
126 /////////////////////////////////////////////////
127 double LinearBatteryPlugin::OnUpdateVoltage(const common::BatteryPtr &_battery)
128 {
129   double dt = this->world->GetPhysicsEngine()->GetMaxStepSize();
130   double totalpower = 0.0;
131   double k = dt / this->tau;
132

• Now, you can create your breakpoint:

break gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should confirm that the breakpoint was created. It's time to resume the gzserver execution:

continue

• Your execution should be interrupted when the code entered OnUpdateVoltage() and gdb should tell you that your breakpoint was hit:

Continuing.
[Switching to Thread 0x7fff797f7700 (LWP 20446)]

Thread 31 "gzserver" hit Breakpoint 1, gazebo::LinearBatteryPlugin::OnUpdateVoltage (this=0x7fff44005a40,
_battery=
std::shared_ptr (count 4, weak 1) 0x180ed20) at
/home/caguero/workspace/gazebo/plugins/LinearBatteryPlugin.cc:128
128 {

• Now you can inspect your q variable:

print q

• And gdb should tell you the value:

(gdb) print q
$1 = 1.1660311540299606  Hopefully this is what you're looking for. Alternatively, if you're using Gazebo 8 we put in place an introspection system that is described in this tutorial (currently under review). I'll try to answer with an example: Let's assume that you want to inspect a variable in the LinearBatteryPlugin that is shipped with Gazebo. You can launch Gazebo with the linear_battery_demo.world for loading the plugin. Let's assume that your goal is to inspect the member variable LinearBatteryPlugin::q within the function LinearBatteryPlugin::OnUpdateVoltage(). Here are the steps for doing it using gdb: • Make sure that you compiled Gazebo (or your plugin) with debugging debug symbols. See this reference tutorial. • Start gdb specifying gzserver as the executable program: gdb gzserver  • Start gzserver with:with (assuming that your current directory is the top level directory of the Gazebo repository): run worlds/linear_battery_demo.world  • You should see some gdb messages indicating that the program has started. • Interrupt the execution of gzserver by pressing CTRL-C. • We're going to create a breakpoint on a function. We can double check that gdb has the definition of the function (note that we have to indicate the entire namespace): list gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)  • gdb should show a partial view of the source code: 123 this->Init(); 124 } 125 126 ///////////////////////////////////////////////// 127 double LinearBatteryPlugin::OnUpdateVoltage(const common::BatteryPtr &_battery) 128 { 129 double dt = this->world->GetPhysicsEngine()->GetMaxStepSize(); 130 double totalpower = 0.0; 131 double k = dt / this->tau; 132  • Now, you can create your breakpoint: break gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)  • gdb should confirm that the breakpoint was created. It's time to resume the gzserver execution: continue  • Your execution should be interrupted when the code entered OnUpdateVoltage() and gdb should tell you that your breakpoint was hit: Continuing. [Switching to Thread 0x7fff797f7700 (LWP 20446)] Thread 31 "gzserver" hit Breakpoint 1, gazebo::LinearBatteryPlugin::OnUpdateVoltage (this=0x7fff44005a40, _battery= std::shared_ptr (count 4, weak 1) 0x180ed20) at /home/caguero/workspace/gazebo/plugins/LinearBatteryPlugin.cc:128 128 {  • Now you can inspect your q variable: print q  • And gdb should tell you the value: (gdb) print q$1 = 1.1660311540299606


Hopefully this is what you're looking for. Alternatively, if you're using Gazebo 8 we put in place an introspection system that is described in this tutorial (currently under review).

I'll try to answer with an example:

Let's assume that you want to inspect a variable debug some code in the LinearBatteryPlugin that is shipped with Gazebo. You can launch Gazebo with the linear_battery_demo.world for loading the plugin. Let's also assume that your goal is to inspect the member variable LinearBatteryPlugin::q within the function LinearBatteryPlugin::OnUpdateVoltage(). Here are the steps for doing it using gdb:

• Make sure that you compiled Gazebo (or your plugin) with debug symbols. See this reference tutorial.
• Start gdb specifying gzserver as the executable program:

gdb gzserver

• Start gzserver with (assuming that your current directory is the top level directory of the Gazebo repository):

run worlds/linear_battery_demo.world

• You should see some gdb messages indicating that the program has started.

• Interrupt the execution of gzserver by pressing CTRL-C.
• We're going to create a breakpoint on a function. We can double check that gdb has the definition of the function (note that we have to indicate the entire namespace):

list gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should show a partial view of the source code:

123  this->Init();
124 }
125
126 /////////////////////////////////////////////////
127 double LinearBatteryPlugin::OnUpdateVoltage(const common::BatteryPtr &_battery)
128 {
129   double dt = this->world->GetPhysicsEngine()->GetMaxStepSize();
130   double totalpower = 0.0;
131   double k = dt / this->tau;
132

• Now, you can create your breakpoint:

break gazebo::LinearBatteryPlugin::OnUpdateVoltage(const gazebo::common::BatteryPtr&)

• gdb should confirm that the breakpoint was created. It's time to resume the gzserver execution:

continue

• Your execution should be interrupted when the code entered OnUpdateVoltage() and gdb should tell you that your breakpoint was hit:

Continuing.
[Switching to Thread 0x7fff797f7700 (LWP 20446)]

Thread 31 "gzserver" hit Breakpoint 1, gazebo::LinearBatteryPlugin::OnUpdateVoltage (this=0x7fff44005a40,
_battery=
std::shared_ptr (count 4, weak 1) 0x180ed20) at
/home/caguero/workspace/gazebo/plugins/LinearBatteryPlugin.cc:128
128 {

• Now you can inspect your q variable:

print q

• And gdb should tell you the value:

(gdb) print q
\$1 = 1.1660311540299606
`

Hopefully this is what you're looking for. Alternatively, if you're using Gazebo 8 we put in place an introspection system that is described in this tutorial (currently under review).