[Lldb-commits] [PATCH] Reduce number of threads in lldb-mi.
Hafiz Abid Qadeer
abidh.haq at gmail.com
Thu Feb 19 06:06:58 PST 2015
> > After this revision goes in, it will not be possible to give the name of the executable on command line and lldb-mi accepting it. This functionality is already stubbed out in the code by he following #ifdef so we will not lose anything.
> Why? We can use ExecuteCommand instead of InjectCommand in LocalDebugSessionStartupInjectCommands. I have tested it, and it works.
You are right. We can keep this functionality. But I dont like code being stubbed out with random #ifdef. If it is needed then it should be enabled all times and tested. Otherwise it should be removed.
> > For posix system, it is even possible to make lldb-mi a single thread app. But on windows, it is difficult to wait on stdin with timeout like what you can do with select. So next best thing is to use 2 threads instead of 3.
> Can you explain me, why? I don't mind, I'm just wondering.
On linux, I have experimented with a single-threaded lldb-mi and it works. The sequence is
1. Wait for stdin with a timeout.
2. If a command, process it and go to 4.
3. If time out, go to 4.
4. Process events if any and go to 1.
This worked on Linux. But problem is that 'select' call works only with sockets on Windows. I tried other Windows APIs but nothing provides a simple interface as select. So I abandoned the idea of making it single threaded.
More information about the lldb-commits