-
Notifications
You must be signed in to change notification settings - Fork 117
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 multi-process support #133
base: master
Are you sure you want to change the base?
Conversation
@@ -198,6 +198,16 @@ export class MI2 extends EventEmitter implements IBackend { | |||
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\"")); | |||
if (this.prettyPrint) | |||
cmds.push(this.sendCommand("enable-pretty-printing")); | |||
if (this.multiProcess) { | |||
cmds.push( | |||
this.sendCommand("gdb-set follow-fork-mode parent"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mixed indentation here
Yeah, I should have said that this is very WIP, very experimental, I more wanted to share the general idea. There's definitely more work to be done. One of the big differences with the single process mode is that I use non-stop mode, i.e. only one thread is paused after a break point, not all of them. Would that explain the behaviour you're seeing? Could you share the test program? |
ah yeah that could be the reason. Here the source: (compile with dmd -g app.d) import std.stdio;
import core.thread;
import core.sys.posix.unistd;
import std.process;
struct S
{
int a;
long b;
string c;
T* f;
}
struct T
{
byte d;
char e;
T* child;
}
void main(string[] args)
{
writeln("Waiting 10s for attach");
Thread.sleep(10.seconds);
foreach (key, value; environment.toAA)
writeln(key, " = ", value);
stdout.flush();
for (int i = 0; i < 3; i++)
{
writeln(i);
stdout.flush();
Thread.sleep(1.seconds);
}
if (args.length > 1 && args[1] == "fork")
fork();
else if (args.length == 1 || args[1] != "single")
new Thread(&secondThread).start();
write("No newline!");
stdout.flush();
int count = 5;
for (; count < 20; count++)
{
S s;
s.f = new T();
s.f.child = new T();
s.f.child.d = 4;
s.a = count;
}
writeln("Got Arguments: ", args);
}
void secondThread()
{
for (int i = 0; i < 10; i++)
{
writeln("Multithreaded ", i);
stdout.flush();
Thread.sleep(1.seconds);
}
} Execute it with arguments = I mean that's not the way how you would call fork in an actual application but it does something which should be debuggable. |
4436f0a
to
8bccf78
Compare
@LeszekSwirski that's an interesting issue - can you update the conflicting files and, if you still see it as a WIP mark it as draft? |
8bccf78
to
00aafd4
Compare
I've rebased the PR and marked it as draft, I don't currently have the cycles to investigate this any further though. |
Thank you @LeszekSwirski for the update, so it is now up to @WebFreak001 or others to take it up. |
Add support for debugging applications which fork, gated behind a new configuration flag. GDB only.