Use of the QT debugger under ubuntu12.04

Source: Internet
Author: User

Recently, I have been using QT to write C + + programs, but in the process of writing a problem, want to use the debugger in Qt creator debugging, but debugging (in the Qt creator configured the appropriate debugger) appears "Ptrace:operation not Permitted "error, as shown in:

Search by Baidu, found the cause of the problem and its solution.

Originally, in the version after Ubuntu 11.04 ("Natty Narwhal"), a security mechanism called Ptrace scope was introduced. This mechanism prevents the user from accessing the memory and state of the currently running process, which causes the debugger of the QT creator not to work properly. This security mechanism prevents malware from being attached to other processes (such as SSH or GPG) and reads program memory, creating security issues.

This error occurs especially in the version after Ubuntu 11.04, in order to solve this problem, there are two methods, both of which require root permissions.

The first workaround is to temporarily resolve the problem, but it will fail the next time you restart the system. By setting the contents of the/proc/sys/kernel/yama/ptrace_scope virtual file to 0, use the command:

sudo Echo 0 >/proc/sys/kernel/yama/ptrace_scope

The second workaround is to permanently resolve the problem by editing the/etc/sysctl.d/10-ptrace.conf file and setting:

0(default is 1)

The reboot system is in effect.

When the above problem is resolved, another problem arises: set the breakpoint to stop .

Reason: Has not compiled the debug version, has been using the release version to Debug.

Workaround: Configure the Debug version and recompile.

If only the errors shown in debugging occur, this is an issue with insufficient permissions.

Workaround: Use sudo./qtcreator to start, for convenience, you can create a qtcreator shortcut under home, so that you do not have to CD to the directory of the program every time.

Use of the QT debugger under ubuntu12.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.