Debugger API, compatibility between R7 and R8

Gunilla Arendt gunilla@REDACTED
Thu Jun 27 09:52:55 CEST 2002


In 1.5.4 and earlier versions of Debugger, the front-end (GUI) and
back-end (interpreter) were not truly separated. In 2.0, released
as an R8 patch, the code has been rewritten and re-organized so
that a front-end no longer needs to know anything about the internal
structure of the interpreter (and vice versa!), it should only call
functions from the interface module int.erl.

This means that it should now be a lot easier to write a new
interpreter front-end, but it also means that 2.0 is not compatible
at all with the older versions...

/ Gunilla

Luke Gorrie wrote:
> 
> 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