@Ollydbg:
On the GDB shell the pid can be determined by
(gdb) shell ps -W | gawk "/APP\.EXE/{ print $1 }"
where the -W flag retrieves the windows processes as well. Outside GDB, i.e. using cmd, the same works with 'tasklist' instead of 'ps -W'.
What could be an easy and quick solution is a canned sequence of commands loaded at gdb start (.gdbinit?). But up to now I could not manage to define the local gdb variable $PID using 'set $PID=...' and then passing that to 'attach'. Any ideas?
Ultimately I want to debug a .dll compiled by MinGW which is called by the host excel.exe.
Sorry for the pure formatting, I am travelling right now.