Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Multiprogram teaser
@ 2008-07-29  2:29 Stan Shebs
  2008-07-29  8:18 ` Michael Snyder
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Stan Shebs @ 2008-07-29  2:29 UTC (permalink / raw)
  To: gdb

Here's a little teaser showing the results of me flogging GDB's source 
code. In addition to the fun aspect of listing the main()s of two 
different programs, it points up the the potential confusion of having 
several programs in a session. What I've got so far in my prototype is 
the ability to collect multiple execs from the command line, the 
creation of "exec" objects from which you can select one as "current", 
and some symbol table hacking to restrict lookups to the current executable.

stan@adell:~/mpgdb/linux/gdb$ ./gdb -nx ~/hello ~/goodbye
GNU gdb (GDB) 6.8.50.20080728-cvs
[...]
Attaching objfile /home/stan/hello to exec /home/stan/hello
Attaching objfile /home/stan/goodbye to exec /home/stan/goodbye
(gdb) list main
1    int glob = 45;
2   
3    main() {
4     mailand();
5      foo(glob);
6    printf("goodbye cruel world\n");
7    }
8   
9    foo(int x) {
10      return x + 92;
(gdb) exec /home/stan/hello
Setting current exec to /home/stan/hello.
(gdb) list main
3      if (bar == 0)
4        exit(1);
5    }
6   
7    main()
8    {
9      bar();
10      printf("hello world\n");
11    }
12   
(gdb)


Stan




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-07-30 17:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-29  2:29 Multiprogram teaser Stan Shebs
2008-07-29  8:18 ` Michael Snyder
2008-07-29 13:14 ` Jeremy Bennett
2008-07-29 13:34   ` Marc Khouzam
2008-07-29 13:51     ` Pedro Alves
2008-07-29 14:58       ` Marc Khouzam
2008-07-29 14:12     ` Stan Shebs
2008-07-29 16:02       ` Marc Khouzam
2008-07-30 17:21       ` Tom Tromey
2008-07-30 17:43 ` Tom Tromey
2008-07-30 18:07   ` Stan Shebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox