Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251
WebSVN – tendra.SVN – Diff – /branches/tendra5/src/installers/common/dwarf/dwarf_info.c – Rev 5 and 6

Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
 
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
Line 90... Line 120...
90
#include "tags.h"
120
#include "tags.h"
91
#endif
121
#endif
92
 
122
 
93
#ifndef CROSS_INCLUDE
123
#ifndef CROSS_INCLUDE
94
#include <dwarf.h>
124
#include <dwarf.h>
95
#else
125
#else
96
#include CROSS_INCLUDE/dwarf.h>
126
#include CROSS_INCLUDE/dwarf.h>
97
#endif
127
#endif
98
 
128
 
99
int continue_decs;
129
int continue_decs;
100
 
130
 
101
static long lex_blk_stk_ptr = -1;
131
static long lex_blk_stk_ptr = -1;
102
 
132
 
103
static dwarf_label lex_blk_stk[100];
133
static dwarf_label lex_blk_stk[100];
104
 
134
 
188
	{
283
	{
-
 
284
		dwarf_label tlab;
-
 
285
 
-
 
286
		mark_scope(e);
-
 
287
 
-
 
288
		if (props(e) & 0x80) {
-
 
289
			next_dwarf_lab(PUSH_LEX_BLK);
-
 
290
			OUT_DWARF_BEG(TOS_LEX_BLK);
-
 
291
			cont_sib_chain(TAG_lexical_block);
-
 
292
			OUT_DWARF_ATTR(AT_low_pc);
-
 
293
			dwarf4(LAB2CHAR(TOS_LEX_BLK->beg));
-
 
294
			OUT_DWARF_ATTR(AT_high_pc);
-
 
295
			dwarf4(LAB2CHAR(TOS_LEX_BLK->end));
-
 
296
			leave_dwarf_blk();
-
 
297
			make_next_new_chain();
-
 
298
		};
-
 
299
 
-
 
300
		next_dwarf_lab(&tlab);
-
 
301
		OUT_DWARF_BEG(&tlab);	/* always needed for start_scope */
-
 
302
		switch (d->key)
-
 
303
		{
-
 
304
		case DIAG_INFO_ID: {
-
 
305
			exp x = d->data.id_scope.access;
-
 
306
 
-
 
307
			if (name(x) != name_tag) {
-
 
308
				failer("diagnosing non-identifier");
-
 
309
				return;
-
 
310
			}
-
 
311
 
-
 
312
			if ((base_type(d->data.id_scope.typ))->key ==
-
 
313
			    DIAG_TYPE_INITED) {
189
	  fprintf(stderr,"ERROR: %s has no diagtype... omitting\n",
314
				fprintf(stderr, "ERROR: %s %s has no diagtype... omitting\n",
-
 
315
					isparam(son(x)) ? "Formal parameter" :
-
 
316
					"Local variable",
-
 
317
					TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
318
				break;
-
 
319
			}
-
 
320
			if (isglob(son(x))) {
-
 
321
				if (brog(son(x)) ->dec_u.dec_val.extnamed) {
-
 
322
					break;
-
 
323
				} else {
-
 
324
					/* static; goes out as local */
-
 
325
					cont_sib_chain(TAG_local_variable);
-
 
326
					/* only for local vars */
-
 
327
					out_dwarf_start_scope(&tlab);
-
 
328
				}
-
 
329
			} else if (isparam(son(x))) {
-
 
330
				cont_sib_chain(TAG_formal_parameter);
-
 
331
			} else {
-
 
332
				cont_sib_chain(TAG_local_variable);
-
 
333
				/* only for local vars */
-
 
334
				out_dwarf_start_scope(&tlab);
-
 
335
			}
-
 
336
 
-
 
337
			out_dwarf_name_attr(TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
338
			out_dwarf_type_attr(d->data.id_scope.typ);
-
 
339
			if (!out_dwarf_loc_attr(x, proc_no)) {
-
 
340
				fprintf(stderr, "Unable to generate location info for variable '%s'\n",
190
		  TDFSTRING2CHAR(d->data.id_scope.nme));
341
					TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
342
			}
-
 
343
			leave_dwarf_blk();
-
 
344
			dump_type_q();
-
 
345
		}
-
 
346
			break;
-
 
347
		case DIAG_INFO_TYPE:
-
 
348
			cont_sib_chain(TAG_typedef);
-
 
349
			out_dwarf_start_scope(&tlab);
-
 
350
			out_dwarf_name_attr(TDFSTRING2CHAR(d->data.type_scope.nme));
-
 
351
			out_dwarf_type_attr(d->data.type_scope.typ);
-
 
352
			leave_dwarf_blk();
-
 
353
			break;
-
 
354
		case DIAG_INFO_TAG:
-
 
355
			fprintf(stderr, "diag_info_tag named %s\n",
-
 
356
				TDFSTRING2CHAR(d->data.tag_scope.nme));
-
 
357
			if (!strcmp(TDFSTRING2CHAR(d->data.tag_scope.nme),
-
 
358
				    TDFSTRING2CHAR(d->data.tag_scope.typ->data.t_struct.nme)))
-
 
359
			{
-
 
360
				fprintf(stderr, "diag type gives name as %s\n",
-
 
361
					TDFSTRING2CHAR(d->data.tag_scope.typ->data.t_struct.nme));
-
 
362
				failer("different names in output_diag");
-
 
363
			}
-
 
364
			out_dwarf_user_type(d->data.tag_scope.typ);
191
	  break;
365
			break;
-
 
366
		default:
-
 
367
			failer("Illegal key in output_diag");
-
 
368
			fprintf(stderr, "key was %d\n", d->key);
-
 
369
		}
192
	}
370
	}
193
	if (name(x) == name_tag && isglob(son(x)))
-
 
194
	{
-
 
195
	  if (brog(son(x))->dec_u.dec_val.extnamed)
-
 
196
	    break;
-
 
197
	  else			/* static; goes out as local */
-
 
198
	  {
-
 
199
	    cont_sib_chain(TAG_local_variable);
-
 
200
	    out_dwarf_start_scope(&tlab); /* only for local vars */
-
 
201
	  }
-
 
202
	}
-
 
203
	else
-
 
204
	  if (name(x) == name_tag && isparam(son(x)))
-
 
205
	    cont_sib_chain(TAG_formal_parameter);
-
 
206
	  else
-
 
207
	  {
-
 
208
	    cont_sib_chain(TAG_local_variable);
-
 
209
	    out_dwarf_start_scope(&tlab);	/* only for local vars */
-
 
210
	  };
-
 
211
 
-
 
212
	out_dwarf_name_attr(TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
213
	out_dwarf_type_attr(d->data.id_scope.typ);
-
 
214
	if (!out_dwarf_loc_attr(x,proc_no))
-
 
215
	  fprintf(stderr,"Unable to generate location info for variable '%s'\n",
-
 
216
		  TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
217
	leave_dwarf_blk();
-
 
218
	dump_type_q();
-
 
219
        break;
-
 
220
      }
-
 
221
      code_diag_info (d->more, proc_no, mcode, args);
-
 
222
      comment_end_scope (d);
-
 
223
      return;
-
 
224
    }
-
 
225
    case DIAG_INFO_TYPE: {
-
 
226
      dwarf_label tlab;
-
 
227
      next_dwarf_lab(&tlab);
-
 
228
      OUT_DWARF_BEG(&tlab);	/* always needed for start_scope */
-
 
229
      cont_sib_chain(TAG_typedef);
-
 
230
      out_dwarf_start_scope(&tlab);
-
 
231
      out_dwarf_name_attr(TDFSTRING2CHAR(d->data.type_scope.nme));
-
 
232
      out_dwarf_type_attr(d->data.type_scope.typ);
-
 
233
      leave_dwarf_blk();
-
 
234
      code_diag_info (d->more, proc_no, mcode, args);
-
 
235
      comment_end_scope (d);
-
 
236
      return;
-
 
237
    }
-
 
238
    failer("Illegal key in output_diag");
-
 
239
    fprintf(stderr,"key was %d\n",d->key);
-
 
240
    code_diag_info (d->more, proc_no, mcode, args);
-
 
241
  }
-
 
242
}
371
}
243
 
372
 
244
#else
-
 
245
 
-
 
246
void output_diag
-
 
247
    PROTO_N ( (d, proc_no, e) )
-
 
248
    PROTO_T ( diag_info * d X int proc_no X exp e )
-
 
249
{
-
 
250
  if(d->key == DIAG_INFO_SOURCE)
-
 
251
  {
-
 
252
    out_dwarf_sourcemark(&(d->data.source.beg));
-
 
253
    return;
-
 
254
  }
-
 
255
  {
-
 
256
    dwarf_label tlab;
-
 
257
 
-
 
258
    mark_scope(e);
-
 
259
 
373
 
260
    if (props(e) & 0x80)
-
 
261
    {
374
void
262
      next_dwarf_lab(PUSH_LEX_BLK);
-
 
263
      OUT_DWARF_BEG(TOS_LEX_BLK);
-
 
264
      cont_sib_chain(TAG_lexical_block);
375
output_end_scope(diag_info *d, exp e)
265
      OUT_DWARF_ATTR(AT_low_pc);
-
 
266
      dwarf4(LAB2CHAR(TOS_LEX_BLK->beg));
-
 
267
      OUT_DWARF_ATTR(AT_high_pc);
-
 
268
      dwarf4(LAB2CHAR(TOS_LEX_BLK->end));
-
 
269
      leave_dwarf_blk();
-
 
270
      make_next_new_chain();
-
 
271
    };
-
 
272
 
376
{
273
    next_dwarf_lab(&tlab);
377
	char expr_buf[100];
274
    OUT_DWARF_BEG(&tlab);	/* always needed for start_scope */
-
 
275
    switch (d->key)
-
 
276
    {
-
 
277
     case DIAG_INFO_ID:
-
 
278
      {
-
 
279
	exp x = d->data.id_scope.access;
-
 
280
 
378
 
281
	if (name(x) != name_tag)
-
 
282
	{
-
 
283
	  failer("diagnosing non-identifier");
379
	sprintf(expr_buf, COMMENT_2("\t", "\tEND diag_info key %d"), d->key);
284
	  return;
380
	outs(expr_buf);
285
	};
381
	outnl();
286
 
382
 
287
	if ((base_type(d->data.id_scope.typ))->key == DIAG_TYPE_INITED)
383
	if (d->key != DIAG_INFO_SOURCE && props(e) & 0x80) {
288
	{
-
 
289
	  fprintf(stderr,"ERROR: %s %s has no diagtype... omitting\n",
-
 
290
		  isparam(son(x)) ? "Formal parameter" : "Local variable",
-
 
291
		  TDFSTRING2CHAR(d->data.id_scope.nme));
384
		OUT_DWARF_END(POP_LEX_BLK);
292
	  break;
385
		CHK_LEX_STK;
293
	}
-
 
294
	if (isglob(son(x)))
386
		end_sib_chain();
295
	{
-
 
296
	  if (brog(son(x))->dec_u.dec_val.extnamed)
-
 
297
	    break;
-
 
298
	  else			/* static; goes out as local */
-
 
299
	  {
-
 
300
	    cont_sib_chain(TAG_local_variable);
-
 
301
	    out_dwarf_start_scope(&tlab); /* only for local vars */
-
 
302
	  }
-
 
303
	}
387
	}
304
	else
-
 
305
	  if (isparam(son(x)))
-
 
306
	    cont_sib_chain(TAG_formal_parameter);
-
 
307
	  else
-
 
308
	  {
-
 
309
	    cont_sib_chain(TAG_local_variable);
-
 
310
	    out_dwarf_start_scope(&tlab);	/* only for local vars */
-
 
311
	  };
-
 
312
 
-
 
313
	out_dwarf_name_attr(TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
314
	out_dwarf_type_attr(d->data.id_scope.typ);
-
 
315
	if (!out_dwarf_loc_attr(x,proc_no))
-
 
316
	  fprintf(stderr,"Unable to generate location info for variable '%s'\n",
-
 
317
		  TDFSTRING2CHAR(d->data.id_scope.nme));
-
 
318
	leave_dwarf_blk();
-
 
319
	dump_type_q();
-
 
320
      }
-
 
321
      break;
-
 
322
     case DIAG_INFO_TYPE:
-
 
323
      cont_sib_chain(TAG_typedef);
-
 
324
      out_dwarf_start_scope(&tlab);
-
 
325
      out_dwarf_name_attr(TDFSTRING2CHAR(d->data.type_scope.nme));
-
 
326
      out_dwarf_type_attr(d->data.type_scope.typ);
-
 
327
      leave_dwarf_blk();
-
 
328
      break;
-
 
329
     case DIAG_INFO_TAG:
-
 
330
      fprintf(stderr,"diag_info_tag named %s\n",
-
 
331
	      TDFSTRING2CHAR(d->data.tag_scope.nme));
-
 
332
      if (!strcmp(TDFSTRING2CHAR(d->data.tag_scope.nme),
-
 
333
		  TDFSTRING2CHAR(d->data.tag_scope.typ->data.t_struct.nme)))
-
 
334
      {
-
 
335
	fprintf(stderr,"diag type gives name as %s\n",
-
 
336
		TDFSTRING2CHAR(d->data.tag_scope.typ->data.t_struct.nme));
-
 
337
	failer("different names in output_diag");
-
 
338
      }
-
 
339
      out_dwarf_user_type(d->data.tag_scope.typ);
-
 
340
      break;
-
 
341
     default:
-
 
342
      failer("Illegal key in output_diag");
-
 
343
      fprintf(stderr,"key was %d\n",d->key);
-
 
344
    }
-
 
345
  }
-
 
346
}
-
 
347
 
-
 
348
void output_end_scope
-
 
349
    PROTO_N ( (d,e) )
-
 
350
    PROTO_T ( diag_info * d X exp e )
-
 
351
{
-
 
352
  char expr_buf[100];
-
 
353
 
-
 
354
  sprintf(expr_buf,COMMENT_2("\t","\tEND diag_info key %d"),d->key);
-
 
355
  outs(expr_buf);
-
 
356
  outnl();
-
 
357
 
-
 
358
  if (d -> key != DIAG_INFO_SOURCE && props(e) & 0x80)
-
 
359
  {
-
 
360
    OUT_DWARF_END(POP_LEX_BLK);
-
 
361
    CHK_LEX_STK;
-
 
362
    end_sib_chain();
-
 
363
  }
-
 
364
}
388
}
365
 
389
 
366
#endif
390
#endif
367
 
-
 
368
 
-