Bug 35524 - gdb can't attach on ubuntu 14.04 to get stack trace on crash
Summary: gdb can't attach on ubuntu 14.04 to get stack trace on crash
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 4.0.0
Hardware: PC Mac OS
: --- trivial
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-04 04:59 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2015-11-09 18:08 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Rolf Bjarne Kvinge [MSFT] 2015-11-04 04:59:03 UTC
This is printed:

> Debug info from gdb:
> 
> 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.
> No threads.


/etc/sysctl.d/10-ptrace.conf says:

> # For applications launching crash handlers that need PTRACE, exceptions can
> # be registered by the debugee by declaring in the segfault handler
> # specifically which process will be using PTRACE on the debugee:
> #   prctl(PR_SET_PTRACER, debugger_pid, 0, 0, 0);

So this would be a suggestion to add a call to prctl inside mono.

$ uname -a
Linux ip-10-178-203-228 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release  -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.3 LTS
Release:	14.04
Codename:	trusty
Comment 1 Zoltan Varga 2015-11-09 18:08:41 UTC
This was already fixed by 856436879 in master/4.2.