qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qom-next 01/12] store prev_debug_excp_handler gl


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH qom-next 01/12] store prev_debug_excp_handler globaly and not per target
Date: Wed, 30 May 2012 12:51:18 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-05-30 00:10, Igor Mammedov wrote:
> current callers all do the same thing, storing in prev_debug_excp_handler
> previous handler and then calling it in breakpoint_handler.
> Move prev_debug_excp_handler from local scope to global and make
> cpu_set_debug_excp_handler() always to store previous handler.

NAK, this is not a beautiful interface, exposing the previous handler
via global variable. And it prevents chaining of handlers.

Is there a technical reason for this refactoring?

Jan

> 
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
>  cpu-exec.c |    7 +++----
>  exec-all.h |    3 ++-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 83cac93..44c83d9 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -155,13 +155,12 @@ static inline TranslationBlock 
> *tb_find_fast(CPUArchState *env)
>  }
>  
>  static CPUDebugExcpHandler *debug_excp_handler;
> +CPUDebugExcpHandler *prev_debug_excp_handler;
>  
> -CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
> +void cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
>  {
> -    CPUDebugExcpHandler *old_handler = debug_excp_handler;
> -
> +    prev_debug_excp_handler = debug_excp_handler;
>      debug_excp_handler = handler;
> -    return old_handler;
>  }
>  
>  static void cpu_handle_debug_exception(CPUArchState *env)
> diff --git a/exec-all.h b/exec-all.h
> index 9bda7f7..f3c3a8a 100644
> --- a/exec-all.h
> +++ b/exec-all.h
> @@ -357,7 +357,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, 
> target_ulong addr);
>  
>  typedef void (CPUDebugExcpHandler)(CPUArchState *env);
>  
> -CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler 
> *handler);
> +extern CPUDebugExcpHandler *prev_debug_excp_handler;
> +void cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
>  
>  /* vl.c */
>  extern int singlestep;

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]