Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow the exchange of 0-long dynamic vectors
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 18 May 2009 08:32:41 +0000 (08:32 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 18 May 2009 08:32:41 +0000 (08:32 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6285 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
src/gras/DataDesc/datadesc_private.h
src/gras/DataDesc/ddt_create.c
src/gras/DataDesc/ddt_exchange.c
src/gras/Msg/gras_msg_exchange.c
src/gras/Msg/msg_interface.h

index bda8f2c..d38785d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,16 @@
 SimGrid (3.4-svn) unstable; urgency=high
 
 SimGrid (3.4-svn) unstable; urgency=high
 
- OVERALL CHANGES:
-  * Also include strbuff from xbt.h public header
-  
  GRAS:
   * fix a bug on struct sizeof computation, which prevented the
     exchange of arrays of structs in some conditions
  GRAS:
   * fix a bug on struct sizeof computation, which prevented the
     exchange of arrays of structs in some conditions
+  * Allow the exchange of 0-long dynamic vectors.
+    - for that, use -1 as indicator of dynamic size instead of 0
+    - This implied to change any size from unsigned long to long,
+      reducing a bit communication abilities, but I guess that with
+      64bits being quite common, this is more than enough.
+    - This also induce a protocol change, thus bumping network protocol
+      version from 0 to 1 (if we have external users, we have to get
+      clean on that point too ;)
     
  MSG:
   * Allow to control the simulation from a trace file.
     
  MSG:
   * Allow to control the simulation from a trace file.
@@ -25,6 +30,7 @@ SimGrid (3.4-svn) unstable; urgency=high
     process in the log messages.
 
  XBT:
     process in the log messages.
 
  XBT:
+  * Also include strbuff from xbt.h public header
   * xbt_ex_display(): do not free the exception after displaying 
     This allows to do more with the given exception afterward.
     Users should call xbt_ex_free() themselves. 
   * xbt_ex_display(): do not free the exception after displaying 
     This allows to do more with the given exception afterward.
     Users should call xbt_ex_free() themselves. 
@@ -1206,4 +1212,4 @@ SimGrid (2.90) unstable; urgency=low
 
 For information, the beginning of coding on GRAS was back in june
 2003. I guess that every line has been rewritten at least twice since
 
 For information, the beginning of coding on GRAS was back in june
 2003. I guess that every line has been rewritten at least twice since
-then.
\ No newline at end of file
+then.
index 5560238..f54928b 100644 (file)
@@ -175,8 +175,8 @@ typedef struct s_gras_dd_cat_ref {
 typedef struct s_gras_dd_cat_array {
        gras_datadesc_type_t  type;
 
 typedef struct s_gras_dd_cat_array {
        gras_datadesc_type_t  type;
 
-       /* element_count == 0 means dynamically defined */
-       unsigned long int           fixed_size;
+       /* element_count == -1 means dynamically defined */
+       long int           fixed_size;
 
        /* callback used to return the dynamic length */
        gras_datadesc_type_cb_int_t dynamic_size;
 
        /* callback used to return the dynamic length */
        gras_datadesc_type_cb_int_t dynamic_size;
@@ -207,12 +207,12 @@ union u_gras_datadesc_category {
  */
 typedef struct s_gras_datadesc_type {
        /* headers for the data set */
  */
 typedef struct s_gras_datadesc_type {
        /* headers for the data set */
-       unsigned int                         code;
+       int                                  code;
        char                                *name;
        unsigned int                         name_len;
 
        /* payload */
        char                                *name;
        unsigned int                         name_len;
 
        /* payload */
-       unsigned long int                    size[gras_arch_count];
+       long int                             size[gras_arch_count]; /* Cannot be unsigned: -1 means dynamic */
 
        unsigned long int                    alignment[gras_arch_count];
        unsigned long int                    aligned_size[gras_arch_count];
 
        unsigned long int                    alignment[gras_arch_count];
        unsigned long int                    aligned_size[gras_arch_count];
index 72e896f..db76927 100644 (file)
@@ -2,9 +2,7 @@
 
 /* ddt_new - creation/deletion of datatypes structs (private to this module)*/
 
 
 /* ddt_new - creation/deletion of datatypes structs (private to this module)*/
 
-/* Copyright (c) 2003 Olivier Aumage.                                       */
-/* Copyright (c) 2003, 2004 Martin Quinson.                                 */
-/* All rights reserved.                                                     */
+/* Copyright (c) 2003-2009 The SimGrid Team. All rights reserved.           */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -202,7 +200,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
                return;
        }
 
                return;
        }
 
-       xbt_assert1(field_type->size != 0,
+       xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
                        "Cannot add a dynamically sized field in structure %s",
                        struct_type->name);
 
                        "Cannot add a dynamically sized field in structure %s",
                        struct_type->name);
 
@@ -339,7 +337,7 @@ void gras_datadesc_union_append(gras_datadesc_type_t  union_type,
        int arch;
 
        XBT_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
        int arch;
 
        XBT_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
-       xbt_assert1(field_type->size != 0,
+       xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
                        "Cannot add a dynamically sized field in union %s",
                        union_type->name);
 
                        "Cannot add a dynamically sized field in union %s",
                        union_type->name);
 
@@ -507,7 +505,7 @@ gras_datadesc_array_fixed(const char           *name,
        }
        res = gras_ddt_new(name);
 
        }
        res = gras_ddt_new(name);
 
-       xbt_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
+       xbt_assert1(fixed_size >= 0, "'%s' is a array of negative fixed size",name);
        for (arch=0; arch<gras_arch_count; arch ++) {
                res->size[arch] = fixed_size * element_type->aligned_size[arch];
                res->alignment[arch] = element_type->alignment[arch];
        for (arch=0; arch<gras_arch_count; arch ++) {
                res->size[arch] = fixed_size * element_type->aligned_size[arch];
                res->alignment[arch] = element_type->alignment[arch];
@@ -542,7 +540,7 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char                 *name,
                                "Redefinition of type %s does not match", name);
                xbt_assert1(res->category.array_data.type == element_type,
                                "Redefinition of type %s does not match", name);
                                "Redefinition of type %s does not match", name);
                xbt_assert1(res->category.array_data.type == element_type,
                                "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.array_data.fixed_size == 0,
+               xbt_assert1(res->category.array_data.fixed_size == -1,
                                "Redefinition of type %s does not match", name);
                xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
                                "Redefinition of type %s does not match", name);
                                "Redefinition of type %s does not match", name);
                xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
                                "Redefinition of type %s does not match", name);
@@ -562,7 +560,7 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char                 *name,
        res->category_code              = e_gras_datadesc_type_cat_array;
 
        res->category.array_data.type         = element_type;
        res->category_code              = e_gras_datadesc_type_cat_array;
 
        res->category.array_data.type         = element_type;
-       res->category.array_data.fixed_size   = 0;
+       res->category.array_data.fixed_size   = -1;
        res->category.array_data.dynamic_size = dynamic_size;
 
        return res;
        res->category.array_data.dynamic_size = dynamic_size;
 
        return res;
index 8c597ec..90454a5 100644 (file)
@@ -2,9 +2,7 @@
 
 /* ddt_exchange - send/recv data described                                  */
 
 
 /* ddt_exchange - send/recv data described                                  */
 
-/* Copyright (c) 2003 Olivier Aumage.                                       */
-/* Copyright (c) 2003, 2004, 2005 Martin Quinson.                           */
-/* All rights reserved.                                                     */
+/* Copyright (c) 2003-2009 The SimGrid Team.  All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -20,42 +18,42 @@ const char *gras_datadesc_cat_names[9] = {
                "scalar", "struct", "union", "ref", "array", "ignored",
                "invalid"};
 
                "scalar", "struct", "union", "ref", "array", "ignored",
                "invalid"};
 
-static gras_datadesc_type_t uint_type = NULL;
+static gras_datadesc_type_t int_type = NULL;
 static gras_datadesc_type_t pointer_type = NULL;
 
 static XBT_INLINE void
 static gras_datadesc_type_t pointer_type = NULL;
 
 static XBT_INLINE void
-gras_dd_send_uint(gras_socket_t sock,unsigned int *i, int stable) {
+gras_dd_send_int(gras_socket_t sock, int *i, int stable) {
 
 
-       if (!uint_type) {
-               uint_type = gras_datadesc_by_name("unsigned int");
-               xbt_assert(uint_type);
+       if (!int_type) {
+               int_type = gras_datadesc_by_name("int");
+               xbt_assert(int_type);
        }
 
        }
 
-       DEBUG1("send_uint(%u)",*i);
-       gras_trp_send(sock, (char*)i, uint_type->size[GRAS_THISARCH], stable);
+       DEBUG1("send_int(%u)",*i);
+       gras_trp_send(sock, (char*)i, int_type->size[GRAS_THISARCH], stable);
 }
 
 static XBT_INLINE void
 }
 
 static XBT_INLINE void
-gras_dd_recv_uint(gras_socket_t sock, int r_arch, unsigned int *i) {
+gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
 
 
-       if (!uint_type) {
-               uint_type = gras_datadesc_by_name("unsigned int");
-               xbt_assert(uint_type);
+       if (!int_type) {
+               int_type = gras_datadesc_by_name("int");
+               xbt_assert(int_type);
        }
 
        }
 
-       if (uint_type->size[GRAS_THISARCH] >= uint_type->size[r_arch]) {
-               gras_trp_recv(sock, (char*)i, uint_type->size[r_arch]);
+       if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
+               gras_trp_recv(sock, (char*)i, int_type->size[r_arch]);
                if (r_arch != GRAS_THISARCH)
                if (r_arch != GRAS_THISARCH)
-                       gras_dd_convert_elm(uint_type,1,r_arch, i,i);
+                       gras_dd_convert_elm(int_type,1,r_arch, i,i);
        } else {
        } else {
-               void *ptr = xbt_malloc(uint_type->size[r_arch]);
+               void *ptr = xbt_malloc(int_type->size[r_arch]);
 
 
-               gras_trp_recv(sock, (char*)ptr, uint_type->size[r_arch]);
+               gras_trp_recv(sock, (char*)ptr, int_type->size[r_arch]);
                if (r_arch != GRAS_THISARCH)
                if (r_arch != GRAS_THISARCH)
-                       gras_dd_convert_elm(uint_type,1,r_arch, ptr,i);
+                       gras_dd_convert_elm(int_type,1,r_arch, ptr,i);
                free(ptr);
        }
                free(ptr);
        }
-       DEBUG1("recv_uint(%u)",*i);
+       DEBUG1("recv_int(%u)",*i);
 }
 
 /*
 }
 
 /*
@@ -253,7 +251,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t           state,
                }
 
                if (reference_is_to_cpy) {
                }
 
                if (reference_is_to_cpy) {
-                       int subsubcount = 0;
+                       int subsubcount = -1;
                        void *l_referenced=NULL;
                        VERB2("Copy a ref to '%s' referenced at %p",sub_type->name, (void*)*o_ref);
 
                        void *l_referenced=NULL;
                        VERB2("Copy a ref to '%s' referenced at %p",sub_type->name, (void*)*o_ref);
 
@@ -263,21 +261,21 @@ gras_datadesc_memcpy_rec(gras_cbps_t           state,
                        }
 
                        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
                        }
 
                        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
-                               /* Damn. Reference to a dynamic array. Allocating the space for it
-           is more complicated */
+                               /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
                                gras_dd_cat_array_t array_data = sub_type->category.array_data;
                                gras_datadesc_type_t subsub_type;
 
                                subsub_type = array_data.type;
                                subsubcount = array_data.fixed_size;
                                gras_dd_cat_array_t array_data = sub_type->category.array_data;
                                gras_datadesc_type_t subsub_type;
 
                                subsub_type = array_data.type;
                                subsubcount = array_data.fixed_size;
-                               if (subsubcount == 0)
+                               if (subsubcount == -1)
                                        subsubcount = array_data.dynamic_size(subsub_type,state,*o_ref);
 
                                        subsubcount = array_data.dynamic_size(subsub_type,state,*o_ref);
 
-                               gras_dd_alloc_ref(refs,
-                                               subsub_type->size[GRAS_THISARCH] * subsubcount,
-                                               o_ref,pointer_type->size[GRAS_THISARCH],
-                                               (char**)&l_referenced,
-                                               detect_cycle);
+                               if (subsubcount != 0)
+                                       gras_dd_alloc_ref(refs,
+                                                       subsub_type->size[GRAS_THISARCH] * subsubcount,
+                                                       o_ref,pointer_type->size[GRAS_THISARCH],
+                                                       (char**)&l_referenced,
+                                                       detect_cycle);
                        } else {
                                gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH],
                                                o_ref,pointer_type->size[GRAS_THISARCH],
                        } else {
                                gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH],
                                                o_ref,pointer_type->size[GRAS_THISARCH],
@@ -314,9 +312,9 @@ gras_datadesc_memcpy_rec(gras_cbps_t           state,
 
                /* determine and send the element count */
                array_count = array_data.fixed_size;
 
                /* determine and send the element count */
                array_count = array_data.fixed_size;
-               if (array_count == 0)
+               if (array_count == -1)
                        array_count = subsize;
                        array_count = subsize;
-               if (array_count == 0) {
+               if (array_count == -1) {
                        array_count = array_data.dynamic_size(type,state,src);
                        xbt_assert1(array_count >=0,
                                        "Invalid (negative) array size for type %s",type->name);
                        array_count = array_data.dynamic_size(type,state,src);
                        xbt_assert1(array_count >=0,
                                        "Invalid (negative) array size for type %s",type->name);
@@ -354,7 +352,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t           state,
        }
 
        default:
        }
 
        default:
-               xbt_assert0(0, "Invalid type");
+               xbt_die("Invalid type");
        }
 
        return count;
        }
 
        return count;
@@ -375,6 +373,7 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type,
 
        xbt_assert0(type,"called with NULL type descriptor");
 
 
        xbt_assert0(type,"called with NULL type descriptor");
 
+       DEBUG3("Memcopy a %s from %p to %p",gras_datadesc_get_name(type),src,dst);
        if (!state) {
                state = gras_cbps_new();
                refs = xbt_dict_new();
        if (!state) {
                state = gras_cbps_new();
                refs = xbt_dict_new();
@@ -458,7 +457,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
        case e_gras_datadesc_type_cat_union: {
                gras_dd_cat_union_t union_data;
                gras_dd_cat_field_t field=NULL;
        case e_gras_datadesc_type_cat_union: {
                gras_dd_cat_union_t union_data;
                gras_dd_cat_field_t field=NULL;
-               unsigned int        field_num;
+               int field_num;
 
                union_data = type->category.union_data;
 
 
                union_data = type->category.union_data;
 
@@ -477,7 +476,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
                                type->name, field_num, xbt_dynar_length(union_data.fields));
 
                /* Send the field number */
                                type->name, field_num, xbt_dynar_length(union_data.fields));
 
                /* Send the field number */
-               gras_dd_send_uint(sock, &field_num, 0 /* not stable */);
+               gras_dd_send_int(sock, &field_num, 0 /* not stable */);
 
                /* Send the content */
                field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
 
                /* Send the content */
                field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
@@ -503,7 +502,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
                sub_type = ref_data.type;
                if (sub_type == NULL) {
                        sub_type = (*ref_data.selector)(type,state,data);
                sub_type = ref_data.type;
                if (sub_type == NULL) {
                        sub_type = (*ref_data.selector)(type,state,data);
-                       gras_dd_send_uint(sock, &(sub_type->code),1 /*stable*/);
+                       gras_dd_send_int(sock, &(sub_type->code),1 /*stable*/);
                }
 
                /* Send the actual value of the pointer for cycle handling */
                }
 
                /* Send the actual value of the pointer for cycle handling */
@@ -551,7 +550,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
 
        case e_gras_datadesc_type_cat_array: {
                gras_dd_cat_array_t    array_data;
 
        case e_gras_datadesc_type_cat_array: {
                gras_dd_cat_array_t    array_data;
-               unsigned int           count;
+               int                    count;
                char                  *ptr=data;
                long int               elm_size;
 
                char                  *ptr=data;
                long int               elm_size;
 
@@ -559,11 +558,11 @@ gras_datadesc_send_rec(gras_socket_t         sock,
 
                /* determine and send the element count */
                count = array_data.fixed_size;
 
                /* determine and send the element count */
                count = array_data.fixed_size;
-               if (count == 0) {
+               if (count == -1) {
                        count = array_data.dynamic_size(type,state,data);
                        xbt_assert1(count >=0,
                                        "Invalid (negative) array size for type %s",type->name);
                        count = array_data.dynamic_size(type,state,data);
                        xbt_assert1(count >=0,
                                        "Invalid (negative) array size for type %s",type->name);
-                       gras_dd_send_uint(sock, &count, 0/*non-stable*/);
+                       gras_dd_send_int(sock, &count, 0/*non-stable*/);
                }
 
                /* send the content */
                }
 
                /* send the content */
@@ -595,7 +594,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
        }
 
        default:
        }
 
        default:
-               xbt_assert0(0, "Invalid type");
+               xbt_die("Invalid type");
        }
 }
 
        }
 }
 
@@ -711,7 +710,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
        case e_gras_datadesc_type_cat_union: {
                gras_dd_cat_union_t union_data;
                gras_dd_cat_field_t field=NULL;
        case e_gras_datadesc_type_cat_union: {
                gras_dd_cat_union_t union_data;
                gras_dd_cat_field_t field=NULL;
-               unsigned int        field_num;
+               int field_num;
 
                union_data = type->category.union_data;
 
 
                union_data = type->category.union_data;
 
@@ -719,7 +718,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                                "Please call gras_datadesc_declare_union_close on %s before receiving it",
                                type->name);
                /* retrieve the field number */
                                "Please call gras_datadesc_declare_union_close on %s before receiving it",
                                type->name);
                /* retrieve the field number */
-               gras_dd_recv_uint(sock, r_arch, &field_num);
+               gras_dd_recv_int(sock, r_arch, &field_num);
                if (field_num < 0)
                        THROW1(mismatch_error,0,
                                        "Received union field for %s is negative", type->name);
                if (field_num < 0)
                        THROW1(mismatch_error,0,
                                        "Received union field for %s is negative", type->name);
@@ -753,8 +752,8 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                /* Get the referenced type locally or from peer */
                sub_type = ref_data.type;
                if (sub_type == NULL) {
                /* Get the referenced type locally or from peer */
                sub_type = ref_data.type;
                if (sub_type == NULL) {
-                       unsigned int ref_code;
-                       gras_dd_recv_uint(sock, r_arch, &ref_code);
+                       int ref_code;
+                       gras_dd_recv_int(sock, r_arch, &ref_code);
                        sub_type = gras_datadesc_by_id(ref_code);
                }
 
                        sub_type = gras_datadesc_by_id(ref_code);
                }
 
@@ -793,20 +792,19 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                }
 
                if (reference_is_to_recv) {
                }
 
                if (reference_is_to_recv) {
-                       unsigned int subsubcount = 0;
+                       int subsubcount = -1;
                        void *l_referenced=NULL;
 
                        VERB2("Receiving a ref to '%s', remotely @%p",
                                        sub_type->name, *(void**)r_ref);
                        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
                        void *l_referenced=NULL;
 
                        VERB2("Receiving a ref to '%s', remotely @%p",
                                        sub_type->name, *(void**)r_ref);
                        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
-                               /* Damn. Reference to a dynamic array. Allocating the space for it
-          is more complicated */
+                               /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
                                gras_dd_cat_array_t array_data = sub_type->category.array_data;
                                gras_datadesc_type_t subsub_type;
 
                                subsubcount = array_data.fixed_size;
                                gras_dd_cat_array_t array_data = sub_type->category.array_data;
                                gras_datadesc_type_t subsub_type;
 
                                subsubcount = array_data.fixed_size;
-                               if (subsubcount == 0)
-                                       gras_dd_recv_uint(sock, r_arch, &subsubcount);
+                               if (subsubcount == -1)
+                                       gras_dd_recv_int(sock, r_arch, &subsubcount);
 
                                subsub_type = array_data.type;
 
 
                                subsub_type = array_data.type;
 
@@ -845,20 +843,20 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
 
        case e_gras_datadesc_type_cat_array: {
                gras_dd_cat_array_t    array_data;
 
        case e_gras_datadesc_type_cat_array: {
                gras_dd_cat_array_t    array_data;
-               unsigned int count;
+               int count;
                char     *ptr;
                long int  elm_size;
 
                array_data = type->category.array_data;
                /* determine element count locally, or from caller, or from peer */
                count = array_data.fixed_size;
                char     *ptr;
                long int  elm_size;
 
                array_data = type->category.array_data;
                /* determine element count locally, or from caller, or from peer */
                count = array_data.fixed_size;
-               if (count == 0)
+               if (count == -1)
                        count = subsize;
                        count = subsize;
-               if (count == 0)
-                       gras_dd_recv_uint(sock, r_arch, &count);
-               if (count == 0)
+               if (count == -1)
+                       gras_dd_recv_int(sock, r_arch, &count);
+               if (count == -1)
                        THROW1(mismatch_error,0,
                        THROW1(mismatch_error,0,
-                                       "Invalid (=0) array size for type %s",type->name);
+                                       "Invalid (=-1) array size for type %s",type->name);
 
                /* receive the content */
                sub_type = array_data.type;
 
                /* receive the content */
                sub_type = array_data.type;
@@ -880,7 +878,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                                free(ptr);
                        }
                } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
                                free(ptr);
                        }
                } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
-                               sub_type->category.array_data.fixed_size > 0 &&
+                               sub_type->category.array_data.fixed_size >= 0 &&
                                sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) {
                        gras_datadesc_type_t subsub_type;
                        array_data = sub_type->category.array_data;
                                sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) {
                        gras_datadesc_type_t subsub_type;
                        array_data = sub_type->category.array_data;
@@ -923,7 +921,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
        }
 
        default:
        }
 
        default:
-               xbt_assert0(0, "Invalid type");
+               xbt_die("Invalid type");
        }
 
        if (type->recv)
        }
 
        if (type->recv)
index 48d1b31..89bd7d7 100644 (file)
@@ -2,8 +2,7 @@
 
 /* gras message exchanges                                                   */
 
 
 /* gras message exchanges                                                   */
 
-/* Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Quinson.               */
-/* All rights reserved.                                                     */
+/* Copyright (c) 2003-2009. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -395,7 +394,7 @@ gras_msg_handle(double timeOut) {
                TRY {
                        xbt_dynar_foreach(list->cbs,cpt,cb) {
                                if (!ran_ok) {
                TRY {
                        xbt_dynar_foreach(list->cbs,cpt,cb) {
                                if (!ran_ok) {
-                                       DEBUG4("Use the callback #%d (@%p) for incomming msg %s (payload_size=%d)",
+                                       DEBUG4("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)",
                                                        cpt+1,cb,msg.type->name,msg.payl_size);
                                        if (!(*cb)(&ctx,msg.payl)) {
                                                /* cb handled the message */
                                                        cpt+1,cb,msg.type->name,msg.payl_size);
                                        if (!(*cb)(&ctx,msg.payl)) {
                                                /* cb handled the message */
@@ -418,12 +417,14 @@ gras_msg_handle(double timeOut) {
                                        e.host = (char*)gras_os_myname();
                                        xbt_ex_setup_backtrace(&e);
                                }
                                        e.host = (char*)gras_os_myname();
                                        xbt_ex_setup_backtrace(&e);
                                }
-                               VERB5("Propagate %s exception ('%s') from '%s' RPC cb back to %s:%d",
+                               INFO5("Propagate %s exception ('%s') from '%s' RPC cb back to %s:%d",
                                                (e.remote ? "remote" : "local"),
                                                e.msg,
                                                msg.type->name,
                                                gras_socket_peer_name(msg.expe),
                                                gras_socket_peer_port(msg.expe));
                                                (e.remote ? "remote" : "local"),
                                                e.msg,
                                                msg.type->name,
                                                gras_socket_peer_name(msg.expe),
                                                gras_socket_peer_port(msg.expe));
+                               if (XBT_LOG_ISENABLED(gras_msg,xbt_log_priority_info))
+                                       xbt_ex_display(&e);
                                gras_msg_send_ext(msg.expe, e_gras_msg_kind_rpcerror,
                                                msg.ID, msg.type, &e);
                                e.file=old_file;
                                gras_msg_send_ext(msg.expe, e_gras_msg_kind_rpcerror,
                                                msg.ID, msg.type, &e);
                                e.file=old_file;
@@ -431,7 +432,8 @@ gras_msg_handle(double timeOut) {
                                ctx.answer_due = 0;
                                ran_ok=1;
                        } else {
                                ctx.answer_due = 0;
                                ran_ok=1;
                        } else {
-                               RETHROW0("Callback raised an exception: %s");
+                               RETHROW4("Callback #%d (@%p) to message '%s' (payload size: %d) raised an exception: %s",
+                                               cpt+1,cb,msg.type->name,msg.payl_size);
                        }
                }
 
                        }
                }
 
index 09df7c8..0922841 100644 (file)
@@ -52,7 +52,7 @@ void gras_msg_send_namev(gras_socket_t  sock,
 void gras_msg_listener_awake(void);
 void  gras_msg_listener_close_socket(int sd);
 
 void gras_msg_listener_awake(void);
 void  gras_msg_listener_close_socket(int sd);
 
-#define GRAS_PROTOCOL_VERSION '\0';
+#define GRAS_PROTOCOL_VERSION '\1';
 
 
 #endif  /* GRAS_MSG_INTERFACE_H */
 
 
 #endif  /* GRAS_MSG_INTERFACE_H */