Debugger API, compatibility between R7 and R8
Luke Gorrie
luke@REDACTED
Mon Jun 24 16:42:59 CEST 2002
Hello everybody,
I'm working on a new debugger front-end, and I'm having a problem
with compatibility between R7 and R8.
I'm using int:attached(Pid) to attach myself to an interpreted process
and get the pid for its "meta process" that I send commands to. On R8
this function returns {ok, MetaPid} (fine for me), but on R7 it just
returns 'true'. Maybe this approach is unnecessarily low-level.
Does anyone know a way to do the job that's compatible with both
releases?
Here's the process I'm trying to compatible'ify (offending line starts
with "=>"):
%% Attach the client process Emacs to the interpreted process Pid.
%%
%% spawn_link's a new process to proxy messages between Emacs and
%% Pid's meta-process.
debug_attach(Emacs, Pid) ->
spawn_link(?MODULE, debug_attach_init, [Emacs, Pid]).
debug_attach_init(Emacs, Pid) ->
link(Emacs),
=> case int:attached(Pid) of
{ok, Meta} ->
debug_attach_loop(Emacs, Meta);
error ->
exit({error, {unable_to_attach, Pid}})
end.
debug_attach_loop(Emacs, Meta) ->
receive
{Meta, Msg} ->
Emacs ! {meta, Msg};
{emacs, meta, Cmd} ->
int:meta(Meta, Cmd)
end,
debug_attach_loop(Emacs, Meta).
What a pain to be compatible with [{A,B} || A <- [emacs20, emacs21, xemacs],
B <- [r7, r8]] :-)
Cheers,
Luke (trying not to think about "C <- [win32, ...]")
More information about the erlang-questions
mailing list