0
$\begingroup$

Rosanswers logo

While I'm trying to solve this issue, I'm stuck at gdb that's suggested by a commenter. I'm new to gdb (though I'm used to the debugger feature on Eclipse). I'm referring to this instruction.

Phenom: gdb seems not processing gazebo like following:

DellMachine@ROS-User:~/ros_workspace/pr2_tutorials$ ps -ef|grep gazebo/bin/gazebo
1000      4239  4197 99 16:20 ?        00:02:03 /opt/ros/diamondback/stacks/simulator_gazebo/gazebo/bin/gazebo -u /opt/ros/diamondback/stacks/simulator_gazebo/gazebo_worlds/worlds/empty.world __name:=gazebo __log:=/home/ROS-User/.ros/log/44905b94-c85e-11e0-ae9a-0026b9168399/gazebo-2.log
1000      6626  1885  0 16:22 pts/0    00:00:00 grep --color=auto gazebo/bin/gazebo
DellMachine@ROS-User:~/ros_workspace/pr2_tutorials$ sudo gdb --pid 4239
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Attaching to process 4239
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
(gdb) cont
The program is not being run.
(gdb) 

.

Step made: following this page, a file pr2_nav_tutorial.launch that's used for running gazebo is modified as:

<launch>
  <!-- machine tags for sim, be sure to set environment variable ROBOT to sim -->
  <include file="$(find pr2_machine)/sim.machine" />
  <include file="$(find pr2_navigation_global)/amcl_node.xml" />
  <include file="$(find pr2_navigation_teleop)/teleop.xml" />
  <include file="$(find pr2_navigation_perception)/lasers_and_filters.xml" />
  <!--include file="$(find 2dnav_pr2)/config/map_server.launch" /-->
  <include file="$(find pr2_navigation_perception)/ground_plane.xml" />
  <!-- The navigation stack and associated parameters -->
  <include file="$(find pr2_navigation_global)/move_base.xml" />
  <node name="map_server" pkg="map_server" type="map_server" args="$(find gazebo_worlds)/Media/materials/textures/map_blank.png 0.1" respawn="true" />

  ***<!-- Added for gdb -->***
  <!-- start gazebo with an empty plane -->
  <param name="/use_sim_time" value="true" />
  <node name="gazebo" pkg="gazebo" launch-prefix="$(find gazebo_worlds)/scripts/gdbrun" type="gazebo" args="$(find gazebo_worlds)/worlds/empty.world" respawn="false" output="screen"/>
</launch>

Thanks.


Originally posted by 130s on ROS Answers with karma: 10937 on 2011-08-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It looks like Ubuntu doesn't allow you to attach to an arbitrary process. See https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection and http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails-with-ptrace-operation-not-permitted/ .

It looks like the quick workaround would be to just run GDB as root.


Originally posted by Eric Perko with karma: 8406 on 2011-08-16

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by 130s on 2011-08-18:
@Eric Perko Thanks. Although "sudo gdb" didn't work, "sudo chmod +s /usr/bin/gdb" as suggested by the 2nd link works out (not sure why but it's good enough for now as a workaround).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.