Re: Ping: [patch] general updates and improvements to QNX NTO support

Mark Kettenis
2004-12-03T17:44:08Z

Date: Fri, 03 Dec 2004 11:47:09 -0500
From: Kris Warkentin <kewarken@qnx.com>

Hmm....I think the diff hard to read. I haven't gotten rid of struct
nto_target_ops in nto-tdep.h. All I did is move the comments into the
definition of the structure from outside with the defines.

Ah, OK. Sorry, I misread that.

I also changed the macro defines so that I can assign and test. ie.

old:
define nto_regset_fill(regset, data)
(*current_nto_target.nto_regset_fill) (regset, data)

new:
#define nto_regset_fill (current_nto_target.nto_regset_fill)

That way I can easily switch targets in code.

Hmm. In that case wouldn't it be better to turn current_nto_target
into a pointer, and having a `struct nto_target_ops' for each target
such that you can switch targets by simply doing a pointer assignment?
That would probably get rid of all the macros.

I am defining current_nto_target in nto-tdep.h as being extern but I
don't declare it there. Is having a global verboten? I has assumed it
was okay since we have many precedents like inferior_ptid and
current_target and such.

Declaring variables as `extern' in a header file is fine, although you
should avoid globals if as much as possible.

Mark