خرید بک لینک

Hi all,

I originally posted this on Microsoft forums here, but was directed back to this forum as a more appropriate location. Let me know if I should direct my question elsewhere. For context, I'm normally an Ubuntu/Linux user, but in this instance I'm trying out the new beta release of Ubuntu on Windows 10 (aka "Windows Bash", etc). Note that this issue doesn't reproduce on Ubuntu/Linux.

I'm seeing lots of crashes in more complicated Linux applications ruing on Windows. (Did I mention that it's really cool that I'm ruing Linux applications on Windows?) I'm trying to track down exactly what's going on. gdb is my first go-to tool for debugging applications under Linux; I think it wouldn't be too much to say that it's the standard Linux tool for lots of types of debugging. But I'm finding that it can't debug even the simplest of threaded applications on Windows Bash. (It has no such problem under a real Linux keel.)
Here's a minimal reproducer:

Code:

#include<pthread.h>

// Make thread spin indefinitely
void*spin(void* no_arg)
{
    while(1);
    retu NULL;
}

int main()
{
    pthread_t spin_thread;
    pthread_create(&spin_thread, NULL, spin, NULL);
    while(1);
    retu0;
}



To compile, write to a file and run "gcc <filename> -lpthread -g". Then, to test, do "gdb ./a.out". Once you get to the gdb prompt, type "run". What I see is:
(gdb) run
Starting program: /mnt/c/Users/[me]/linwrapper/a.out
waing: Error disabling address space randomization: Success
waing: linux_ptrace_test_ret_to_nx: PTRACE_KILL waitpid retued -1: Interrupted system call
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ff5ff600700 (LWP 414)]
Caot find user-level thread for LWP 410: generic error
(gdb)

On a real Linux keel, "run" doesn't retu until you hit Ctrl-C, because the command spins forever. It certainly doesn't error out.
I write and work with a lot of code in C/C++. And threads are pretty much unavoidable these days. And I'm not going to pretend that my code never has bugs Is there a good way to debug multithreaded Linux apps in Windows Bash?

Thanks!

برچسب: نویسنده: استخدام کار تاريخ: شنبه 4 ارديبهشت 1395 ساعت: 12:36

صفحه بندی