Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
debuginfo_xml.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, 2013 The University of Utah
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include "debuginfo_xml.h"
20 #include <string.h>
21 #include "util.h"
22 #include "glib_wrapper.h"
23 
24 static struct vmi1__DebugFileOptsT defDebugFileOpts = {
25  .debugfileRefDepth = 1,
26  .symbolRefDepth = 1,
27  .scopeRefDepth = 1,
28  .doMultiRef = 0,
29  .doManualRef = 0,
30 };
31 
32 static void *_soap_calloc(struct soap *soap,size_t size) {
33  void *r;
34 
35  r = soap_malloc(soap,size);
36  memset(r,0,size);
37 
38  return r;
39 }
40 
41 struct vmi1__LocationT *
42 d_location_to_x_LocationT(struct soap *soap,struct location *l,
43  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
44  struct array_list *refstack,int depth) {
45  struct vmi1__LocationT *vl;
46  int i,count;
47  struct loclistloc *loclistloc;
48 
49  vl = _soap_calloc(soap,1*sizeof(*vl));
50 
51  if (!opts)
52  opts = &defDebugFileOpts;
53 
54  switch(l->loctype) {
55  case LOCTYPE_ADDR:
56  case LOCTYPE_REALADDR:
57  vl->locationType = _vmi1__LocationT_locationType__addr;
58  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_addr;
59  vl->union_LocationT.addr = LOCATION_ADDR(l);
60  break;
61  case LOCTYPE_REG:
62  vl->locationType = _vmi1__LocationT_locationType__reg;
63  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_reg;
64  vl->union_LocationT.reg = LOCATION_REG(l);
65  break;
66  case LOCTYPE_REG_ADDR:
67  vl->locationType = _vmi1__LocationT_locationType__regAddr;
68  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_regAddr;
69  vl->union_LocationT.regAddr = LOCATION_REG(l);
70  break;
71  case LOCTYPE_REG_OFFSET:
72  vl->locationType = _vmi1__LocationT_locationType__regOffset;
73  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_regOffset;
74  vl->union_LocationT.regOffset = \
75  _soap_calloc(soap,1*sizeof(*vl->union_LocationT.regOffset));
76  vl->union_LocationT.regOffset->reg = (REG)(l)->extra;
77  vl->union_LocationT.regOffset->offset = (l)->l.offset;
78  break;
80  vl->locationType = _vmi1__LocationT_locationType__fbRegOffset;
81  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_fbRegOffset;
82  vl->union_LocationT.fbRegOffset = LOCATION_OFFSET(l);
83  break;
85  vl->locationType = _vmi1__LocationT_locationType__memberOffset;
86  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_memberOffset;
87  vl->union_LocationT.memberOffset = LOCATION_OFFSET(l);
88  break;
89  case LOCTYPE_RUNTIME:
90  vl->locationType = _vmi1__LocationT_locationType__runtime;
91  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_runtimeLoc;
92  LOCATION_GET_DATA(l,vl->union_LocationT.runtimeLoc.__ptr,
93  vl->union_LocationT.runtimeLoc.__size);
94  break;
95  case LOCTYPE_LOCLIST:
96  vl->locationType = _vmi1__LocationT_locationType__list;
97  vl->__union_LocationT = SOAP_UNION__vmi1__union_LocationT_locList;
98  vl->union_LocationT.locList = \
99  _soap_calloc(soap,1*sizeof(*vl->union_LocationT.locList));
100 
101  loclistloc = LOCATION_LOCLIST(l);
102  count = 0;
103  while (loclistloc) {
104  ++count;
105  loclistloc = loclistloc->next;
106  }
107 
108  loclistloc = LOCATION_LOCLIST(l);
109  vl->union_LocationT.locList->__sizelocListLoc = count;
110  if (count) {
111  vl->union_LocationT.locList->locListLoc = \
112  _soap_calloc(soap,
113  count * \
114  sizeof(*vl->union_LocationT.locList->locListLoc));
115  i = 0;
116  while (loclistloc) {
117  struct _vmi1__locListLoc *lll = \
118  &vl->union_LocationT.locList->locListLoc[i];
119 
120  lll->start = loclistloc->start;
121  lll->end = loclistloc->end;
122 
123  lll->location = \
124  d_location_to_x_LocationT(soap,loclistloc->loc,
125  opts,reftab,refstack,depth);
126 
127  ++i;
128  loclistloc = loclistloc->next;
129  }
130  }
131  break;
132  case LOCTYPE_UNKNOWN:
133  default:
134  vl->locationType = _vmi1__LocationT_locationType__none;
135  vl->__union_LocationT = 0;
136  break;
137  }
138 
139  return vl;
140 }
141 
142 struct vmi1__RangesT *
143 d_range_to_x_RangesT(struct soap *soap,struct range *r,
144  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
145  struct array_list *refstack,int depth) {
146  struct vmi1__RangesT *vr;
147  int i,count;
148  struct range *tr;
149 
150  if (!r)
151  return NULL;
152 
153  if (!opts)
154  opts = &defDebugFileOpts;
155 
156  vr = _soap_calloc(soap,1*sizeof(*vr));
157 
158  i = 0;
159  count = 0;
160  tr = r;
161  while (tr) {
162  ++count;
163  tr = tr->next;
164  }
165 
166  i = 0;
167  vr->__sizerange = count;
168  if (count) {
169  vr->range = _soap_calloc(soap,count*sizeof(*vr->range));
170  tr = r;
171  while (tr) {
172  vr->range[i].start = tr->start;
173  vr->range[i].end = tr->end;
174  ++i;
175  tr = tr->next;
176  }
177  }
178 
179  return vr;
180 }
181 
182 #define FILL_SYMBOLHEADER(s,r,reft,refv) \
183  do { \
184  int _rc; \
185  char *_name; \
186  char _idbuf[20]; \
187  int _idblen = 20; \
188  \
189  _rc = snprintf(_idbuf,_idblen,"%s%d",reft,refv); \
190  _rc = (_rc > _idblen) ? _idblen : (_rc + 1); \
191  (r)->sid = _soap_calloc(soap,_rc); \
192  strncpy((r)->sid,_idbuf,_rc); \
193  if (symbol_get_name(s)) { \
194  _name = symbol_get_name((s)); \
195  _rc = strlen(_name) + 1; \
196  (r)->name = _soap_calloc(soap,_rc); \
197  strncpy((r)->name,_name,_rc); \
198  } \
199  } while (0);
200 
201 #define FILL_SYMBOLCOMMON(typename,s,r) \
202  do { \
203  struct __vmi1__ ## typename ## _sequence *guts; \
204  struct _vmi1__declaration *_decl; \
205  struct vmi1__SizeT *_size; \
206  \
207  guts = (r)->__ ## typename ## _sequence; \
208  \
209  if (SYMBOL_IS_DWARF((s))) \
210  guts->source = _vmi1__source__dwarf; \
211  else if (SYMBOL_IS_ELF((s))) \
212  guts->source = _vmi1__source__elf; \
213  \
214  _decl = _soap_calloc(soap,sizeof(*_decl)); \
215  _decl->isExternal = (enum xsd__boolean)((s)->isexternal & 1); \
216  _decl->isDeclaration = (enum xsd__boolean)((s)->isdeclaration & 1); \
217  _decl->isPrototyped = (enum xsd__boolean)((s)->isprototyped & 1); \
218  guts->declaration = _decl; \
219  \
220  if ((s)->size_is_bytes || (s)->size_is_bits) { \
221  _size = _soap_calloc(soap,sizeof(*_size)); \
222  _size->byteSize = symbol_get_bytesize((s)); \
223  \
224  if ((s)->size_is_bytes) { \
225  _size->sizeType = _vmi1__SizeT_sizeType__byte; \
226  } \
227  else if ((s)->size_is_bits) { \
228  _size->sizeType = _vmi1__SizeT_sizeType__bit; \
229  _size->__size_SizeT_sequence = 1; \
230  _size->__SizeT_sequence = \
231  _soap_calloc(soap,sizeof(*_size->__SizeT_sequence)); \
232  _size->__SizeT_sequence->bitSize = symbol_get_bitsize(s); \
233  _size->__SizeT_sequence->bitOffset = symbol_get_bitoffset(s); \
234  _size->__SizeT_sequence->containingTypeByteSize = \
235  symbol_get_bitctbytes(s); \
236  } \
237  \
238  guts->size = _size; \
239  } \
240  } while (0);
241 
242 #define FILL_SYMBOLCOMMON_NOSEQ(typename,s,r) \
243  do { \
244  struct _vmi1__declaration *_decl; \
245  struct vmi1__SizeT *_size; \
246  \
247  if (SYMBOL_IS_DWARF((s))) \
248  (r)->source = _vmi1__source__dwarf; \
249  else if (SYMBOL_IS_ELF((s))) \
250  (r)->source = _vmi1__source__elf; \
251  \
252  _decl = _soap_calloc(soap,sizeof(*_decl)); \
253  _decl->isExternal = (enum xsd__boolean)((s)->isexternal & 1); \
254  _decl->isDeclaration = (enum xsd__boolean)((s)->isdeclaration & 1); \
255  _decl->isPrototyped = (enum xsd__boolean)((s)->isprototyped & 1); \
256  (r)->declaration = _decl; \
257  \
258  if ((s)->size_is_bytes || (s)->size_is_bits) { \
259  _size = _soap_calloc(soap,sizeof(*_size)); \
260  _size->byteSize = symbol_get_bytesize((s)); \
261  \
262  if ((s)->size_is_bytes) { \
263  _size->sizeType = _vmi1__SizeT_sizeType__byte; \
264  } \
265  else if ((s)->size_is_bits) { \
266  _size->sizeType = _vmi1__SizeT_sizeType__bit; \
267  _size->__size_SizeT_sequence = 1; \
268  _size->__SizeT_sequence = \
269  _soap_calloc(soap,sizeof(*_size->__SizeT_sequence)); \
270  _size->__SizeT_sequence->bitSize = symbol_get_bitsize(s); \
271  _size->__SizeT_sequence->bitOffset = symbol_get_bitoffset(s); \
272  _size->__SizeT_sequence->containingTypeByteSize = \
273  symbol_get_bitctbytes(s); \
274  } \
275  \
276  (r)->size = _size; \
277  } \
278  } while (0);
279 
280 #define FILL_SYMBOLTYPE(typename,s,r) \
281  if ((s)->datatype) \
282  (r)->__ ## typename ## _sequence->symtype = \
283  d_symbol_to_x_SymbolT(soap,(s)->datatype,(opts), \
284  (reftab),(refstack),(depth)+1);
285 
286 #define FILL_INSTANCESYMBOLCONTENTS(typename,s,opts,reftab,refstack,depth,r) \
287  do { \
288  struct __vmi1__ ## typename ## _sequence *guts; \
289  struct _vmi1__inlineInfo *_inline = NULL; \
290  struct symbol_inline *_ii; \
291  \
292  guts = (r)->__ ## typename ## _sequence; \
293  \
294  if ((s)->has_addr) { \
295  guts->addr = _soap_calloc(soap,sizeof(*guts->addr)); \
296  *guts->addr = s->addr; \
297  } \
298  /* XXX: do constValue!!! */ \
299  _ii = SYMBOLX_INLINE((s)); \
300  if ((s)->isinlineinstance || (s)->isdeclinline || (s)->isinlined) { \
301  _inline = _soap_calloc(soap,sizeof(*guts->inlineInfo)); \
302  if (_ii && _ii->origin) { \
303  _inline->origin = \
304  d_symbol_to_x_SymbolT(soap,_ii->origin,(opts), \
305  (reftab),(refstack),(depth)+1); \
306  } \
307  _inline->isInlineInstance = (enum xsd__boolean) \
308  (s->isinlineinstance & 1); \
309  _inline->isDeclaredInline = (enum xsd__boolean) \
310  ((s)->isdeclinline & 1); \
311  _inline->isInlined = (enum xsd__boolean) \
312  ((s)->isinlined & 1); \
313  if (_ii && _ii->inline_instances) { \
314  _inline->instances = \
315  d_symbol_gslist_to_x_SymbolsT(soap, \
316  _ii->inline_instances, \
317  (opts),(reftab),(refstack),(depth)+1); \
318  } \
319  } \
320  guts->inlineInfo = _inline; \
321  } while (0);
322 
323 #define REF_ALLOC_SEQ(typename,r,rs) \
324  if (!(r)->__ ## typename ## _sequence) { \
325  (r)->__size_ ## typename ## _sequence = 1; \
326  (r)->__ ## typename ## _sequence = \
327  _soap_calloc(soap,sizeof(*(r)->__ ## typename ## _sequence)); \
328  } \
329  rs = (r)->__ ## typename ## _sequence;
330 
331 #define REF_ALLOC_SEQ_NOSET(typename,r) \
332  if (!(r)->__ ## typename ## _sequence) { \
333  (r)->__size_ ## typename ## _sequence = 1; \
334  (r)->__ ## typename ## _sequence = \
335  _soap_calloc(soap,sizeof(*(r)->__ ## typename ## _sequence)); \
336  }
337 
338 #define CLEANUP_REF(objtype,typename,s,opts,reftab,refstack,depth,r) \
339  if (reftab) \
340  array_list_remove(refstack);
341 
342 /*
343  * refv must be a 32-bit int. reft can be up to a 2-char string.
344  */
345 #define RETURN_REF_OR_ALLOC(objtype,typename,s,reft,refv,opts,reftab,refstack,depth,r) \
346  do { \
347  typeof(r) _r = NULL; \
348  int _rc; \
349  char *_name = objtype ## _get_name(s); \
350  int _rfound = -1; \
351  char _idbuf[19]; \
352  int _idblen = 19; \
353  \
354  /* \
355  * If it is in the reftab, and if multi-ref encoding is enabled,\
356  * or we have reached the max depth but manual multi-ref is \
357  * disabled (or we haven't reached the max depth), just return \
358  * the gsoap serialization struct we already encoded for this \
359  * symbol so gsoap can fully render it again. \
360  */ \
361  if (reftab \
362  && (_r = (typeof(r))g_hash_table_lookup(reftab,(gpointer)s)) \
363  && ((opts)->doMultiRef \
364  || (depth < (opts)-> objtype ## RefDepth \
365  && !(opts)->doManualRef \
366  && (_rfound = array_list_find(refstack,_r)) < 0))) { \
367  \
368  if (!(r)) { \
369  vdebug(5,LA_XML,LF_XML, \
370  "reusing encoded %s(%s) at (d=%d,%d/%d)" \
371  " (multiref=%d)\n", \
372  _name,_r->sid,depth, \
373  (opts)->symbolRefDepth,(opts)->scopeRefDepth, \
374  (opts)->doMultiRef); \
375  \
376  return (typeof(r))_r; \
377  } \
378  else { \
379  /* Must memcpy contents into existing buffer. */ \
380  vdebug(5,LA_XML,LF_XML, \
381  "copying encoded %s(%s) at (d=%d,%d/%d)" \
382  " (multiref=%d)\n", \
383  _name,_r->sid,depth, \
384  (opts)->symbolRefDepth,(opts)->scopeRefDepth, \
385  (opts)->doMultiRef); \
386  \
387  memcpy(r,_r,sizeof(r)); \
388  \
389  return (typeof(r))_r; \
390  } \
391  } \
392  else { \
393  /* \
394  * Need to encode it as a ref and return immediately. \
395  */ \
396  if (_r && (opts)->doManualRef) { \
397  if (!(r)) \
398  (r) = _soap_calloc(soap,sizeof(*(r))); \
399  \
400  _rc = snprintf(_idbuf,_idblen,"%s%d",reft,refv); \
401  _rc = (_rc > _idblen) ? _idblen : (_rc + 1); \
402  (r)->sref = _soap_calloc(soap,_rc); \
403  strncpy((r)->sref,_idbuf,_rc); \
404  \
405  /* (r)->sref = idstr; */ \
406  \
407  vdebug(5,LA_XML,LF_XML, \
408  "encoding manual ref for %s(%s)" \
409  " at (d=%d,%d/%d)\n", \
410  _name,(r)->sref,depth, \
411  opts->symbolRefDepth,opts->scopeRefDepth); \
412  \
413  return (typeof(r))r; \
414  } \
415  else if (_r && _rfound > -1) { \
416  if (!(r)) \
417  (r) = _soap_calloc(soap,sizeof(*(r))); \
418  \
419  _rc = snprintf(_idbuf,_idblen,"%s%d",reft,refv); \
420  _rc = (_rc > _idblen) ? _idblen : (_rc + 1); \
421  (r)->sref = _soap_calloc(soap,_rc); \
422  strncpy((r)->sref,_idbuf,_rc); \
423  \
424  /* (r)->sref = idstr; */ \
425  \
426  vdebug(5,LA_XML,LF_XML, \
427  "forcing (cyclic) manual ref for %s(%s)" \
428  " at (d=%d,%d/%d)\n", \
429  _name,(r)->sref,depth, \
430  opts->symbolRefDepth,opts->scopeRefDepth); \
431  \
432  return (typeof(r))r; \
433  } \
434  else if (depth >= (opts)-> objtype ## RefDepth) { \
435  if (!(r)) \
436  (r) = _soap_calloc(soap,sizeof(*(r))); \
437  \
438  _rc = snprintf(_idbuf,_idblen,"%s%d",reft,refv); \
439  _rc = (_rc > _idblen) ? _idblen : (_rc + 1); \
440  (r)->sref = _soap_calloc(soap,_rc); \
441  strncpy((r)->sref,_idbuf,_rc); \
442  \
443  /* (r)->sref = idstr; */ \
444  \
445  if (objtype ## _get_name(s)) { \
446  _rc = strlen(_name) + 1; \
447  (r)->name = _soap_calloc(soap,_rc); \
448  strncpy((r)->name,_name,_rc); \
449  } \
450  \
451  vdebug(5,LA_XML,LF_XML, \
452  "encoding fetchable ref for %s(%s)" \
453  " at (d=%d,%d/%d)\n", \
454  _name,(r)->sref,depth, \
455  opts->symbolRefDepth,opts->scopeRefDepth); \
456  \
457  return (typeof(r))r; \
458  } \
459  /* \
460  * Need to fully encode it, so just malloc it, place it in \
461  * the reftab, and let caller take over. \
462  */ \
463  else { \
464  if (!(r)) { \
465  (r) = _soap_calloc(soap,sizeof(*(r))); \
466  } \
467  \
468  _rc = snprintf(_idbuf,_idblen,"%s%d",reft,refv); \
469  _rc = (_rc > _idblen) ? _idblen : (_rc + 1); \
470  (r)->sref = _soap_calloc(soap,_rc); \
471  strncpy((r)->sref,_idbuf,_rc); \
472  \
473  /* (r)->sref = idstr; */ \
474  \
475  vdebug(5,LA_XML,LF_XML, \
476  "encoding full %s(%"PRIiSMOFFSET")" \
477  " at (d=%d,%d/%d)\n", \
478  _name,(r)->sref,depth, \
479  opts->symbolRefDepth,opts->scopeRefDepth); \
480  \
481  if (reftab) { \
482  g_hash_table_insert(reftab,(gpointer)s,(gpointer)r);\
483  array_list_append(refstack,r); \
484  } \
485  } \
486  } \
487  } while (0);
488 
489 static inline char *_ref_build_int(struct soap *soap,char *reft,int refv) {
490  char idbuf[20];
491  int rc;
492  char *retval;
493 
494  rc = snprintf(idbuf,sizeof(idbuf),"%s%d",reft,refv);
495  rc = (rc > (int)sizeof(idbuf)) ? (int)sizeof(idbuf) : (rc + 1);
496  retval = _soap_calloc(soap,rc);
497  strncpy(retval,idbuf,rc);
498 
499  return retval;
500 }
501 
502 struct vmi1__VariableT *
503 d_symbol_to_x_VariableT(struct soap *soap,struct symbol *s,
504  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
505  struct array_list *refstack,int depth) {
506  struct vmi1__VariableT *r = NULL;
507  struct __vmi1__VariableT_sequence *rs;
508 
509  if (!opts)
510  opts = &defDebugFileOpts;
511 
512  RETURN_REF_OR_ALLOC(symbol,VariableT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
513  REF_ALLOC_SEQ(VariableT,r,rs);
514 
515  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
516  FILL_SYMBOLCOMMON(VariableT,s,r);
517  FILL_SYMBOLTYPE(VariableT,s,r);
518 
519  if (s->isparam)
520  rs->kind = _vmi1__kind__parameter;
521  else if (s->ismember)
522  rs->kind = _vmi1__kind__member;
523  else if (s->isenumval)
524  rs->kind = _vmi1__kind__enumerator;
525  else
526  rs->kind = _vmi1__kind__variable;
527 
528  FILL_INSTANCESYMBOLCONTENTS(VariableT,s,opts,reftab,refstack,depth,r);
529 
530  if (SYMBOLX_VAR_LOC(s)) {
531  rs->location = d_location_to_x_LocationT(soap,SYMBOLX_VAR_LOC(s),
532  opts,reftab,refstack,depth);
533  }
534  else {
535  /* Schema requires us to have one, so we'd better */
536  rs->location = _soap_calloc(soap,sizeof(*rs->location));
537  rs->location->__union_LocationT = 0;
538  rs->location->locationType = _vmi1__LocationT_locationType__none;
539  }
540 
541  CLEANUP_REF(symbol,VariableT,s,opts,reftab,refstack,depth,r);
542 
543  return r;
544 }
545 
546 struct vmi1__FunctionT *
547 d_symbol_to_x_FunctionT(struct soap *soap,struct symbol *s,
548  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
549  struct array_list *refstack,int depth) {
550  struct vmi1__FunctionT *r = NULL;
551  struct __vmi1__FunctionT_sequence *rs;
552  struct symbol_function *sf;
553 
554  if (!opts)
555  opts = &defDebugFileOpts;
556 
557  RETURN_REF_OR_ALLOC(symbol,FunctionT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
558  REF_ALLOC_SEQ(FunctionT,r,rs);
559 
560  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
561  FILL_SYMBOLCOMMON(FunctionT,s,r);
562  FILL_SYMBOLTYPE(FunctionT,s,r);
563 
564  rs->hasUnspecifiedParams = \
566  rs->parameterCount = g_slist_length(SYMBOLX_MEMBERS(s));
567 
568  sf = SYMBOLX_FUNC(s);
569  if (sf) {
570  if (sf->has_entry_pc) {
571  rs->entryPC = _soap_calloc(soap,sizeof(*rs->entryPC));
572  *rs->entryPC = sf->entry_pc;
573  }
574  if (sf->prologue_known) {
575  rs->prologueEnd = _soap_calloc(soap,sizeof(*rs->prologueEnd));
576  *rs->prologueEnd = sf->prologue_end;
577  }
578  else if (sf->prologue_guessed) {
579  rs->prologueEnd = _soap_calloc(soap,sizeof(*rs->prologueEnd));
580  *rs->prologueEnd = sf->prologue_end;
581  }
582  if (sf->epilogue_known) {
583  rs->epilogueBegin = _soap_calloc(soap,sizeof(*rs->epilogueBegin));
584  *rs->epilogueBegin = sf->epilogue_begin;
585  }
586  }
587 
588  FILL_INSTANCESYMBOLCONTENTS(FunctionT,s,opts,reftab,refstack,depth,r);
589 
590  // XXX: do constval!!!
591 
592  if (SYMBOLX_MEMBERS(s)) {
593  rs->parameters = \
595  opts,reftab,refstack,depth+1);
596  }
597  else {
598  rs->parameters = _soap_calloc(soap,sizeof(*rs->parameters));
599  }
600 
601  if (sf->scope) {
602  rs->scope = d_scope_to_x_ScopeT(soap,sf->scope,
603  opts,reftab,refstack,depth+1,NULL);
604  }
605 
606  CLEANUP_REF(symbol,FunctionT,s,opts,reftab,refstack,depth,r);
607 
608  return r;
609 }
610 
611 struct vmi1__LabelT *
612 d_symbol_to_x_LabelT(struct soap *soap,struct symbol *s,
613  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
614  struct array_list *refstack,int depth) {
615  struct vmi1__LabelT *r = NULL;
616 
617  if (!opts)
618  opts = &defDebugFileOpts;
619 
620  RETURN_REF_OR_ALLOC(symbol,LabelT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
621  REF_ALLOC_SEQ_NOSET(LabelT,r);
622 
623  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
624  FILL_SYMBOLCOMMON(LabelT,s,r);
625  FILL_INSTANCESYMBOLCONTENTS(LabelT,s,opts,reftab,refstack,depth,r);
626 
627  CLEANUP_REF(symbol,LabelT,s,opts,reftab,refstack,depth,r);
628 
629  return r;
630 }
631 
632 struct vmi1__BlockT *
633 d_symbol_to_x_BlockT(struct soap *soap,struct symbol *s,
634  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
635  struct array_list *refstack,int depth) {
636  struct vmi1__BlockT *r = NULL;
637  struct __vmi1__BlockT_sequence *rs;
638  struct symbol_block *sb;
639 
640  if (!opts)
641  opts = &defDebugFileOpts;
642 
643  RETURN_REF_OR_ALLOC(symbol,BlockT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
644  REF_ALLOC_SEQ(BlockT,r,rs);
645 
646  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
647  FILL_SYMBOLCOMMON(BlockT,s,r);
648  FILL_INSTANCESYMBOLCONTENTS(BlockT,s,opts,reftab,refstack,depth,r);
649 
650  sb = SYMBOLX_BLOCK(s);
651  if (sb->scope) {
652  rs->scope = d_scope_to_x_ScopeT(soap,sb->scope,
653  opts,reftab,refstack,depth+1,NULL);
654  }
655 
656  CLEANUP_REF(symbol,BlockT,s,opts,reftab,refstack,depth,r);
657 
658  return r;
659 }
660 
661 struct vmi1__RootT *
662 d_symbol_to_x_RootT(struct soap *soap,struct symbol *s,
663  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
664  struct array_list *refstack,int depth) {
665  struct vmi1__RootT *r = NULL;
666  struct symbol_root *sr;
667 
668  if (!opts)
669  opts = &defDebugFileOpts;
670 
671  RETURN_REF_OR_ALLOC(symbol,RootT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
672 
673  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
674  FILL_SYMBOLCOMMON_NOSEQ(RootT,s,r);
675 
676  sr = SYMBOLX_ROOT(s);
677  if (sr && sr->compdirname) {
678  SOAP_STRCPY(soap,r->compilationDir,sr->compdirname);
679  }
680  if (sr && sr->producer) {
681  SOAP_STRCPY(soap,r->producer,sr->producer);
682  }
683  if (sr && sr->language) {
684  SOAP_STRCPY(soap,r->language,sr->language);
685  }
686  if (sr->scope) {
687  r->scope = d_scope_to_x_ScopeT(soap,sr->scope,
688  opts,reftab,refstack,depth+1,NULL);
689  }
690 
691  CLEANUP_REF(symbol,RootT,s,opts,reftab,refstack,depth,r);
692 
693  return r;
694 }
695 
696 struct vmi1__VoidTypeT *
697 d_symbol_to_x_VoidTypeT(struct soap *soap,struct symbol *s,
698  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
699  struct array_list *refstack,int depth) {
700  struct vmi1__VoidTypeT *r = NULL;
701 
702  if (!opts)
703  opts = &defDebugFileOpts;
704 
705  RETURN_REF_OR_ALLOC(symbol,VoidTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
706 
707  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
708 
709  if (SYMBOL_IS_DWARF(s))
710  r->source = _vmi1__source__dwarf;
711  else if (SYMBOL_IS_ELF(s))
712  r->source = _vmi1__source__elf;
713 
714  CLEANUP_REF(symbol,VoidTypeT,s,opts,reftab,refstack,depth,r);
715 
716  return r;
717 }
718 
719 struct vmi1__BaseTypeT *
720 d_symbol_to_x_BaseTypeT(struct soap *soap,struct symbol *s,
721  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
722  struct array_list *refstack,int depth) {
723  struct vmi1__BaseTypeT *r = NULL;
724  struct __vmi1__BaseTypeT_sequence *rs;
725 
726  if (!opts)
727  opts = &defDebugFileOpts;
728 
729  RETURN_REF_OR_ALLOC(symbol,BaseTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
730  REF_ALLOC_SEQ(BaseTypeT,r,rs);
731 
732  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
733  FILL_SYMBOLCOMMON(BaseTypeT,s,r);
734 
735  if (SYMBOL_IS_FULL(s)) {
736  switch (SYMBOLX_ENCODING_V(s)) {
737  case ENCODING_ADDRESS:
738  rs->encoding = _vmi1__encoding__address;
739  break;
740  case ENCODING_BOOLEAN:
741  rs->encoding = _vmi1__encoding__boolean;
742  break;
744  rs->encoding = _vmi1__encoding__complexFloat;
745  break;
746  case ENCODING_FLOAT:
747  rs->encoding = _vmi1__encoding__float_;
748  break;
749  case ENCODING_SIGNED:
750  rs->encoding = _vmi1__encoding__signed_;
751  break;
753  rs->encoding = _vmi1__encoding__signedChar;
754  break;
755  case ENCODING_UNSIGNED:
756  rs->encoding = _vmi1__encoding__unsigned_;
757  break;
759  rs->encoding = _vmi1__encoding__unsignedChar;
760  break;
762  rs->encoding = _vmi1__encoding__imaginaryFloat;
763  break;
765  rs->encoding = _vmi1__encoding__packedDecimal;
766  break;
768  rs->encoding = _vmi1__encoding__numericString;
769  break;
770  case ENCODING_EDITED:
771  rs->encoding = _vmi1__encoding__edited;
772  break;
774  rs->encoding = _vmi1__encoding__signedFixed;
775  break;
777  rs->encoding = _vmi1__encoding__unsignedFixed;
778  break;
779  default:
780  rs->encoding = _vmi1__encoding__unknown;
781  break;
782  }
783  }
784 
785  CLEANUP_REF(symbol,BaseTypeT,s,opts,reftab,refstack,depth,r);
786 
787  return r;
788 }
789 
790 struct vmi1__PointerTypeT *
791 d_symbol_to_x_PointerTypeT(struct soap *soap,struct symbol *s,
792  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
793  struct array_list *refstack,int depth) {
794  struct vmi1__PointerTypeT *r = NULL;
795 
796  if (!opts)
797  opts = &defDebugFileOpts;
798 
799  RETURN_REF_OR_ALLOC(symbol,PointerTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
800  REF_ALLOC_SEQ_NOSET(PointerTypeT,r);
801 
802  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
803  FILL_SYMBOLCOMMON(PointerTypeT,s,r);
804  FILL_SYMBOLTYPE(PointerTypeT,s,r);
805 
806  CLEANUP_REF(symbol,PointerTypeT,s,opts,reftab,refstack,depth,r);
807 
808  return r;
809 }
810 
811 struct vmi1__RefTypeT *
812 d_symbol_to_x_RefTypeT(struct soap *soap,struct symbol *s,
813  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
814  struct array_list *refstack,int depth) {
815  struct vmi1__RefTypeT *r = NULL;
816 
817  if (!opts)
818  opts = &defDebugFileOpts;
819 
820  RETURN_REF_OR_ALLOC(symbol,RefTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
821  REF_ALLOC_SEQ_NOSET(RefTypeT,r);
822 
823  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
824  FILL_SYMBOLCOMMON(RefTypeT,s,r);
825  FILL_SYMBOLTYPE(RefTypeT,s,r);
826 
827  CLEANUP_REF(symbol,RefTypeT,s,opts,reftab,refstack,depth,r);
828 
829  return r;
830 }
831 
832 struct vmi1__TypedefTypeT *
833 d_symbol_to_x_TypedefTypeT(struct soap *soap,struct symbol *s,
834  struct vmi1__DebugFileOptsT *opts,
835  GHashTable *reftab,struct array_list *refstack,
836  int depth) {
837  struct vmi1__TypedefTypeT *r = NULL;
838 
839  if (!opts)
840  opts = &defDebugFileOpts;
841 
842  RETURN_REF_OR_ALLOC(symbol,TypedefTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
843  REF_ALLOC_SEQ_NOSET(TypedefTypeT,r);
844 
845  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
846  FILL_SYMBOLCOMMON(TypedefTypeT,s,r);
847  FILL_SYMBOLTYPE(TypedefTypeT,s,r);
848 
849  CLEANUP_REF(symbol,TypedefTypeT,s,opts,reftab,refstack,depth,r);
850 
851  return r;
852 }
853 
854 struct vmi1__ConstTypeT *
855 d_symbol_to_x_ConstTypeT(struct soap *soap,struct symbol *s,
856  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
857  struct array_list *refstack,int depth) {
858  struct vmi1__ConstTypeT *r = NULL;
859 
860  if (!opts)
861  opts = &defDebugFileOpts;
862 
863  RETURN_REF_OR_ALLOC(symbol,ConstTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
864  REF_ALLOC_SEQ_NOSET(ConstTypeT,r);
865 
866  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
867  FILL_SYMBOLCOMMON(ConstTypeT,s,r);
868  FILL_SYMBOLTYPE(ConstTypeT,s,r);
869 
870  CLEANUP_REF(symbol,ConstTypeT,s,opts,reftab,refstack,depth,r);
871 
872  return r;
873 }
874 
875 struct vmi1__VolatileTypeT *
876 d_symbol_to_x_VolatileTypeT(struct soap *soap,struct symbol *s,
877  struct vmi1__DebugFileOptsT *opts,
878  GHashTable *reftab,struct array_list *refstack,
879  int depth) {
880  struct vmi1__VolatileTypeT *r = NULL;
881 
882  if (!opts)
883  opts = &defDebugFileOpts;
884 
885  RETURN_REF_OR_ALLOC(symbol,VolatileTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
886  REF_ALLOC_SEQ_NOSET(VolatileTypeT,r);
887 
888  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
889  FILL_SYMBOLCOMMON(VolatileTypeT,s,r);
890  FILL_SYMBOLTYPE(VolatileTypeT,s,r);
891 
892  CLEANUP_REF(symbol,VolatileTypeT,s,opts,reftab,refstack,depth,r);
893 
894  return r;
895 }
896 
897 struct vmi1__ArrayTypeT *
898 d_symbol_to_x_ArrayTypeT(struct soap *soap,struct symbol *s,
899  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
900  struct array_list *refstack,int depth) {
901  struct vmi1__ArrayTypeT *r = NULL;
902  struct __vmi1__ArrayTypeT_sequence *rs;
903  GSList *l;
904  int i;
905 
906  if (!opts)
907  opts = &defDebugFileOpts;
908 
909  RETURN_REF_OR_ALLOC(symbol,ArrayTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
910  REF_ALLOC_SEQ(ArrayTypeT,r,rs);
911 
912  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
913  FILL_SYMBOLCOMMON(ArrayTypeT,s,r);
914  FILL_SYMBOLTYPE(ArrayTypeT,s,r);
915 
916  l = SYMBOLX_SUBRANGES(s);
917  if (l) {
918  rs->subrangeCount = g_slist_length(l);
919  rs->subranges = _soap_calloc(soap,sizeof(*rs->subranges));
920  rs->subranges->__sizesubrange = rs->subrangeCount;
921  if (rs->subrangeCount) {
922  rs->subranges->subrange = \
923  _soap_calloc(soap,
924  rs->subrangeCount * sizeof(*rs->subranges->subrange));
925  i = 0;
926  while (l) {
927  rs->subranges->subrange[i] = (int)(uintptr_t)g_slist_nth_data(l,0);
928  l = g_slist_next(l);
929  ++i;
930  }
931  }
932  }
933 
934  CLEANUP_REF(symbol,ArrayTypeT,s,opts,reftab,refstack,depth,r);
935 
936  return r;
937 }
938 
939 #define FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth) \
940  do { \
941  GSList *_members = SYMBOLX_MEMBERS(s); \
942  \
943  if (_members) { \
944  rs->memberCount = (int)(uintptr_t)g_slist_length(_members); \
945  rs->members = \
946  d_symbol_gslist_to_x_SymbolsOptT(soap,_members,opts,reftab, \
947  refstack,(depth)+1); \
948  } \
949  else { \
950  rs->memberCount = 0; \
951  rs->members = NULL; \
952  } \
953  } while (0);
954 
955 struct vmi1__EnumTypeT *
956 d_symbol_to_x_EnumTypeT(struct soap *soap,struct symbol *s,
957  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
958  struct array_list *refstack,int depth) {
959  struct vmi1__EnumTypeT *r = NULL;
960  struct __vmi1__EnumTypeT_sequence *rs;
961 
962  if (!opts)
963  opts = &defDebugFileOpts;
964 
965  RETURN_REF_OR_ALLOC(symbol,EnumTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
966  REF_ALLOC_SEQ(EnumTypeT,r,rs);
967 
968  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
969  FILL_SYMBOLCOMMON(EnumTypeT,s,r);
970  FILL_SYMBOLTYPE(EnumTypeT,s,r);
971 
972  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
973 
974  CLEANUP_REF(symbol,EnumTypeT,s,opts,reftab,refstack,depth,r);
975 
976  return r;
977 }
978 
979 struct vmi1__StructTypeT *
980 d_symbol_to_x_StructTypeT(struct soap *soap,struct symbol *s,
981  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
982  struct array_list *refstack,int depth) {
983  struct vmi1__StructTypeT *r = NULL;
984  struct __vmi1__StructTypeT_sequence *rs;
985 
986  if (!opts)
987  opts = &defDebugFileOpts;
988 
989  RETURN_REF_OR_ALLOC(symbol,StructTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
990  REF_ALLOC_SEQ(StructTypeT,r,rs);
991 
992  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
993  FILL_SYMBOLCOMMON(StructTypeT,s,r);
994  FILL_SYMBOLTYPE(StructTypeT,s,r);
995 
996  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
997 
998  CLEANUP_REF(symbol,StructTypeT,s,opts,reftab,refstack,depth,r);
999 
1000  return r;
1001 }
1002 
1003 struct vmi1__ClassTypeT *
1004 d_symbol_to_x_ClassTypeT(struct soap *soap,struct symbol *s,
1005  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
1006  struct array_list *refstack,int depth) {
1007  struct vmi1__ClassTypeT *r = NULL;
1008  struct __vmi1__ClassTypeT_sequence *rs;
1009 
1010  if (!opts)
1011  opts = &defDebugFileOpts;
1012 
1013  RETURN_REF_OR_ALLOC(symbol,ClassTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
1014  REF_ALLOC_SEQ(ClassTypeT,r,rs);
1015 
1016  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
1017  FILL_SYMBOLCOMMON(ClassTypeT,s,r);
1018  FILL_SYMBOLTYPE(ClassTypeT,s,r);
1019 
1020  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
1021 
1022  CLEANUP_REF(symbol,ClassTypeT,s,opts,reftab,refstack,depth,r);
1023 
1024  return r;
1025 }
1026 
1027 struct vmi1__NamespaceTypeT *
1028 d_symbol_to_x_NamespaceTypeT(struct soap *soap,struct symbol *s,
1029  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
1030  struct array_list *refstack,int depth) {
1031  struct vmi1__NamespaceTypeT *r = NULL;
1032  struct __vmi1__NamespaceTypeT_sequence *rs;
1033 
1034  if (!opts)
1035  opts = &defDebugFileOpts;
1036 
1037  RETURN_REF_OR_ALLOC(symbol,NamespaceTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
1038  REF_ALLOC_SEQ(NamespaceTypeT,r,rs);
1039 
1040  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
1041  FILL_SYMBOLCOMMON(NamespaceTypeT,s,r);
1042  FILL_SYMBOLTYPE(NamespaceTypeT,s,r);
1043 
1044  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
1045 
1046  CLEANUP_REF(symbol,NamespaceTypeT,s,opts,reftab,refstack,depth,r);
1047 
1048  return r;
1049 }
1050 
1051 struct vmi1__TemplateTypeT *
1052 d_symbol_to_x_TemplateTypeT(struct soap *soap,struct symbol *s,
1053  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
1054  struct array_list *refstack,int depth) {
1055  struct vmi1__TemplateTypeT *r = NULL;
1056  struct __vmi1__TemplateTypeT_sequence *rs;
1057 
1058  if (!opts)
1059  opts = &defDebugFileOpts;
1060 
1061  RETURN_REF_OR_ALLOC(symbol,TemplateTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
1062  REF_ALLOC_SEQ(TemplateTypeT,r,rs);
1063 
1064  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
1065  FILL_SYMBOLCOMMON(TemplateTypeT,s,r);
1066  FILL_SYMBOLTYPE(TemplateTypeT,s,r);
1067 
1068  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
1069 
1070  CLEANUP_REF(symbol,TemplateTypeT,s,opts,reftab,refstack,depth,r);
1071 
1072  return r;
1073 }
1074 
1075 struct vmi1__UnionTypeT *
1076 d_symbol_to_x_UnionTypeT(struct soap *soap,struct symbol *s,
1077  struct vmi1__DebugFileOptsT *opts,GHashTable *reftab,
1078  struct array_list *refstack,int depth) {
1079  struct vmi1__UnionTypeT *r = NULL;
1080  struct __vmi1__UnionTypeT_sequence *rs;
1081 
1082  if (!opts)
1083  opts = &defDebugFileOpts;
1084 
1085  RETURN_REF_OR_ALLOC(symbol,UnionTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
1086  REF_ALLOC_SEQ(UnionTypeT,r,rs);
1087 
1088  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
1089  FILL_SYMBOLCOMMON(UnionTypeT,s,r);
1090  FILL_SYMBOLTYPE(UnionTypeT,s,r);
1091 
1092  FILL_MEMBERS(s,rs,soap,opts,reftab,refstack,depth);
1093 
1094  CLEANUP_REF(symbol,UnionTypeT,s,opts,reftab,refstack,depth,r);
1095 
1096  return r;
1097 }
1098 
1099 struct vmi1__FunctionTypeT *
1100 d_symbol_to_x_FunctionTypeT(struct soap *soap,struct symbol *s,
1101  struct vmi1__DebugFileOptsT *opts,
1102  GHashTable *reftab,struct array_list *refstack,
1103  int depth) {
1104  struct vmi1__FunctionTypeT *r = NULL;
1105  struct __vmi1__FunctionTypeT_sequence *rs;
1106  GSList *members;
1107 
1108  if (!opts)
1109  opts = &defDebugFileOpts;
1110 
1111  RETURN_REF_OR_ALLOC(symbol,FunctionTypeT,s,"sym",s->ref,opts,reftab,refstack,depth,r);
1112  REF_ALLOC_SEQ(FunctionTypeT,r,rs);
1113 
1114  FILL_SYMBOLHEADER(s,r,"sym",s->ref);
1115  FILL_SYMBOLCOMMON(FunctionTypeT,s,r);
1116  FILL_SYMBOLTYPE(FunctionTypeT,s,r);
1117 
1118  members = SYMBOLX_MEMBERS(s);
1119  if (members) {
1120  rs->parameterCount = (int)(uintptr_t)g_slist_length(members);
1121  rs->parameters =
1122  d_symbol_gslist_to_x_SymbolsOptT(soap,members,opts,reftab,
1123  refstack,(depth)+1);
1124  }
1125  else {
1126  rs->parameterCount = 0;
1127  rs->parameters = NULL;
1128  }
1129 
1130  if (s->has_unspec_params)
1131  rs->hasUnspecifiedParams = xsd__boolean__true_;
1132  else
1133  rs->hasUnspecifiedParams = xsd__boolean__false_;
1134 
1135  CLEANUP_REF(symbol,FunctionTypeT,s,opts,reftab,refstack,depth,r);
1136 
1137  return r;
1138 }
1139 
1140 struct vmi1__SymbolT *
1141 d_symbol_to_x_SymbolT(struct soap *soap,struct symbol *s,
1142  struct vmi1__DebugFileOptsT *opts,
1143  GHashTable *reftab,struct array_list *refstack,int depth) {
1144  struct vmi1__SymbolT *r;
1145 
1146  if (!opts)
1147  opts = &defDebugFileOpts;
1148 
1149  r = (struct vmi1__SymbolT *)_soap_calloc(soap,sizeof(*r));
1150 
1151  if (SYMBOL_IS_VAR(s)) {
1152  r->union_SymbolT.variable = \
1153  d_symbol_to_x_VariableT(soap,s,opts,reftab,refstack,depth);
1154  r->__union_SymbolT = \
1155  SOAP_UNION__vmi1__union_SymbolT_variable;
1156  }
1157  else if (SYMBOL_IS_FUNC(s)) {
1158  r->union_SymbolT.function = \
1159  d_symbol_to_x_FunctionT(soap,s,opts,reftab,refstack,depth);
1160  r->__union_SymbolT = \
1161  SOAP_UNION__vmi1__union_SymbolT_function;
1162  }
1163  else if (SYMBOL_IS_LABEL(s)) {
1164  r->union_SymbolT.label = \
1165  d_symbol_to_x_LabelT(soap,s,opts,reftab,refstack,depth);
1166  r->__union_SymbolT = \
1167  SOAP_UNION__vmi1__union_SymbolT_label;
1168  }
1169  else if (SYMBOL_IS_TYPE(s)) {
1170  switch (s->datatype_code) {
1171  case DATATYPE_VOID:
1172  r->union_SymbolT.voidType = \
1173  d_symbol_to_x_VoidTypeT(soap,s,opts,reftab,refstack,depth);
1174  r->__union_SymbolT = \
1175  SOAP_UNION__vmi1__union_SymbolT_voidType;
1176  break;
1177  case DATATYPE_ARRAY:
1178  r->union_SymbolT.arrayType = \
1179  d_symbol_to_x_ArrayTypeT(soap,s,opts,reftab,refstack,depth);
1180  r->__union_SymbolT = \
1181  SOAP_UNION__vmi1__union_SymbolT_arrayType;
1182  break;
1183  case DATATYPE_STRUCT:
1184  r->union_SymbolT.structType = \
1185  d_symbol_to_x_StructTypeT(soap,s,opts,reftab,refstack,depth);
1186  r->__union_SymbolT = \
1187  SOAP_UNION__vmi1__union_SymbolT_structType;
1188  break;
1189  case DATATYPE_ENUM:
1190  r->union_SymbolT.enumType = \
1191  d_symbol_to_x_EnumTypeT(soap,s,opts,reftab,refstack,depth);
1192  r->__union_SymbolT = \
1193  SOAP_UNION__vmi1__union_SymbolT_enumType;
1194  break;
1195  case DATATYPE_PTR:
1196  r->union_SymbolT.pointerType = \
1197  d_symbol_to_x_PointerTypeT(soap,s,opts,reftab,refstack,depth);
1198  r->__union_SymbolT = \
1199  SOAP_UNION__vmi1__union_SymbolT_pointerType;
1200  break;
1201  case DATATYPE_FUNC:
1202  r->union_SymbolT.functionType = \
1203  d_symbol_to_x_FunctionTypeT(soap,s,opts,reftab,refstack,depth);
1204  r->__union_SymbolT = \
1205  SOAP_UNION__vmi1__union_SymbolT_functionType;
1206  break;
1207  case DATATYPE_TYPEDEF:
1208  r->union_SymbolT.typedefType = \
1209  d_symbol_to_x_TypedefTypeT(soap,s,opts,reftab,refstack,depth);
1210  r->__union_SymbolT = \
1211  SOAP_UNION__vmi1__union_SymbolT_typedefType;
1212  break;
1213  case DATATYPE_UNION:
1214  r->union_SymbolT.unionType = \
1215  d_symbol_to_x_UnionTypeT(soap,s,opts,reftab,refstack,depth);
1216  r->__union_SymbolT = \
1217  SOAP_UNION__vmi1__union_SymbolT_unionType;
1218  break;
1219  case DATATYPE_BASE:
1220  r->union_SymbolT.baseType = \
1221  d_symbol_to_x_BaseTypeT(soap,s,opts,reftab,refstack,depth);
1222  r->__union_SymbolT = \
1223  SOAP_UNION__vmi1__union_SymbolT_baseType;
1224  break;
1225  case DATATYPE_CONST:
1226  r->union_SymbolT.constType = \
1227  d_symbol_to_x_ConstTypeT(soap,s,opts,reftab,refstack,depth);
1228  r->__union_SymbolT = \
1229  SOAP_UNION__vmi1__union_SymbolT_constType;
1230  break;
1231  case DATATYPE_VOL:
1232  r->union_SymbolT.volatileType = \
1233  d_symbol_to_x_VolatileTypeT(soap,s,opts,reftab,refstack,depth);
1234  r->__union_SymbolT = \
1235  SOAP_UNION__vmi1__union_SymbolT_volatileType;
1236  break;
1237  default:
1238  verror("bad datatype code %d!\n",s->datatype_code);
1239  free(r);
1240  return NULL;
1241  }
1242  }
1243  else {
1244  verror("bad symbol type %d!\n",s->type);
1245  free(r);
1246  return NULL;
1247  }
1248 
1249  return r;
1250 }
1251 
1252 struct vmi1__SymbolsT *
1254  struct array_list *list,
1255  struct vmi1__DebugFileOptsT *opts,
1256  GHashTable *reftab,
1257  struct array_list *refstack,int depth) {
1258  int i;
1259  int len = array_list_len(list);
1260  struct symbol *s;
1261  struct vmi1__SymbolsT *r;
1262  union _vmi1__union_SymbolsT *ui;
1263  int *uw;
1264 
1265  if (!opts)
1266  opts = &defDebugFileOpts;
1267 
1268  r = _soap_calloc(soap,sizeof(*r));
1269 
1270  r->__size_SymbolsT = len;
1271  r->__union_SymbolsT = _soap_calloc(soap,len*sizeof(*r->__union_SymbolsT));
1272 
1273  for (i = 0; i < len; ++i) {
1274  s = (struct symbol *)array_list_item(list,i);
1275 
1276  uw = &r->__union_SymbolsT[i].__union_SymbolsT;
1277  ui = &r->__union_SymbolsT[i].union_SymbolsT;
1278 
1279  if (SYMBOL_IS_VAR(s)) {
1280  ui->variable = \
1281  d_symbol_to_x_VariableT(soap,s,opts,reftab,refstack,depth);
1282  *uw = SOAP_UNION__vmi1__union_SymbolsT_variable;
1283  }
1284  else if (SYMBOL_IS_FUNC(s)) {
1285  ui->function = \
1286  d_symbol_to_x_FunctionT(soap,s,opts,reftab,refstack,depth);
1287  *uw = SOAP_UNION__vmi1__union_SymbolsT_function;
1288  }
1289  else if (SYMBOL_IS_LABEL(s)) {
1290  ui->label = \
1291  d_symbol_to_x_LabelT(soap,s,opts,reftab,refstack,depth);
1292  *uw = SOAP_UNION__vmi1__union_SymbolsT_label;
1293  }
1294  else if (SYMBOL_IS_BLOCK(s)) {
1295  ui->block = \
1296  d_symbol_to_x_BlockT(soap,s,opts,reftab,refstack,depth);
1297  *uw = SOAP_UNION__vmi1__union_SymbolsT_block;
1298  }
1299  else if (SYMBOL_IS_ROOT(s)) {
1300  ui->root = \
1301  d_symbol_to_x_RootT(soap,s,opts,reftab,refstack,depth);
1302  *uw = SOAP_UNION__vmi1__union_SymbolsT_root;
1303  }
1304  else if (SYMBOL_IS_TYPE(s)) {
1305  switch (s->datatype_code) {
1306  case DATATYPE_VOID:
1307  ui->voidType = \
1308  d_symbol_to_x_VoidTypeT(soap,s,opts,reftab,refstack,depth);
1309  *uw = SOAP_UNION__vmi1__union_SymbolsT_voidType;
1310  break;
1311  case DATATYPE_ARRAY:
1312  ui->arrayType = \
1313  d_symbol_to_x_ArrayTypeT(soap,s,opts,reftab,refstack,depth);
1314  *uw = SOAP_UNION__vmi1__union_SymbolsT_arrayType;
1315  break;
1316  case DATATYPE_STRUCT:
1317  ui->structType = \
1318  d_symbol_to_x_StructTypeT(soap,s,opts,reftab,refstack,depth);
1319  *uw = SOAP_UNION__vmi1__union_SymbolsT_structType;
1320  break;
1321  case DATATYPE_CLASS:
1322  ui->classType = \
1323  d_symbol_to_x_ClassTypeT(soap,s,opts,reftab,refstack,depth);
1324  *uw = SOAP_UNION__vmi1__union_SymbolsT_classType;
1325  break;
1326  case DATATYPE_NAMESPACE:
1327  ui->namespaceType = \
1328  d_symbol_to_x_NamespaceTypeT(soap,s,opts,reftab,refstack,depth);
1329  *uw = SOAP_UNION__vmi1__union_SymbolsT_namespaceType;
1330  break;
1331  case DATATYPE_TEMPLATE:
1332  ui->templateType = \
1333  d_symbol_to_x_TemplateTypeT(soap,s,opts,reftab,refstack,depth);
1334  *uw = SOAP_UNION__vmi1__union_SymbolsT_templateType;
1335  break;
1336  case DATATYPE_ENUM:
1337  ui->enumType = \
1338  d_symbol_to_x_EnumTypeT(soap,s,opts,reftab,refstack,depth);
1339  *uw = SOAP_UNION__vmi1__union_SymbolsT_enumType;
1340  break;
1341  case DATATYPE_PTR:
1342  ui->pointerType = \
1343  d_symbol_to_x_PointerTypeT(soap,s,opts,reftab,refstack,depth);
1344  *uw = SOAP_UNION__vmi1__union_SymbolsT_pointerType;
1345  break;
1346  case DATATYPE_REF:
1347  ui->refType = \
1348  d_symbol_to_x_RefTypeT(soap,s,opts,reftab,refstack,depth);
1349  *uw = SOAP_UNION__vmi1__union_SymbolsT_pointerType;
1350  break;
1351  case DATATYPE_FUNC:
1352  ui->functionType = \
1353  d_symbol_to_x_FunctionTypeT(soap,s,opts,reftab,refstack,depth);
1354  *uw = SOAP_UNION__vmi1__union_SymbolsT_functionType;
1355  break;
1356  case DATATYPE_TYPEDEF:
1357  ui->typedefType = \
1358  d_symbol_to_x_TypedefTypeT(soap,s,opts,reftab,refstack,depth);
1359  *uw = SOAP_UNION__vmi1__union_SymbolsT_typedefType;
1360  break;
1361  case DATATYPE_UNION:
1362  ui->unionType = \
1363  d_symbol_to_x_UnionTypeT(soap,s,opts,reftab,refstack,depth);
1364  *uw = SOAP_UNION__vmi1__union_SymbolsT_unionType;
1365  break;
1366  case DATATYPE_BASE:
1367  ui->baseType = \
1368  d_symbol_to_x_BaseTypeT(soap,s,opts,reftab,refstack,depth);
1369  *uw = SOAP_UNION__vmi1__union_SymbolsT_baseType;
1370  break;
1371  case DATATYPE_CONST:
1372  ui->constType = \
1373  d_symbol_to_x_ConstTypeT(soap,s,opts,reftab,refstack,depth);
1374  *uw = SOAP_UNION__vmi1__union_SymbolsT_constType;
1375  break;
1376  case DATATYPE_VOL:
1377  ui->volatileType = \
1378  d_symbol_to_x_VolatileTypeT(soap,s,opts,reftab,refstack,depth);
1379  *uw = SOAP_UNION__vmi1__union_SymbolsT_volatileType;
1380  break;
1381  default:
1382  verror("BUG: bad datatype code %d; skipping!\n",
1383  s->datatype_code);
1384  ui->variable = NULL;
1385  continue;
1386  }
1387  }
1388  else {
1389  verror("BUG: bad symbol type %d; skipping!\n",s->type);
1390  ui->variable = NULL;
1391  continue;
1392  }
1393  }
1394 
1395  return r;
1396 }
1397 
1398 struct vmi1__SymbolsT *
1400  GSList *list,
1401  struct vmi1__DebugFileOptsT *opts,
1402  GHashTable *reftab,
1403  struct array_list *refstack,int depth) {
1404  int i;
1405  int len = g_slist_length(list);
1406  struct symbol *s;
1407  struct vmi1__SymbolsT *r;
1408  union _vmi1__union_SymbolsT *ui;
1409  int *uw;
1410  GSList *gsltmp;
1411 
1412  if (!opts)
1413  opts = &defDebugFileOpts;
1414 
1415  r = _soap_calloc(soap,sizeof(*r));
1416 
1417  r->__size_SymbolsT = len;
1418  r->__union_SymbolsT = _soap_calloc(soap,len*sizeof(*r->__union_SymbolsT));
1419 
1420  i = -1;
1421  v_g_slist_foreach(list,gsltmp,s) {
1422  ++i;
1423 
1424  uw = &r->__union_SymbolsT[i].__union_SymbolsT;
1425  ui = &r->__union_SymbolsT[i].union_SymbolsT;
1426 
1427  if (SYMBOL_IS_VAR(s)) {
1428  ui->variable = \
1429  d_symbol_to_x_VariableT(soap,s,opts,reftab,refstack,depth);
1430  *uw = SOAP_UNION__vmi1__union_SymbolsT_variable;
1431  }
1432  else if (SYMBOL_IS_FUNC(s)) {
1433  ui->function = \
1434  d_symbol_to_x_FunctionT(soap,s,opts,reftab,refstack,depth);
1435  *uw = SOAP_UNION__vmi1__union_SymbolsT_function;
1436  }
1437  else if (SYMBOL_IS_LABEL(s)) {
1438  ui->label = \
1439  d_symbol_to_x_LabelT(soap,s,opts,reftab,refstack,depth);
1440  *uw = SOAP_UNION__vmi1__union_SymbolsT_label;
1441  }
1442  else if (SYMBOL_IS_BLOCK(s)) {
1443  ui->block = \
1444  d_symbol_to_x_BlockT(soap,s,opts,reftab,refstack,depth);
1445  *uw = SOAP_UNION__vmi1__union_SymbolsT_block;
1446  }
1447  else if (SYMBOL_IS_ROOT(s)) {
1448  ui->root = \
1449  d_symbol_to_x_RootT(soap,s,opts,reftab,refstack,depth);
1450  *uw = SOAP_UNION__vmi1__union_SymbolsT_root;
1451  }
1452  else if (SYMBOL_IS_TYPE(s)) {
1453  switch (s->datatype_code) {
1454  case DATATYPE_VOID:
1455  ui->voidType = \
1456  d_symbol_to_x_VoidTypeT(soap,s,opts,reftab,refstack,depth);
1457  *uw = SOAP_UNION__vmi1__union_SymbolsT_voidType;
1458  break;
1459  case DATATYPE_ARRAY:
1460  ui->arrayType = \
1461  d_symbol_to_x_ArrayTypeT(soap,s,opts,reftab,refstack,depth);
1462  *uw = SOAP_UNION__vmi1__union_SymbolsT_arrayType;
1463  break;
1464  case DATATYPE_STRUCT:
1465  ui->structType = \
1466  d_symbol_to_x_StructTypeT(soap,s,opts,reftab,refstack,depth);
1467  *uw = SOAP_UNION__vmi1__union_SymbolsT_structType;
1468  break;
1469  case DATATYPE_CLASS:
1470  ui->classType = \
1471  d_symbol_to_x_ClassTypeT(soap,s,opts,reftab,refstack,depth);
1472  *uw = SOAP_UNION__vmi1__union_SymbolsT_classType;
1473  break;
1474  case DATATYPE_NAMESPACE:
1475  ui->namespaceType = \
1476  d_symbol_to_x_NamespaceTypeT(soap,s,opts,reftab,refstack,depth);
1477  *uw = SOAP_UNION__vmi1__union_SymbolsT_namespaceType;
1478  break;
1479  case DATATYPE_TEMPLATE:
1480  ui->templateType = \
1481  d_symbol_to_x_TemplateTypeT(soap,s,opts,reftab,refstack,depth);
1482  *uw = SOAP_UNION__vmi1__union_SymbolsT_templateType;
1483  break;
1484  case DATATYPE_ENUM:
1485  ui->enumType = \
1486  d_symbol_to_x_EnumTypeT(soap,s,opts,reftab,refstack,depth);
1487  *uw = SOAP_UNION__vmi1__union_SymbolsT_enumType;
1488  break;
1489  case DATATYPE_PTR:
1490  ui->pointerType = \
1491  d_symbol_to_x_PointerTypeT(soap,s,opts,reftab,refstack,depth);
1492  *uw = SOAP_UNION__vmi1__union_SymbolsT_pointerType;
1493  break;
1494  case DATATYPE_REF:
1495  ui->refType = \
1496  d_symbol_to_x_RefTypeT(soap,s,opts,reftab,refstack,depth);
1497  *uw = SOAP_UNION__vmi1__union_SymbolsT_pointerType;
1498  break;
1499  case DATATYPE_FUNC:
1500  ui->functionType = \
1501  d_symbol_to_x_FunctionTypeT(soap,s,opts,reftab,refstack,depth);
1502  *uw = SOAP_UNION__vmi1__union_SymbolsT_functionType;
1503  break;
1504  case DATATYPE_TYPEDEF:
1505  ui->typedefType = \
1506  d_symbol_to_x_TypedefTypeT(soap,s,opts,reftab,refstack,depth);
1507  *uw = SOAP_UNION__vmi1__union_SymbolsT_typedefType;
1508  break;
1509  case DATATYPE_UNION:
1510  ui->unionType = \
1511  d_symbol_to_x_UnionTypeT(soap,s,opts,reftab,refstack,depth);
1512  *uw = SOAP_UNION__vmi1__union_SymbolsT_unionType;
1513  break;
1514  case DATATYPE_BASE:
1515  ui->baseType = \
1516  d_symbol_to_x_BaseTypeT(soap,s,opts,reftab,refstack,depth);
1517  *uw = SOAP_UNION__vmi1__union_SymbolsT_baseType;
1518  break;
1519  case DATATYPE_CONST:
1520  ui->constType = \
1521  d_symbol_to_x_ConstTypeT(soap,s,opts,reftab,refstack,depth);
1522  *uw = SOAP_UNION__vmi1__union_SymbolsT_constType;
1523  break;
1524  case DATATYPE_VOL:
1525  ui->volatileType = \
1526  d_symbol_to_x_VolatileTypeT(soap,s,opts,reftab,refstack,depth);
1527  *uw = SOAP_UNION__vmi1__union_SymbolsT_volatileType;
1528  break;
1529  default:
1530  verror("BUG: bad datatype code %d; skipping!\n",
1531  s->datatype_code);
1532  ui->variable = NULL;
1533  continue;
1534  }
1535  }
1536  else {
1537  verror("BUG: bad symbol type %d; skipping!\n",s->type);
1538  ui->variable = NULL;
1539  continue;
1540  }
1541  }
1542 
1543  return r;
1544 }
1545 
1546 struct vmi1__SymbolsOptT *
1548  struct array_list *list,
1549  struct vmi1__DebugFileOptsT *opts,
1550  GHashTable *reftab,
1551  struct array_list *refstack,int depth) {
1552  /*
1553  * This is nasty. We just return a vmi1__SymbolsT because gSOAP
1554  * gives us the same C structs/unions/enums types for
1555  * vmi1__SymbolsOptT as vmi1__SymbolsT.
1556  *
1557  * It just saves some code.
1558  */
1559  return (struct vmi1__SymbolsOptT *) \
1560  d_symbol_array_list_to_x_SymbolsT(soap,list,opts,reftab,refstack,depth);
1561 }
1562 
1563 struct vmi1__SymbolsOptT *
1565  GSList *list,
1566  struct vmi1__DebugFileOptsT *opts,
1567  GHashTable *reftab,
1568  struct array_list *refstack,int depth) {
1569  /*
1570  * This is nasty. We just return a vmi1__SymbolsT because gSOAP
1571  * gives us the same C structs/unions/enums types for
1572  * vmi1__SymbolsOptT as vmi1__SymbolsT.
1573  *
1574  * It just saves some code.
1575  */
1576  return (struct vmi1__SymbolsOptT *) \
1577  d_symbol_gslist_to_x_SymbolsT(soap,list,opts,reftab,refstack,depth);
1578 }
1579 
1580 struct vmi1__DebugFileT *
1581 d_debugfile_to_x_DebugFileT(struct soap *soap,struct debugfile *df,
1582  struct vmi1__DebugFileOptsT *opts,
1583  GHashTable *reftab,struct array_list *refstack,
1584  int depth) {
1585  struct vmi1__DebugFileT *r = NULL;
1586  struct __vmi1__DebugFileT_sequence *rs;
1587  int i,flen;
1588  GSList *gslist;
1589 
1590  if (!opts)
1591  opts = &defDebugFileOpts;
1592 
1593  RETURN_REF_OR_ALLOC(debugfile,DebugFileT,df,"dbg",df->id,opts,reftab,refstack,depth,r);
1594  REF_ALLOC_SEQ(DebugFileT,r,rs);
1595 
1596  *r->sid = _ref_build_int(soap,"dbg",df->id);
1597 
1598  switch (df->type) {
1599  case DEBUGFILE_TYPE_ELF:
1600  rs->debugfileType = _vmi1__debugfileType__elf;
1601  break;
1602  case DEBUGFILE_TYPE_DWARF:
1603  rs->debugfileType = _vmi1__debugfileType__dwarf;
1604  break;
1605  default:
1606  rs->debugfileType = _vmi1__debugfileType__none;
1607  break;
1608  }
1609 
1610  flen = 0;
1612  ++flen;
1613  if (df->flags & DEBUGFILE_TYPE_FLAG_KMOD)
1614  ++flen;
1615 
1616  rs->debugfileTypeFlags =
1617  _soap_calloc(soap,1 * sizeof(*rs->debugfileTypeFlags));
1618  rs->debugfileTypeFlags->__sizedebugfileTypeFlag = flen;
1619  rs->debugfileTypeFlags->debugfileTypeFlag =
1620  _soap_calloc(soap,rs->debugfileTypeFlags->__sizedebugfileTypeFlag * \
1621  sizeof(*rs->debugfileTypeFlags->debugfileTypeFlag));
1622 
1623  i = 0;
1624  if (df->flags & DEBUGFILE_TYPE_FLAG_KERNEL) {
1625  rs->debugfileTypeFlags->debugfileTypeFlag[i] =
1626  _vmi1__debugfileTypeFlag__kernel;
1627  ++i;
1628  }
1629  if (df->flags & DEBUGFILE_TYPE_FLAG_KMOD) {
1630  rs->debugfileTypeFlags->debugfileTypeFlag[i] =
1631  _vmi1__debugfileTypeFlag__kmod;
1632  ++i;
1633  }
1634 
1635  /* Done in RETURN_REF_OR_ALLOC above. */
1636  /*SOAP_STRCPY(soap,rs->name,df->name);*/
1637  if (df->binfile)
1638  SOAP_STRCPY(soap,rs->version,df->binfile->version);
1639 
1640  gslist = g_hash_table_get_values_slist(df->srcfiles);
1641  rs->rootSymbols = d_symbol_gslist_to_x_SymbolsT(soap,gslist,
1642  opts,reftab,refstack,depth);
1643  if (gslist)
1644  g_slist_free(gslist);
1645 
1646  gslist = g_hash_table_get_values_slist(df->globals);
1647  rs->globalSymbols = d_symbol_gslist_to_x_SymbolsT(soap,gslist,
1648  opts,reftab,refstack,depth);
1649  if (gslist)
1650  g_slist_free(gslist);
1651 
1652  CLEANUP_REF(debugfile,DebugFileT,df,opts,reftab,refstack,depth,r);
1653 
1654  return r;
1655 }
1656 
1657 struct vmi1__ScopeT *
1658 d_scope_to_x_ScopeT(struct soap *soap,struct scope *st,
1659  struct vmi1__DebugFileOptsT *opts,
1660  GHashTable *reftab,struct array_list *refstack,int depth,
1661  struct vmi1__ScopeT *ir) {
1662  struct vmi1__ScopeT *r = ir;
1663  struct __vmi1__ScopeT_sequence *rs;
1664  struct scope *scope;
1665  int len;
1666  int i;
1667  GSList *gslist;
1668  GSList *gsltmp;
1669 
1670  if (!opts)
1671  opts = &defDebugFileOpts;
1672 
1673  RETURN_REF_OR_ALLOC(scope,ScopeT,st,"sc",st->ref,opts,reftab,refstack,depth,r);
1674  REF_ALLOC_SEQ(ScopeT,r,rs);
1675 
1676  r->sid = _ref_build_int(soap,"sc",st->ref);
1677 
1678  if (st->symbol && symbol_get_name(st->symbol)) {
1679  SOAP_STRCPY(soap,r->name,symbol_get_name(st->symbol));
1680  }
1681 
1682  rs->ranges = d_range_to_x_RangesT(soap,st->range,opts,reftab,refstack,depth);
1683 
1684 #if 0
1685  if (st->parent)
1686  rs->parent = \
1687  d_scope_to_x_ScopeT(soap,st->parent,opts,reftab,refstack,depth+1,NULL);
1688 #endif
1689 
1690  if (st->subscopes)
1691  len = g_slist_length(st->subscopes);
1692  else
1693  len = 0;
1694 
1695  rs->scopes = _soap_calloc(soap,1 * sizeof(*rs->scopes));
1696  rs->scopes->__sizescope = len;
1697  if (len)
1698  rs->scopes->scope = _soap_calloc(soap,len*sizeof(*rs->scopes->scope));
1699  else
1700  rs->scopes->scope = NULL;
1701 
1702  if (len) {
1703  i = 0;
1704  v_g_slist_foreach(st->subscopes,gsltmp,scope) {
1705  d_scope_to_x_ScopeT(soap,scope,opts,reftab,refstack,depth+1,
1706  &rs->scopes->scope[i]);
1707  ++i;
1708  }
1709  }
1710 
1711  /* Make a tmp array list of the symbols */
1712  gslist = NULL;
1713  if (st->symdict)
1715  0,0,1);
1716  rs->symbols = d_symbol_gslist_to_x_SymbolsOptT(soap,gslist,opts,
1717  reftab,refstack,depth);
1718  if (gslist)
1719  g_slist_free(gslist);
1720 
1721  /* Make a tmp array list of the anon symbols */
1722  gslist = NULL;
1723  if (st->symdict)
1725  1,1,0);
1726  rs->anonSymbols = d_symbol_gslist_to_x_SymbolsOptT(soap,gslist,opts,
1727  reftab,refstack,depth);
1728  if (gslist)
1729  g_slist_free(gslist);
1730 
1731  CLEANUP_REF(scope,ScopeT,st,opts,reftab,refstack,depth,r);
1732 
1733  return r;
1734 }
struct vmi1__ClassTypeT * d_symbol_to_x_ClassTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define LOCATION_ADDR(loc)
Definition: dwdebug_priv.h:622
struct vmi1__PointerTypeT * d_symbol_to_x_PointerTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define FILL_SYMBOLCOMMON(typename, s, r)
#define SYMBOLX_SUBRANGES(sym)
#define REF_ALLOC_SEQ_NOSET(typename, r)
uint8_t has_entry_pc
uint8_t epilogue_known
ADDR end
Definition: dwdebug_priv.h:438
struct vmi1__RangesT * d_range_to_x_RangesT(struct soap *soap, struct range *r, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define RETURN_REF_OR_ALLOC(objtype, typename, s, reft, refv, opts, reftab, refstack, depth, r)
#define SYMBOL_IS_ELF(sym)
struct vmi1__VariableT * d_symbol_to_x_VariableT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct vmi1__UnionTypeT * d_symbol_to_x_UnionTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
GHashTable * srcfiles
Definition: dwdebug.h:883
static uint64_t unsigned int i
#define SYMBOLX_MEMBERS(sym)
char * version
Definition: binfile.h:259
struct symdict * symdict
Definition: dwdebug_priv.h:466
struct vmi1__SymbolsOptT * d_symbol_gslist_to_x_SymbolsOptT(struct soap *soap, GSList *list, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define FILL_SYMBOLCOMMON_NOSEQ(typename, s, r)
#define v_g_slist_foreach(gslhead, gslcur, elm)
Definition: glib_wrapper.h:60
SMOFFSET ref
Definition: dwdebug_priv.h:868
#define SYMBOL_IS_FULL(sym)
struct vmi1__SymbolsT * d_symbol_gslist_to_x_SymbolsT(struct soap *soap, GSList *list, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define LOCATION_LOCLIST(loc)
Definition: dwdebug_priv.h:625
char * language
Definition: dwdebug_priv.h:995
GSList * symdict_match_syms_by_tab(struct symdict *symdict, struct rfilter *symbol_filter, symbol_type_flag_t flags, int no_main, int no_dup, int no_anon)
Definition: symdict.c:419
ADDR start
Definition: dwdebug_priv.h:437
#define verror(format,...)
Definition: log.h:30
int id
Definition: dwdebug.h:823
#define SYMBOLX_ROOT(sym)
#define SYMBOLX_VAR_LOC(sym)
GHashTable * globals
Definition: dwdebug.h:929
symbol_type_t type
Definition: dwdebug_priv.h:833
struct vmi1__FunctionT * d_symbol_to_x_FunctionT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
OFFSET offset
Definition: dwdebug_priv.h:603
struct scope * scope
struct vmi1__BaseTypeT * d_symbol_to_x_BaseTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
void free(void *ptr)
Definition: debugserver.c:207
#define LOCATION_GET_DATA(loc, buf, buflen)
Definition: dwdebug_priv.h:633
struct symbol_variable * variable
Definition: dwdebug_priv.h:979
struct vmi1__SymbolsOptT * d_symbol_array_list_to_x_SymbolsOptT(struct soap *soap, struct array_list *list, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct range * range
Definition: dwdebug_priv.h:471
struct vmi1__LocationT * d_location_to_x_LocationT(struct soap *soap, struct location *l, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
Definition: debuginfo_xml.c:42
#define FILL_SYMBOLHEADER(s, r, reft, refv)
#define SYMBOL_IS_LABEL(sym)
struct scope * scope
#define LOCATION_OFFSET(loc)
Definition: dwdebug_priv.h:624
struct vmi1__BlockT * d_symbol_to_x_BlockT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct loclistloc * next
Definition: dwdebug_priv.h:562
struct location * loc
Definition: dwdebug_priv.h:561
struct vmi1__ArrayTypeT * d_symbol_to_x_ArrayTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
unsigned int isparam
Definition: dwdebug_priv.h:839
struct vmi1__TypedefTypeT * d_symbol_to_x_TypedefTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
datatype_code_t datatype_code
Definition: dwdebug_priv.h:827
char * producer
Definition: dwdebug_priv.h:994
struct range * next
Definition: dwdebug_priv.h:439
#define FILL_SYMBOLTYPE(typename, s, r)
struct vmi1__VoidTypeT * d_symbol_to_x_VoidTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct vmi1__RefTypeT * d_symbol_to_x_RefTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
unsigned int isenumval
Definition: dwdebug_priv.h:839
struct dt_argp_state opts
Definition: dumptarget.c:111
struct vmi1__SymbolT * d_symbol_to_x_SymbolT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define SYMBOLX_ENCODING_V(sym)
#define SYMBOL_IS_BLOCK(sym)
struct vmi1__StructTypeT * d_symbol_to_x_StructTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
SMOFFSET ref
Definition: dwdebug_priv.h:460
#define SYMBOL_IS_DWARF(sym)
#define FILL_INSTANCESYMBOLCONTENTS(typename, s, opts, reftab, refstack, depth, r)
struct vmi1__DebugFileT * d_debugfile_to_x_DebugFileT(struct soap *soap, struct debugfile *df, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
int len
Definition: dumptarget.c:52
unsigned int has_unspec_params
Definition: dwdebug_priv.h:839
struct vmi1__RootT * d_symbol_to_x_RootT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct scope * parent
Definition: dwdebug_priv.h:476
#define REF_ALLOC_SEQ(typename, r, rs)
#define FILL_MEMBERS(s, rs, soap, opts, reftab, refstack, depth)
#define SYMBOL_IS_TYPE(sym)
struct vmi1__VolatileTypeT * d_symbol_to_x_VolatileTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct binfile * binfile
Definition: dwdebug.h:808
uint8_t prologue_guessed
struct vmi1__SymbolsT * d_symbol_array_list_to_x_SymbolsT(struct soap *soap, struct array_list *list, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
int8_t REG
Definition: common.h:93
struct vmi1__ScopeT * d_scope_to_x_ScopeT(struct soap *soap, struct scope *st, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth, struct vmi1__ScopeT *ir)
GSList * subscopes
Definition: dwdebug_priv.h:484
loctype_t loctype
Definition: dwdebug_priv.h:585
struct scope * scope
#define SYMBOL_IS_ROOT(sym)
#define LOCATION_REG(loc)
Definition: dwdebug_priv.h:623
debugfile_type_flags_t flags
Definition: dwdebug.h:789
char * symbol_get_name(struct symbol *symbol)
Definition: debug.c:2587
#define SYMBOLX_FUNC(sym)
struct vmi1__EnumTypeT * d_symbol_to_x_EnumTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct vmi1__ConstTypeT * d_symbol_to_x_ConstTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define SOAP_STRCPY(soap, d, s)
Definition: util.h:28
uint8_t prologue_known
#define CLEANUP_REF(objtype, typename, s, opts, reftab, refstack, depth, r)
struct vmi1__NamespaceTypeT * d_symbol_to_x_NamespaceTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
#define SYMBOL_IS_FUNC(sym)
struct vmi1__TemplateTypeT * d_symbol_to_x_TemplateTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
struct vmi1__FunctionTypeT * d_symbol_to_x_FunctionTypeT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)
debugfile_type_t type
Definition: dwdebug.h:788
unsigned int ismember
Definition: dwdebug_priv.h:839
#define SYMBOL_IS_VAR(sym)
#define SYMBOLX_BLOCK(sym)
char * compdirname
Definition: dwdebug_priv.h:993
struct symbol * symbol
Definition: dwdebug_priv.h:463
struct vmi1__LabelT * d_symbol_to_x_LabelT(struct soap *soap, struct symbol *s, struct vmi1__DebugFileOptsT *opts, GHashTable *reftab, struct array_list *refstack, int depth)