Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**********************************************************************
32
$Author: release $
33
$Date: 1998/02/04 10:43:38 $
34
$Revision: 1.2 $
35
$Log: dwarf_out.c,v $
36
 * Revision 1.2  1998/02/04  10:43:38  release
37
 * Changes during testing.
38
 *
39
 * Revision 1.1.1.1  1998/01/17  15:55:47  release
40
 * First version to be checked into rolling release.
41
 *
42
 * Revision 1.5  1997/03/24  12:44:29  pwe
43
 * outn int->long
44
 *
45
 * Revision 1.4  1997/02/19  12:53:47  pwe
46
 * NEWDIAGS for debugging optimised code
47
 *
48
 * Revision 1.3  1995/09/28  12:39:48  pwe
49
 * dwarf.h via import, and type changes for tcc checks
50
 *
51
 * Revision 1.2  1995/09/13  14:25:38  pwe
52
 * tidy for gcc
53
 *
54
 * Revision 1.1.1.1  1995/08/14  14:30:23  pwe
55
 * transferred from DJCH
56
 *
57
**********************************************************************/
58
 
59
/* extra fns for writing DWARF info */
60
/* LOG 6/9/93 changes for sparc/ICL port of SVR4.2 djch
61
   */
62
/* LOG 7/9/93 this will only compile with -Ycommon, assuming 32 bit int
63
   makes life a lot easier djch. several changes of long to int to
64
   get weak prototypes to work */
65
/* LOG 25/11/93 removed redundant labbufe djch */
66
 
67
#include "config.h"
68
#include "common_types.h"
69
#include "installtypes.h"
70
#include "machine.h"
71
 
72
/* machine dependant */
73
#include "out.h"
74
 
75
#include "diagglob.h"
76
#include "diagtypes.h"
77
#include "basicread.h"
78
 
79
/* machine dependant */
80
#include "expmacs.h"
81
 
82
#include "shapemacs.h"
83
 
84
#include "xalloc.h"
85
#include "dwarf_types.h"
86
#include "dwarf_loc.h"
87
#include "dwarf_mc.h"
88
#include "dwarf_out.h"
89
#include "cross_config.h"
90
#ifdef NEWDIAGS
91
#include "tags.h"
92
#endif
93
 
94
#ifndef CROSS_INCLUDE
95
#include <dwarf.h>
96
#else
97
#include CROSS_INCLUDE/dwarf.h>
98
#endif
99
 
100
#define WHOLE_LINE ( 0xffff)	/* this should be in dwarf.h */
101
#define WHOLE_SECT ( 0)		/* this should be in dwarf.h */
102
 
103
#if issparc
104
#define DWARF_NAME "D"
105
#else
106
#define DWARF_NAME "dwf"
107
#endif
108
 
109
#if (is80x86)
110
static char * nl80x86 = "\n";
111
#define outnl()	outs(nl80x86)	/* avoid side effects of 80x86 outnl */
112
#endif
113
 
114
void out_dwarf_lab
115
    PROTO_N ( (l) )
116
    PROTO_T ( H_dwarf_lab *l )
117
{
118
  if (OUT_FLAG(*l) !=0)
119
  {
120
    failer("attempt to re_output dwarf label");
121
    exit(EXIT_FAILURE);
122
  }
123
  OUT_FLAG(*l) = (char)1;
124
  outs(LAB2CHAR(*l));
125
  outc(':');
126
  outnl();
127
}
128
 
129
static void mk_dwarf_label
130
    PROTO_N ( (p,x) )
131
    PROTO_T ( dwarf_label *p X CONST char *x )
132
{
133
  sprintf(LAB2CHAR(p->beg),"%s%s%s",local_prefix,DWARF_NAME,x);
134
  OUT_FLAG(p->beg) = 0;
135
  sprintf(LAB2CHAR(p->end),"%s%s%s.e",local_prefix,DWARF_NAME,x);
136
  OUT_FLAG(p->end) = 0;
137
}
138
 
139
void next_dwarf_lab
140
    PROTO_N ( (p) )
141
    PROTO_T ( dwarf_label *p )
142
{
143
  static unsigned long next_dwarf_lab_no = 0;
144
  char num_buf[DWARF_LAB_LEN];
145
 
146
  sprintf(num_buf,"%ld",next_dwarf_lab_no++);
147
  mk_dwarf_label(p,num_buf);
148
}
149
 
150
dwarf_type_label * next_dwarf_type_lab
151
    PROTO_Z ()
152
{
153
  dwarf_type_label * ptr = (dwarf_type_label *)
154
    xcalloc(1,sizeof (dwarf_type_label));
155
 
156
  static unsigned long next_dwarf_type_lab_no = 0;
157
 
158
  sprintf(LAB2CHAR(*ptr),"%s%sT%ld",local_prefix,DWARF_NAME,
159
	  next_dwarf_type_lab_no++);
160
  return ptr;
161
}
162
 
163
#if (is80x86)
164
#define GO_DWARF	outs("\t.section\t.debug");outnl()
165
#define GO_LINE		outs("\t.section\t.line");outnl()
166
#define LEAVE_DWARF	outs("\t.previous");outnl()
167
#define LEAVE_LINE	LEAVE_DWARF
168
#define BYTE4S		".4byte"
169
#define BYTE2S		".2byte"
170
#define BYTE		".byte"
171
#define STRING		".string"
172
#define TEXT_SEG 	".text"
173
#define END_UNIT_ALIGN  ".align 4"
174
#define SUB3_F		"[ %s - %s] - %s\t"
175
#else
176
#if (issparc)
177
 
178
#define GO_DWARF	outs("\t.pushsection\t\".debug\"");outnl()
179
#define GO_LINE		outs("\t.pushsection\t\".line\"");outnl()
180
#define LEAVE_DWARF	outs("\t.popsection");outnl()
181
#define LEAVE_LINE	LEAVE_DWARF
182
#define BYTE4S		".uaword"
183
#define BYTE2S		".uahalf"
184
#define BYTE		".byte"
185
#define STRING		".asciz"
186
#define TEXT_SEG 	".section \".text\""
187
#define END_UNIT_ALIGN  ".align 4"
188
#define SUB3_F		"(%s - %s) - %s\t"
189
 
190
#else
191
error need elf section swapping code
192
#endif
193
#endif
194
 
195
#if FS_CONCAT_STRING
196
 
197
#define BYTE4_F "\t"BYTE4S"\t%s"
198
#define BYTE2_CMT_F "\t"BYTE2S COMMENT_2("\t%#x\t","%s")
199
#define BYTE2_F "\t"BYTE2S"\t%s"
200
#define BYTE_CMT_F "\t"BYTE COMMENT_2("\t%#x\t","%s")
201
#define STRING_M "\t"STRING"\t"
202
#define STRING_F STRING_M"\"%s\""
203
#define END_UNIT "\t"END_UNIT_ALIGN
204
 
205
#else
206
#if (issparc)
207
/* KEEP these in step.......... */
208
#define BYTE4_F "\t.uaword\t%s"
209
#define BYTE2_CMT_F "\t.uahalf\t%#x\t!%s"
210
#define BYTE2_F "\t.uahalf\t%s"
211
#define BYTE_CMT_F "\t.byte\t%#x\t!%s"
212
#define STRING_M "\t.asciz\t"
213
#define STRING_F "\t.asciz\t\"%s\""
214
#define END_UNIT "\t.align 4"
215
#else
216
#if (is80x86)
217
#define BYTE4_F "\t.4byte\t%s"
218
#define BYTE2_CMT_F "\t.2byte\t%#x\t!%s"
219
#define BYTE2_F "\t.2byte\t%s"
220
#define BYTE_CMT_F "\t.byte\t%#x\t!%s"
221
#define STRING_M "\t.string\t"
222
#define STRING_F "\t.string\t\"%s\""
223
#define END_UNIT "\t.align 4"
224
#else
225
error not yet written
226
#endif
227
#endif
228
#endif
229
 
230
void dwarf4
231
    PROTO_N ( (t) )
232
    PROTO_T ( CONST char *t )
233
{
234
  char outbuf[100];
235
 
236
  sprintf(outbuf,BYTE4_F,t);
237
 
238
  outs(outbuf);
239
  outnl();
240
}
241
 
242
void dwarf4n
243
    PROTO_N ( (x) )
244
    PROTO_T ( int x )
245
{
246
  char outbuf[100];
247
 
248
  sprintf(outbuf,"%#x",x);
249
  dwarf4(outbuf);
250
}
251
 
252
void out_dwarf_thing
253
    PROTO_N ( (t,cmt) )
254
    PROTO_T ( int t X char *cmt )
255
{
256
  char outbuf[100];
257
 
258
  if (t > 0xffff)
259
    failer("value too big for .2byte constant in out_dwarf_thing");
260
 
261
  sprintf(outbuf,BYTE2_CMT_F,t,cmt);
262
  outs(outbuf);
263
  outnl();
264
}
265
 
266
void out_dwarf_string
267
    PROTO_N ( (s) )
268
    PROTO_T ( CONST char * CONST s )
269
{
270
  /* s = null term'ed in core and to be in asm file */
271
  char outbuf[100];
272
 
273
  sprintf(outbuf,STRING_F,s);
274
  outs(outbuf);
275
  outnl();
276
}
277
 
278
void dwarf2
279
    PROTO_N ( (c) )
280
    PROTO_T ( char *c )
281
{
282
  char outbuf[100];
283
 
284
  sprintf(outbuf,BYTE2_F,c);
285
  outs(outbuf);
286
  outnl();
287
}
288
 
289
void out_dwarfone
290
    PROTO_N ( (t,cmt) )
291
    PROTO_T ( int t X char *cmt )
292
{
293
  char outbuf[100];
294
 
295
  sprintf(outbuf,BYTE_CMT_F,t,cmt);
296
  outs(outbuf);
297
  outnl();
298
}
299
 
300
static dwarf_label 	dwarf_blk_stk[100];
301
static unsigned int 	dwarf_blk_stk_ptr=0;
302
 
303
void enter_dwarf_blk
304
    PROTO_N ( (four,exclusive,lb) )
305
    PROTO_T ( int four X int exclusive X dwarf_label *lb )
306
{
307
				/* switch to debug section, put out begin
308
				 label and length expr */
309
  char exprbuf[100];
310
 
311
  dwarf_blk_stk[dwarf_blk_stk_ptr++] = *lb;
312
				/* the block stack is used for nested
313
				 dwarf blocks, not for sibling structure */
314
 
315
  if (four)			/* two byte block are already in debug */
316
    GO_DWARF;
317
 
318
  OUT_DWARF_BEG(lb);
319
  if (exclusive)
320
    sprintf(exprbuf,COMMENT_2(SUB3_F," excl. entry len")
321
	    ,lb->end,lb->beg,
322
	    four ? "4":"2");
323
  else
324
    sprintf(exprbuf,COMMENT_2("%s-%s\t"," entry len"),lb->end,lb->beg);
325
  if (four)
326
    dwarf4(exprbuf);
327
  else
328
    dwarf2(exprbuf);
329
}
330
 
331
void leave_dwarf_blk1
332
    PROTO_N ( (leave) )
333
    PROTO_T ( int leave )
334
{
335
  if (dwarf_blk_stk_ptr == 0)
336
    failer("dwarf stack underflow");
337
  {
338
    dwarf_label *lb = &dwarf_blk_stk[--dwarf_blk_stk_ptr];
339
 
340
    OUT_DWARF_END(lb);
341
    if (leave)
342
      LEAVE_DWARF;
343
  }
344
}
345
 
346
char * current_label_name
347
    PROTO_Z ()
348
{
349
  return LAB2CHAR(dwarf_blk_stk[dwarf_blk_stk_ptr - 1].beg);
350
}
351
 
352
 
353
void new_dwarf_blk2
354
    PROTO_Z ()
355
{
356
  dwarf_label lb;
357
  next_dwarf_lab(&lb);
358
 
359
  enter_dwarf_blk(0,1,&lb);
360
}
361
 
362
void new_dwarf_blk4
363
    PROTO_Z ()
364
{
365
  dwarf_label lb;
366
  next_dwarf_lab(&lb);
367
 
368
  enter_dwarf_blk(1,1,&lb);
369
}
370
 
371
static dwarf_label text_range;
372
static dwarf_label line_range;
373
 
374
void out_diagnose_prelude
375
    PROTO_Z ()
376
{
377
 
378
  char exprbuf[100];
379
 
380
  mk_dwarf_label(&text_range,"text");
381
  mk_dwarf_label(&line_range,"line");
382
 
383
  outs(TEXT_SEG);
384
  outnl();
385
  OUT_DWARF_BEG(&text_range);
386
  GO_DWARF;
387
  LEAVE_DWARF;
388
  GO_LINE;
389
  LEAVE_LINE;
390
 
391
  GO_LINE;
392
  OUT_DWARF_BEG(&line_range);
393
  sprintf(exprbuf,"%s-%s",line_range.end,line_range.beg);
394
  dwarf4(exprbuf);
395
  dwarf4(text_range.beg);
396
  LEAVE_LINE;
397
  enter_dwarf_comp_unit();
398
 
399
}
400
 
401
void out_diagnose_postlude
402
    PROTO_Z ()
403
{
404
  char exprbuf[100];
405
 
406
  leave_dwarf_comp_unit();
407
 
408
  outs(TEXT_SEG);
409
  outnl();
410
  OUT_DWARF_END(&text_range);
411
  GO_LINE;
412
  dwarf4n(WHOLE_SECT);			/* line 0 means whole section */
413
  dwarf2c(WHOLE_LINE);
414
  sprintf(exprbuf,"%s-%s",text_range.end,text_range.beg);
415
  dwarf4(exprbuf);
416
  OUT_DWARF_END(&line_range);
417
  LEAVE_LINE;
418
}
419
 
420
static filename main_filename;
421
 
422
void out_dwarf_sourcemark
423
    PROTO_N ( (x) )
424
    PROTO_T ( CONST sourcemark * CONST x )
425
{
426
  dwarf_label lb;
427
 
428
  if (x->file != main_filename)
429
  {
430
/*    fprintf(stderr,"Sourcemark for file %s cannot be used\n",
431
	    TDFSTRING2CHAR(x->file->file));*/
432
    return;
433
  }
434
 
435
  next_dwarf_lab(&lb);
436
  OUT_DWARF_BEG(&lb);		/* note this label is in TEXT space */
437
 
438
  GO_LINE;
439
  dwarf4n((int)x->line_no.nat_val.small_nat);
440
  if ((x->char_off.nat_val.small_nat) == 0)
441
    out_dwarf_thing(WHOLE_LINE,"no source pos");
442
  else
443
    out_dwarf_thing((int)x->char_off.nat_val.small_nat,"source pos");
444
  {
445
    char expr_buf[100];
446
 
447
    sprintf(expr_buf,"%s - %s",LAB2CHAR(lb.beg),LAB2CHAR(text_range.beg));
448
    dwarf4(expr_buf);
449
  }
450
  LEAVE_LINE;
451
}
452
 
453
static dwarf_label 	dwarf_sib_stk[100];
454
static int	 	dwarf_sib_stk_ptr= -1;
455
/* static dwarf_label	underflow_lab = {"underflow","undeflow.e"};*/
456
 
457
#define SIB_TOS	        (dwarf_sib_stk[dwarf_sib_stk_ptr])
458
#define SIB_PUSH	(dwarf_sib_stk[++dwarf_sib_stk_ptr])
459
#define SIB_POP		(--dwarf_sib_stk_ptr)
460
 
461
/* ((dwarf_sib_stk_ptr) ==0 ? failer("sib stack underflow"), underflow_lab */
462
 
463
void start_sib_chain1
464
    PROTO_N ( (d_tag,tag_name) )
465
    PROTO_T ( int d_tag X char *tag_name )
466
{
467
				/* generate new label
468
				 enter blk for new label
469
				 gen sib label
470
				 push sib label
471
				 gen sib chain */
472
  dwarf_label chain_head;
473
  next_dwarf_lab(&chain_head);
474
 
475
  enter_dwarf_entry(&chain_head);
476
  next_dwarf_lab(&SIB_PUSH);
477
 
478
  OUT_DWARF_TAG_NAMED(d_tag,tag_name);
479
  outs(COMMENT_2("\t"," new sibling chain level "));
480
  outn((long)dwarf_sib_stk_ptr);
481
  outnl();
482
  OUT_DWARF_ATTR(AT_sibling);
483
  dwarf4(SIB_TOS.beg);
484
}
485
 
486
void make_next_new_chain
487
    PROTO_Z ()
488
{
489
  /* simulate entering next level */
490
  next_dwarf_lab(&SIB_PUSH);
491
}
492
 
493
void cont_sib_chain1
494
    PROTO_N ( (d_tag,tag_name) )
495
    PROTO_T ( int d_tag X char *tag_name )
496
{
497
				/* enter blk for TOS
498
				 gen sib label
499
				 setq TOS sib label
500
				 gen sib chain */
501
  enter_dwarf_entry(&SIB_TOS);
502
  next_dwarf_lab(&SIB_TOS);
503
  outs(COMMENT_2("\t"," sibling chain level "));
504
  outn((long)dwarf_sib_stk_ptr);
505
  outnl();
506
 
507
  OUT_DWARF_TAG_NAMED(d_tag,tag_name);
508
  OUT_DWARF_ATTR(AT_sibling);
509
  dwarf4(SIB_TOS.beg);
510
}
511
 
512
void end_sib_chain
513
    PROTO_Z ()
514
{
515
				/* enter blk for TOS
516
				   gen dummy blk
517
				   pop stack
518
				   leave blk */
519
  enter_dwarf_entry(&SIB_TOS);
520
  outs(COMMENT_2("\t"," end sibling chain level "));
521
  outn((long)dwarf_sib_stk_ptr);
522
  outnl();
523
  leave_dwarf_blk();
524
  SIB_POP;
525
}
526
 
527
static void end_toplevel_chain
528
    PROTO_Z ()
529
{
530
				/* just put out the label */
531
  GO_DWARF;
532
  OUT_DWARF_BEG(&SIB_TOS);
533
  outs(COMMENT_2("\t"," end toplevel chain"));
534
  outnl();
535
  LEAVE_DWARF;
536
  SIB_POP;
537
}
538
 
539
				/* HACK to get a filename */
540
static long name_space;
541
 
542
static char *first_filename = (char *) 0;
543
 
544
void dwarf_inspect_filename
545
    PROTO_N ( (f) )
546
    PROTO_T ( filename f )
547
{
548
  if (first_filename)
549
    return;
550
  {
551
    char * str = TDFSTRING2CHAR(f->file);
552
    char *lastdot = strrchr(str,'.');
553
 
554
    if (!lastdot)
555
      return;			/* no dot in name */
556
 
557
    if (lastdot[1] != 'h')
558
    {
559
      first_filename = (char *) xcalloc(1,strlen(str) + 1);
560
				/* +1 for null ending */
561
      strcpy(first_filename,str);
562
 
563
      main_filename = f;	/* note this to validate sourcemarks */
564
 
565
      fflush(fpout);
566
      {
567
	long old_tell = ftell(fpout);
568
 
569
	fseek(fpout,name_space,SEEK_SET);
570
	outc('"'); outs(str); outc('"');
571
	fseek(fpout,old_tell,SEEK_SET);
572
      }
573
    }
574
  }
575
}
576
 
577
extern char *crt_filename;
578
 
579
static void maybe_fix_filename
580
    PROTO_Z ()
581
{
582
  char name_buf[100];
583
  char * last_dot;
584
 
585
  if (first_filename)		/* seen a .c already */
586
    return;
587
 
588
  if (crt_filename == NULL)
589
    name_buf[0] = '\0';
590
  else
591
    strcpy(name_buf,crt_filename);
592
 
593
  if (strlen(name_buf) > 0)
594
  {
595
    last_dot = strrchr(name_buf,'.');
596
 
597
    if (last_dot)
598
      last_dot[1] = 'c';
599
    else
600
      strcpy(name_buf,"UNKNOWN_SUFFIX.c");
601
  }
602
  else
603
    strcpy(name_buf,"UNKNOWN_FILE.c");
604
 
605
  fflush(fpout);
606
  {
607
    long old_tell = ftell(fpout);
608
 
609
    fseek(fpout,name_space,SEEK_SET);
610
    outc('"'); outs(name_buf); outc('"');
611
    fseek(fpout,old_tell,SEEK_SET);
612
  }
613
}
614
 
615
void enter_dwarf_comp_unit
616
    PROTO_Z ()
617
{
618
 start_sib_chain(TAG_compile_unit);
619
  OUT_DWARF_ATTR(AT_name);
620
  outs(STRING_M);
621
  fflush(fpout);
622
  name_space = ftell(fpout);
623
  outs("                                                                    ");
624
  outs("                                                                    ");
625
  outnl();
626
  OUT_DWARF_ATTR(AT_language);
627
  dwarf4n((int)LANG_C89);
628
  OUT_DWARF_ATTR(AT_low_pc);
629
  dwarf4(LAB2CHAR(text_range.beg));
630
  OUT_DWARF_ATTR(AT_high_pc);
631
  dwarf4(LAB2CHAR(text_range.end));
632
  OUT_DWARF_ATTR(AT_stmt_list);
633
  dwarf4(LAB2CHAR(line_range.beg));
634
  leave_dwarf_blk();
635
 
636
  make_next_new_chain();
637
}
638
 
639
 
640
#include "dwarf_type.h"
641
#include "dwarf_queue.h"
642
 
643
 
644
void leave_dwarf_comp_unit
645
    PROTO_Z ()
646
{
647
  dump_type_q();
648
  end_sib_chain();		/* end sib chain below comp unit */
649
 
650
  {
651
    dwarf_label lb;
652
    next_dwarf_lab(&lb);
653
 
654
    enter_dwarf_blk(1,0,&lb);
655
    outs(END_UNIT);
656
    outnl();
657
    leave_dwarf_blk();
658
  }
659
 
660
  end_toplevel_chain();		/* sib of comp unit */
661
  maybe_fix_filename();
662
}
663
 
664
void out_dwarf_name_attr
665
    PROTO_N ( (s) )
666
    PROTO_T ( CONST char * CONST s )
667
{
668
  if (*s == 0)
669
  {
670
    outs(COMMENT_2("\t"," no source name"));
671
    outnl();
672
    return;
673
  }
674
  OUT_DWARF_ATTR(AT_name);
675
  out_dwarf_string(s);
676
}
677
 
678
void out_dwarf_bytesize_attr
679
    PROTO_N ( (t) )
680
    PROTO_T ( shape t )
681
{
682
  OUT_DWARF_ATTR(AT_byte_size);
683
  dwarf4n((int)(shape_size(t)/8));
684
}
685
 
686
 
687
static void dwarf_out_descriptor
688
    PROTO_N ( (x) )
689
    PROTO_T ( diag_descriptor *x )
690
{
691
  switch(x->key)
692
  {
693
   case DIAG_ID_KEY:
694
    {
695
      exp acc = x->data.id.access;
696
      exp t = son(acc);
697
#ifdef NEWDIAGS
698
      if (name(acc) != hold_tag) {
699
	failer("access should be in hold");
700
	break;
701
      };
702
      acc = son(acc);
703
      if (name(acc) == cont_tag && name(son(acc)) == name_tag && isvar(son(son(acc))))
704
	acc = son(acc);
705
      if (name(acc) != name_tag) {
706
	failer("not name_tag");
707
	break;
708
      };
709
      t = son(acc);
710
#endif
711
 
712
      if (!isvar(brog(t)->dec_u.dec_val.dec_exp)
713
	  && (name(brog(t)->dec_u.dec_val.dec_shape) == prokhd))
714
/*	fprintf(stderr,"%s was a proc\n",TDFSTRING2CHAR(x->data.id.nme));*/
715
	break;
716
      else
717
      {
718
	if (isparam(t))
719
	  failer("out descriptor for parameter variable");
720
	if (!brog(t)->dec_u.dec_val.extnamed)
721
	  cont_sib_chain(TAG_local_variable);
722
	else
723
	  cont_sib_chain(TAG_global_variable);
724
 
725
	out_dwarf_name_attr(TDFSTRING2CHAR(x->data.id.nme));
726
	out_dwarf_type_attr(x->data.id.new_type);
727
	out_dwarf_loc_attr(acc,-1);
728
	/* -1 for proc_no, since outside any proc */
729
	leave_dwarf_blk();
730
      }
731
      break;
732
    }
733
   case DIAG_STRUCT_KEY:
734
    fprintf(stderr,"Not yet doing desc key %d name %s\n",x->key,
735
	    TDFSTRING2CHAR(x->data.id.nme));
736
    break;
737
   case DIAG_TYPEDEF_KEY:
738
    if ((base_type(x->data.typ.new_type))->key == DIAG_TYPE_INITED)
739
    {
740
/*      fprintf(stderr,"No diagtype defn provided for %s... omitting typedef\n",
741
	      TDFSTRING2CHAR(x->data.typ.nme)); */
742
      break;
743
    }
744
    cont_sib_chain(TAG_typedef);
745
    out_dwarf_name_attr(TDFSTRING2CHAR(x->data.typ.nme));
746
    out_dwarf_type_attr(x->data.typ.new_type);
747
    leave_dwarf_blk();
748
    break;
749
   default:
750
    failer("Unknown descriptor");
751
  }
752
}
753
 
754
 
755
void out_dwarf_global_list
756
    PROTO_Z ()
757
{
758
  int i;
759
 
760
/*  fprintf(stderr,"diagvartab len %d used %d\n",unit_diagvar_tab.len,
761
	  unit_diagvar_tab.lastused); */
762
  outs(COMMENT_2("\t","\tdumping global list"));
763
  outnl();
764
  for(i=0;i<unit_diagvar_tab.lastused;i++)
765
    dwarf_out_descriptor(&(unit_diagvar_tab.array[i]));
766
  dump_type_q();
767
}
768
 
769
void out_dwarf_diag_tags
770
    PROTO_Z ()	/* maybe put out unused ones later */
771
{
772
  return;
773
}
774
 
775
 
776
dwarf_global *new_dwarf_global
777
    PROTO_N ( (d) )
778
    PROTO_T ( diag_descriptor * d )
779
{
780
  dwarf_global * new = (dwarf_global *) xcalloc(1,sizeof(dwarf_global));
781
 
782
  new->desc = d;
783
 
784
  return new;
785
}