Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --prefix option to rosrun #52

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
3 participants
@trainman419
Copy link
Contributor

commented Apr 23, 2014

With catkin, binaries have moved from the bin/ folder within the package into the devel/build folders in the catkin workspace; this makes it difficult to find them without understanding the workspace layout.

I've also seen a number of comments indicating that "gdb doesn't work with rosrun"

I think the solution to these is that rosrun should have a --prefix option to allow users to run their programs within gdb, valgrind and other debug tools.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Apr 22, 2014

Without further information I don't see why rosrun can not be invoked through gdb. I also don't understand what the proposed --prefix should do. Please provide (much) more information.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented Apr 22, 2014

The niave approach of using gdb with rosrun doesn't work, because gdb doesn't know what to do with a shell script:

$ gdb rosrun rviz rviz
Excess command line arguments ignored. (rviz)
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
"/opt/ros/hydro/bin/rosrun": not in executable format: File format not recognized
/home/hendrix/hydro/junior/src/driving/packages/planner/aw_planner_tests/rviz: No such file or directory.
(gdb) run rviz rviz
Starting program:  rviz rviz
No executable file specified.
Use the "file" or "exec-file" command.

I will put together a PR with my proposed fix.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Apr 22, 2014

Have you tried to call gbp with --args python rosrun pkgname exename?

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented Apr 22, 2014

rosrun is a bash script...

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Apr 22, 2014

Sorry, have you tried to call gbp with --args bash rosrun pkgname exename?

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2014

Running gdb with --args is possible, but relatively obscure and tricky to use.

The --prefix option that I've added to rosrun is simpler, more direct, and more in line with launch prefixes in roslaunch.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2014

I tried gdb with --args as suggested, but it looks like it doesn't handle the exec call very well:

$ gdb --args bash rosrun aw_simulator simulator 
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /bin/bash...(no debugging symbols found)...done.
(gdb) run
Starting program: /bin/bash rosrun aw_simulator simulator
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[ WARN] [1398466622.879462947]: Could not get parameter /driving/traj_ctrler/estimate_kappa. Using default: 0
[ERROR] [1398466622.892899547]: Crosswalk 23.1 does not exist. Can't spawn pedestrians on it
[ INFO] [1398466622.892938386]: Crosswalk 23.1 start 166021.443179,0.000000
[ INFO] [1398466622.892969578]: Crosswalk 23.1 end 166021.443179,0.000000
[ WARN] [1398466622.905011874, 0.120000000]: large delay in transforms: 20.000000ms
[ INFO] [1398466622.905612402, 0.120000000]: ok... position received.
[ INFO] [1398466622.905663003, 0.120000000]: plan the mission
[ INFO] [1398466622.909591867, 0.120000000]: initiate state machine
[ INFO] [1398466622.909758697, 0.120000000]: Entering StPause
[ INFO] [1398466622.909894041, 0.120000000]: Entering StPauseShortTerm
[ INFO] [1398466622.910007015, 0.120000000]: CHSM planner started...
[ INFO] [1398466622.910250881, 0.120000000]: Exiting StPauseShortTerm
[ INFO] [1398466622.910334506, 0.120000000]: Exiting StPause
[ INFO] [1398466622.910411930, 0.120000000]: Entering StWaitForActivation
/home/hendrix/hydro/junior/devel/bin/rosrun: line 4: 10511 Segmentation fault      (core dumped) "/home/hendrix/hydro/junior/src/ros/tools/rosbash/scripts/rosrun" "$@"
[Inferior 1 (process 10508) exited with code 0213]
(gdb) bt
No stack.
@dirk-thomas

This comment has been minimized.

Copy link
Member

commented May 2, 2014

This PR breaks auto completion due to the newly introduced options. Please update the PR to also change the completion implementation in the rosbash package (for all shells in there).

The PR will be merged to indigo-devel branch rather then hydro-devel. You don't have to create a new PR for that - I can just cherry-pick your commit when its ready and if it applies cleanly.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 3, 2014

I think this make sense, I agree that gdb should be able to handle this case (lldb seems to handle debugging something through rosrun ok), but I also think it's fine to add these options if it makes it easier.

I agree with @dirk-thomas that the tab completion should be updated and it should be tested with zsh as well (since we have already had several divergences in that realm).

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2014

OK. I will add tab-completion support for this when I have a chance.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2014

Tab-completion support added to rosbash.

I refactored the tab-completion functions a bit to make it easier to add support for arguments before package names in other commands that need it. rostest and roslaunch can use this, but I'm out of time to work on it.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

Thanks @trainman419, code review looks ok, but then again it's bash, so who knows.

I'll try to give a spin on my mac today and let you know.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented May 5, 2014

Since the PR breaks the existing completion (for non-bash) it won't be merged until it is fixed. It is not necessary to support the new options (even if that would be great) but it must maintain the level of completion when these new options are typed manually.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

@dirk-thomas you mean zsh completion?

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented May 5, 2014

Yes

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2014

zsh tab-completion for rosrun doesn't appear to work in hydro without this patch.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

I think zsh support can be pushed onto this: #48

I can get @trainman419's help when I go to fix that one w.r.t. to these new options. Not sure it's worth blocking this on that issue. Though we should try to get #48 closed ASAP. I'll see if I can allocate some time for that in the near future.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

Well, actually I guess package tab completion works on rosrun for now, but not executable.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2014

zsh tab-completion didn't work at all for me on Ubuntu 12.04 until I removed the zstyle ':completion:*' use-compctl false line from my .zshrc

Given the state of zsh tab-completion, and the fact that the existing rosrun tab-completion continues to work when you don't use the --prefix option, I think this should be merged.

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

I dunno, but I agree that the state of zsh completion should not block this one.

Shells suck, just btw.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2014

Added zsh support, and fixed the existing zsh rosrun bug

@wjwwood

This comment has been minimized.

Copy link
Member

commented May 5, 2014

@trainman419 thanks, I'll give a try this afternoon maybe.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented May 6, 2014

Merged to indigo-devel.

@trainman419

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2014

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.