public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] Error modifiying Cyg_Thread class...
@ 2001-07-07 13:48 Dan Conti
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Conti @ 2001-07-07 13:48 UTC (permalink / raw)
  To: Cristiano Ligieri Pereira; +Cc: ecos-discuss

> > One thing to note, if you enable assertions in your kernel 
> then things
> > like this will cause a halt, since there are a bunch of 
> assertions to
> > check structure vs. class sizes at startup.
> > 
> > -Dan
> 
> How do a get away from this? Can I add assertions for the new 
> members? Can
> I modify such assertions so that the new members are considered?

The assertions are in
Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes(), in
kernel/common/kapi.cxx. 

It is just asserting that the class and the structure are the same size,
it doesn't really care what the current set of members are. Rather, it
is more concerned that if you have added or removed to the size of one
type that the other type reflects that change.

-Dan


> 
> Thanks for replying,
> Cristiano.
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [ECOS] Error modifiying Cyg_Thread class...
  2001-07-07 12:59 Dan Conti
@ 2001-07-07 13:40 ` Cristiano Ligieri Pereira
  0 siblings, 0 replies; 4+ messages in thread
From: Cristiano Ligieri Pereira @ 2001-07-07 13:40 UTC (permalink / raw)
  To: Dan Conti; +Cc: ecos-discuss

> One thing to note, if you enable assertions in your kernel then things
> like this will cause a halt, since there are a bunch of assertions to
> check structure vs. class sizes at startup.
> 
> -Dan

How do a get away from this? Can I add assertions for the new members? Can
I modify such assertions so that the new members are considered?

Thanks for replying,
Cristiano.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [ECOS] Error modifiying Cyg_Thread class...
@ 2001-07-07 12:59 Dan Conti
  2001-07-07 13:40 ` Cristiano Ligieri Pereira
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Conti @ 2001-07-07 12:59 UTC (permalink / raw)
  To: ecos-discuss

The way they implemented the C compatability layer was by defining C
structures that match the C++ classes exactly, that way you can do casts
etc. So, for every C++ class that someone might access there is a
corresponding C structure in kernel/include/kapidata.h, and if you add
something to the C++ class you should also add it (in the exact same
spot) into the C structure.

One thing to note, if you enable assertions in your kernel then things
like this will cause a halt, since there are a bunch of assertions to
check structure vs. class sizes at startup.

-Dan

> -----Original Message-----
> From: Cristiano Ligieri Pereira [ mailto:cpereira@ics.uci.edu ]
> Sent: Saturday, July 07, 2001 9:27 AM
> To: ecos-discuss@sourceware.cygnus.com
> Subject: [ECOS] Error modifiying Cyg_Thread class...
> 
> 
> 
> Hi all,
> 
> I was trying to add an extra field to the class Cyg_Thread (file
> thread.cxx) and was getting a strange behavior. The field is 
> a cyg_uint16
> and I was adding it to the end of the class definition, right 
> after the
> get_unique_id() method. In addition to the variable itself, I was also
> adding two accessing functions, one to set and another to get 
> the value of
> this variable (something very simple :-)).
> 
> After recompiling the code and testing I've noticed that the 
> value I was
> setting wasn't being held and when issuing the "get" I was getting a
> different value. After struggling for a few hours I changed 
> the variable
> definition to the beginning of the class, right after the 
> definition of
> the variable unique_id, and everything started working fine.
> 
> Can someone explain me why is that?
> 
> Sounds like some alignment problem, but it is not clear to me 
> why exactly
> it wasn't working...
> 
> Thanks,
> Cristiano.
> 
> ------------------------------------------------------------
> Cristiano Ligieri Pereira - http://www.ics.uci.edu/~cpereira
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ECOS] Error modifiying Cyg_Thread class...
@ 2001-07-07  9:28 Cristiano Ligieri Pereira
  0 siblings, 0 replies; 4+ messages in thread
From: Cristiano Ligieri Pereira @ 2001-07-07  9:28 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

I was trying to add an extra field to the class Cyg_Thread (file
thread.cxx) and was getting a strange behavior. The field is a cyg_uint16
and I was adding it to the end of the class definition, right after the
get_unique_id() method. In addition to the variable itself, I was also
adding two accessing functions, one to set and another to get the value of
this variable (something very simple :-)).

After recompiling the code and testing I've noticed that the value I was
setting wasn't being held and when issuing the "get" I was getting a
different value. After struggling for a few hours I changed the variable
definition to the beginning of the class, right after the definition of
the variable unique_id, and everything started working fine.

Can someone explain me why is that?

Sounds like some alignment problem, but it is not clear to me why exactly
it wasn't working...

Thanks,
Cristiano.

------------------------------------------------------------
Cristiano Ligieri Pereira - http://www.ics.uci.edu/~cpereira

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-07-07 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-07 13:48 [ECOS] Error modifiying Cyg_Thread class Dan Conti
  -- strict thread matches above, loose matches on Subject: below --
2001-07-07 12:59 Dan Conti
2001-07-07 13:40 ` Cristiano Ligieri Pereira
2001-07-07  9:28 Cristiano Ligieri Pereira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).