1 /* Stack unwinding code based on dwarf2 frame info for GDB, the GNU debugger.
2 Copyright 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Jiri Smid, SuSE Labs.
4 Based on code written by Daniel Berlin (dan@dberlin.org).
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
29 #include "elf/dwarf2.h"
32 #include "dwarf2cfi.h"
34 /* Common Information Entry - holds information that is shared among many
38 /* Offset of this unit in .debug_frame or .eh_frame. */
41 /* A null-terminated string that identifies the augmentation to this CIE or
42 to the FDEs that use it. */
45 /* A constant that is factored out of all advance location instructions. */
46 unsigned int code_align
;
48 /* A constant that is factored out of all offset instructions. */
51 /* A constant that indicates which regiter represents the return address
55 /* Indicates how addresses are encoded. */
56 unsigned char addr_encoding
;
58 /* Pointer and length of the cie program. */
60 unsigned int data_length
;
62 struct objfile
*objfile
;
65 struct cie_unit
*next
;
68 /* Frame Description Entry. */
71 /* Address of the first location associated with this entry. */
72 CORE_ADDR initial_location
;
74 /* Length of program section described by this entry. */
75 CORE_ADDR address_range
;
77 /* Pointer to asociated CIE. */
78 struct cie_unit
*cie_ptr
;
80 /* Pointer and length of the cie program. */
82 unsigned int data_length
;
87 struct fde_unit
**array
;
104 REG_CTX_SAVED_OFFSET
,
112 /* This is the register and unwind state for a particular frame. */
115 struct context_reg
*reg
;
123 struct frame_state_reg
144 /* Each register save state can be described in terms of a CFA slot,
145 another register, or a location expression. */
146 struct frame_state_regs
148 struct frame_state_reg
*reg
;
150 /* Used to implement DW_CFA_remember_state. */
151 struct frame_state_regs
*prev
;
155 /* The CFA can be described in terms of a reg+offset or a
156 location expression. */
159 unsigned char *cfa_exp
;
168 /* The PC described by the current frame state. */
171 /* The information we care about from the CIE/FDE. */
173 unsigned int code_align
;
174 unsigned char retaddr_column
;
175 unsigned char addr_encoding
;
177 struct objfile
*objfile
;
182 PE_absptr
= DW_EH_PE_absptr
,
183 PE_pcrel
= DW_EH_PE_pcrel
,
184 PE_textrel
= DW_EH_PE_textrel
,
185 PE_datarel
= DW_EH_PE_datarel
,
186 PE_funcrel
= DW_EH_PE_funcrel
189 #define UNWIND_CONTEXT(fi) ((struct context *) (fi->context))
192 static struct cie_unit
*cie_chunks
;
193 static struct fde_array fde_chunks
;
194 /* Obstack for allocating temporary storage used during unwind operations. */
195 static struct obstack unwind_tmp_obstack
;
197 extern file_ptr dwarf_frame_offset
;
198 extern unsigned int dwarf_frame_size
;
199 extern file_ptr dwarf_eh_frame_offset
;
200 extern unsigned int dwarf_eh_frame_size
;
203 extern char *dwarf2_read_section (struct objfile
*objfile
, file_ptr offset
,
206 static struct fde_unit
*fde_unit_alloc (void);
207 static struct cie_unit
*cie_unit_alloc (void);
208 static void fde_chunks_need_space ();
210 static struct context
*context_alloc ();
211 static struct frame_state
*frame_state_alloc ();
212 static void unwind_tmp_obstack_init ();
213 static void unwind_tmp_obstack_free ();
214 static void context_cpy (struct context
*dst
, struct context
*src
);
216 static unsigned int read_1u (bfd
* abfd
, char **p
);
217 static int read_1s (bfd
* abfd
, char **p
);
218 static unsigned int read_2u (bfd
* abfd
, char **p
);
219 static int read_2s (bfd
* abfd
, char **p
);
220 static unsigned int read_4u (bfd
* abfd
, char **p
);
221 static int read_4s (bfd
* abfd
, char **p
);
222 static ULONGEST
read_8u (bfd
* abfd
, char **p
);
223 static LONGEST
read_8s (bfd
* abfd
, char **p
);
225 static ULONGEST
read_uleb128 (bfd
* abfd
, char **p
);
226 static LONGEST
read_sleb128 (bfd
* abfd
, char **p
);
227 static CORE_ADDR
read_pointer (bfd
* abfd
, char **p
);
228 static CORE_ADDR
read_encoded_pointer (bfd
* abfd
, char **p
,
229 unsigned char encoding
);
230 static enum ptr_encoding
pointer_encoding (unsigned char encoding
);
232 static LONGEST
read_initial_length (bfd
* abfd
, char *buf
, int *bytes_read
);
233 static ULONGEST
read_length (bfd
* abfd
, char *buf
, int *bytes_read
,
236 static int is_cie (ULONGEST cie_id
, int dwarf64
);
237 static int compare_fde_unit (const void *a
, const void *b
);
238 void dwarf2_build_frame_info (struct objfile
*objfile
);
240 static void execute_cfa_program (struct objfile
*objfile
, char *insn_ptr
,
241 char *insn_end
, struct context
*context
,
242 struct frame_state
*fs
);
243 static struct fde_unit
*get_fde_for_addr (CORE_ADDR pc
);
244 static void frame_state_for (struct context
*context
, struct frame_state
*fs
);
245 static void get_reg (char *reg
, struct context
*context
, int regnum
);
246 static CORE_ADDR
execute_stack_op (struct objfile
*objfile
,
247 char *op_ptr
, char *op_end
,
248 struct context
*context
,
250 static void update_context (struct context
*context
, struct frame_state
*fs
,
254 /* Memory allocation functions. */
255 static struct fde_unit
*
256 fde_unit_alloc (void)
258 struct fde_unit
*fde
;
260 fde
= (struct fde_unit
*) xmalloc (sizeof (struct fde_unit
));
261 memset (fde
, 0, sizeof (struct fde_unit
));
265 static struct cie_unit
*
266 cie_unit_alloc (void)
268 struct cie_unit
*cie
;
270 cie
= (struct cie_unit
*) xmalloc (sizeof (struct cie_unit
));
271 memset (cie
, 0, sizeof (struct cie_unit
));
276 fde_chunks_need_space ()
278 if (fde_chunks
.elems
< fde_chunks
.array_size
)
280 fde_chunks
.array_size
=
281 fde_chunks
.array_size
? 2 * fde_chunks
.array_size
: 1024;
283 xrealloc (fde_chunks
.array
,
284 sizeof (struct fde_unit
) * fde_chunks
.array_size
);
287 /* Alocate a new `struct context' on temporary obstack. */
288 static struct context
*
291 struct context
*context
;
293 int regs_size
= sizeof (struct context_reg
) * NUM_REGS
;
295 context
= (struct context
*) obstack_alloc (&unwind_tmp_obstack
,
296 sizeof (struct context
));
297 memset (context
, 0, sizeof (struct context
));
298 context
->reg
= (struct context_reg
*) obstack_alloc (&unwind_tmp_obstack
,
300 memset (context
->reg
, 0, regs_size
);
304 /* Alocate a new `struct frame_state' on temporary obstack. */
305 static struct frame_state
*
308 struct frame_state
*fs
;
310 int regs_size
= sizeof (struct frame_state_reg
) * NUM_REGS
;
312 fs
= (struct frame_state
*) obstack_alloc (&unwind_tmp_obstack
,
313 sizeof (struct frame_state
));
314 memset (fs
, 0, sizeof (struct frame_state
));
316 (struct frame_state_reg
*) obstack_alloc (&unwind_tmp_obstack
, regs_size
);
317 memset (fs
->regs
.reg
, 0, regs_size
);
322 unwind_tmp_obstack_init ()
324 obstack_init (&unwind_tmp_obstack
);
328 unwind_tmp_obstack_free ()
330 obstack_free (&unwind_tmp_obstack
, NULL
);
331 unwind_tmp_obstack_init ();
335 context_cpy (struct context
*dst
, struct context
*src
)
337 int regs_size
= sizeof (struct context_reg
) * NUM_REGS
;
338 struct context_reg
*dreg
;
340 /* Structure dst contains a pointer to an array of
341 * registers of a given frame as well as src does. This
342 * array was already allocated before dst was passed to
343 * context_cpy but the pointer to it was overriden by
344 * '*dst = *src' and the array was lost. This led to the
345 * situation, that we've had a copy of src placed in dst,
346 * but both of them pointed to the same regs array and
347 * thus we've sometimes blindly rewritten it. Now we save
348 * the pointer before copying src to dst, return it back
349 * after that and copy the registers into their new place
350 * finally. --- mludvig@suse.cz */
355 memcpy (dst
->reg
, src
->reg
, regs_size
);
359 read_1u (bfd
* abfd
, char **p
)
363 ret
= bfd_get_8 (abfd
, (bfd_byte
*) * p
);
369 read_1s (bfd
* abfd
, char **p
)
373 ret
= bfd_get_signed_8 (abfd
, (bfd_byte
*) * p
);
379 read_2u (bfd
* abfd
, char **p
)
383 ret
= bfd_get_16 (abfd
, (bfd_byte
*) * p
);
389 read_2s (bfd
* abfd
, char **p
)
393 ret
= bfd_get_signed_16 (abfd
, (bfd_byte
*) * p
);
399 read_4u (bfd
* abfd
, char **p
)
403 ret
= bfd_get_32 (abfd
, (bfd_byte
*) * p
);
409 read_4s (bfd
* abfd
, char **p
)
413 ret
= bfd_get_signed_32 (abfd
, (bfd_byte
*) * p
);
419 read_8u (bfd
* abfd
, char **p
)
423 ret
= bfd_get_64 (abfd
, (bfd_byte
*) * p
);
429 read_8s (bfd
* abfd
, char **p
)
433 ret
= bfd_get_signed_64 (abfd
, (bfd_byte
*) * p
);
439 read_uleb128 (bfd
* abfd
, char **p
)
450 byte
= bfd_get_8 (abfd
, (bfd_byte
*) * p
);
452 ret
|= ((unsigned long) (byte
& 127) << shift
);
453 if ((byte
& 128) == 0)
463 read_sleb128 (bfd
* abfd
, char **p
)
466 int i
, shift
, size
, num_read
;
476 byte
= bfd_get_8 (abfd
, (bfd_byte
*) * p
);
478 ret
|= ((long) (byte
& 127) << shift
);
480 if ((byte
& 128) == 0)
485 if ((shift
< size
) && (byte
& 0x40))
487 ret
|= -(1 << shift
);
493 read_pointer (bfd
* abfd
, char **p
)
495 switch (TARGET_ADDR_BIT
/ TARGET_CHAR_BIT
)
498 return read_4u (abfd
, p
);
500 return read_8u (abfd
, p
);
502 error ("dwarf cfi error: unsupported target address length.");
506 /* This functions only reads appropriate amount of data from *p
507 * and returns the resulting value. Calling function must handle
508 * different encoding possibilities itself! */
510 read_encoded_pointer (bfd
* abfd
, char **p
, unsigned char encoding
)
514 switch (encoding
& 0x0f)
516 case DW_EH_PE_absptr
:
517 ret
= read_pointer (abfd
, p
);
520 case DW_EH_PE_uleb128
:
521 ret
= read_uleb128 (abfd
, p
);
523 case DW_EH_PE_sleb128
:
524 ret
= read_sleb128 (abfd
, p
);
527 case DW_EH_PE_udata2
:
528 ret
= read_2u (abfd
, p
);
530 case DW_EH_PE_udata4
:
531 ret
= read_4u (abfd
, p
);
533 case DW_EH_PE_udata8
:
534 ret
= read_8u (abfd
, p
);
537 case DW_EH_PE_sdata2
:
538 ret
= read_2s (abfd
, p
);
540 case DW_EH_PE_sdata4
:
541 ret
= read_4s (abfd
, p
);
543 case DW_EH_PE_sdata8
:
544 ret
= read_8s (abfd
, p
);
548 internal_error (__FILE__
, __LINE__
,
549 "read_encoded_pointer: unknown pointer encoding");
555 /* Variable 'encoding' carries 3 different flags:
556 * - encoding & 0x0f : size of the address (handled in read_encoded_pointer())
557 * - encoding & 0x70 : type (absolute, relative, ...)
558 * - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80). */
560 pointer_encoding (unsigned char encoding
)
564 if (encoding
& DW_EH_PE_indirect
)
565 warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect");
567 switch (encoding
& 0x70)
569 case DW_EH_PE_absptr
:
571 case DW_EH_PE_textrel
:
572 case DW_EH_PE_datarel
:
573 case DW_EH_PE_funcrel
:
574 ret
= encoding
& 0x70;
577 internal_error (__FILE__
, __LINE__
, "CFI: unknown pointer encoding");
583 read_initial_length (bfd
* abfd
, char *buf
, int *bytes_read
)
587 ret
= bfd_get_32 (abfd
, (bfd_byte
*) buf
);
589 if (ret
== 0xffffffff)
591 ret
= bfd_get_64 (abfd
, (bfd_byte
*) buf
+ 4);
603 read_length (bfd
* abfd
, char *buf
, int *bytes_read
, int dwarf64
)
608 return read_8u (abfd
, &buf
);
613 return read_4u (abfd
, &buf
);
618 execute_cfa_program (struct objfile
*objfile
, char *insn_ptr
, char *insn_end
,
619 struct context
*context
, struct frame_state
*fs
)
621 struct frame_state_regs
*unused_rs
= NULL
;
623 /* Don't allow remember/restore between CIE and FDE programs. */
624 fs
->regs
.prev
= NULL
;
626 while (insn_ptr
< insn_end
&& fs
->pc
< context
->ra
)
628 unsigned char insn
= *insn_ptr
++;
629 ULONGEST reg
, uoffset
;
632 if (insn
& DW_CFA_advance_loc
)
633 fs
->pc
+= (insn
& 0x3f) * fs
->code_align
;
634 else if (insn
& DW_CFA_offset
)
637 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
638 offset
= (long) uoffset
*fs
->data_align
;
639 fs
->regs
.reg
[reg
].how
= REG_SAVED_OFFSET
;
640 fs
->regs
.reg
[reg
].loc
.offset
= offset
;
642 else if (insn
& DW_CFA_restore
)
645 fs
->regs
.reg
[reg
].how
= REG_UNSAVED
;
651 fs
->pc
= read_encoded_pointer (objfile
->obfd
, &insn_ptr
,
654 if (pointer_encoding (fs
->addr_encoding
) != PE_absptr
)
655 warning ("CFI: DW_CFA_set_loc uses relative addressing");
659 case DW_CFA_advance_loc1
:
660 fs
->pc
+= read_1u (objfile
->obfd
, &insn_ptr
);
662 case DW_CFA_advance_loc2
:
663 fs
->pc
+= read_2u (objfile
->obfd
, &insn_ptr
);
665 case DW_CFA_advance_loc4
:
666 fs
->pc
+= read_4u (objfile
->obfd
, &insn_ptr
);
669 case DW_CFA_offset_extended
:
670 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
671 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
672 offset
= (long) uoffset
*fs
->data_align
;
673 fs
->regs
.reg
[reg
].how
= REG_SAVED_OFFSET
;
674 fs
->regs
.reg
[reg
].loc
.offset
= offset
;
677 case DW_CFA_restore_extended
:
678 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
679 fs
->regs
.reg
[reg
].how
= REG_UNSAVED
;
682 case DW_CFA_undefined
:
683 case DW_CFA_same_value
:
687 case DW_CFA_register
:
690 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
691 reg2
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
692 fs
->regs
.reg
[reg
].how
= REG_SAVED_REG
;
693 fs
->regs
.reg
[reg
].loc
.reg
= reg2
;
697 case DW_CFA_remember_state
:
699 struct frame_state_regs
*new_rs
;
703 unused_rs
= unused_rs
->prev
;
706 new_rs
= xmalloc (sizeof (struct frame_state_regs
));
709 fs
->regs
.prev
= new_rs
;
713 case DW_CFA_restore_state
:
715 struct frame_state_regs
*old_rs
= fs
->regs
.prev
;
717 old_rs
->prev
= unused_rs
;
723 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
724 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
726 fs
->cfa_offset
= uoffset
;
727 fs
->cfa_how
= CFA_REG_OFFSET
;
730 case DW_CFA_def_cfa_register
:
731 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
733 fs
->cfa_how
= CFA_REG_OFFSET
;
736 case DW_CFA_def_cfa_offset
:
737 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
738 fs
->cfa_offset
= uoffset
;
741 case DW_CFA_def_cfa_expression
:
742 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
743 fs
->cfa_exp
= insn_ptr
;
744 fs
->cfa_how
= CFA_EXP
;
748 case DW_CFA_expression
:
749 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
750 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
751 fs
->regs
.reg
[reg
].how
= REG_SAVED_EXP
;
752 fs
->regs
.reg
[reg
].loc
.exp
= insn_ptr
;
756 /* From the 2.1 draft. */
757 case DW_CFA_offset_extended_sf
:
758 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
759 offset
= read_sleb128 (objfile
->obfd
, &insn_ptr
);
760 offset
*= fs
->data_align
;
761 fs
->regs
.reg
[reg
].how
= REG_SAVED_OFFSET
;
762 fs
->regs
.reg
[reg
].loc
.offset
= offset
;
765 case DW_CFA_def_cfa_sf
:
766 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
767 offset
= read_sleb128 (objfile
->obfd
, &insn_ptr
);
768 fs
->cfa_offset
= offset
;
770 fs
->cfa_how
= CFA_REG_OFFSET
;
773 case DW_CFA_def_cfa_offset_sf
:
774 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
775 fs
->cfa_offset
= uoffset
;
776 /* cfa_how deliberately not set. */
779 case DW_CFA_GNU_window_save
:
780 /* ??? Hardcoded for SPARC register window configuration. */
781 for (reg
= 16; reg
< 32; ++reg
)
783 fs
->regs
.reg
[reg
].how
= REG_SAVED_OFFSET
;
784 fs
->regs
.reg
[reg
].loc
.offset
= (reg
- 16) * sizeof (void *);
788 case DW_CFA_GNU_args_size
:
789 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
790 context
->args_size
= uoffset
;
793 case DW_CFA_GNU_negative_offset_extended
:
794 /* Obsoleted by DW_CFA_offset_extended_sf, but used by
795 older PowerPC code. */
796 reg
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
797 uoffset
= read_uleb128 (objfile
->obfd
, &insn_ptr
);
798 offset
= (long) uoffset
*fs
->data_align
;
799 fs
->regs
.reg
[reg
].how
= REG_SAVED_OFFSET
;
800 fs
->regs
.reg
[reg
].loc
.offset
= -offset
;
804 error ("dwarf cfi error: unknown cfa instruction %d.", insn
);
809 static struct fde_unit
*
810 get_fde_for_addr (CORE_ADDR pc
)
813 struct fde_unit
*fde
= NULL
;
815 hi
= fde_chunks
.elems
;
819 size_t i
= (lo
+ hi
) / 2;
820 fde
= fde_chunks
.array
[i
];
821 if (pc
< fde
->initial_location
)
823 else if (pc
>= fde
->initial_location
+ fde
->address_range
)
832 frame_state_for (struct context
*context
, struct frame_state
*fs
)
834 struct fde_unit
*fde
;
835 struct cie_unit
*cie
;
837 context
->args_size
= 0;
840 fde
= get_fde_for_addr (context
->ra
- 1);
845 fs
->pc
= fde
->initial_location
;
851 fs
->code_align
= cie
->code_align
;
852 fs
->data_align
= cie
->data_align
;
853 fs
->retaddr_column
= cie
->ra
;
854 fs
->addr_encoding
= cie
->addr_encoding
;
855 fs
->objfile
= cie
->objfile
;
857 execute_cfa_program (cie
->objfile
, cie
->data
,
858 cie
->data
+ cie
->data_length
, context
, fs
);
859 execute_cfa_program (cie
->objfile
, fde
->data
,
860 fde
->data
+ fde
->data_length
, context
, fs
);
863 internal_error (__FILE__
, __LINE__
,
864 "%s(): Internal error: fde->cie_ptr==NULL !", __func__
);
868 get_reg (char *reg
, struct context
*context
, int regnum
)
870 switch (context
->reg
[regnum
].how
)
872 case REG_CTX_UNSAVED
:
873 read_register_gen (regnum
, reg
);
875 case REG_CTX_SAVED_OFFSET
:
876 target_read_memory (context
->cfa
+ context
->reg
[regnum
].loc
.offset
,
877 reg
, REGISTER_RAW_SIZE (regnum
));
879 case REG_CTX_SAVED_REG
:
880 read_register_gen (context
->reg
[regnum
].loc
.reg
, reg
);
882 case REG_CTX_SAVED_ADDR
:
883 target_read_memory (context
->reg
[regnum
].loc
.addr
,
884 reg
, REGISTER_RAW_SIZE (regnum
));
887 memcpy (reg
, &context
->reg
[regnum
].loc
.addr
,
888 REGISTER_RAW_SIZE (regnum
));
891 internal_error (__FILE__
, __LINE__
, "get_reg: unknown register rule");
895 /* Decode a DW_OP stack program. Return the top of stack. Push INITIAL
896 onto the stack to start. */
898 execute_stack_op (struct objfile
*objfile
,
899 char *op_ptr
, char *op_end
, struct context
*context
,
902 CORE_ADDR stack
[64]; /* ??? Assume this is enough. */
908 while (op_ptr
< op_end
)
910 enum dwarf_location_atom op
= *op_ptr
++;
949 result
= op
- DW_OP_lit0
;
953 result
= read_pointer (objfile
->obfd
, &op_ptr
);
957 result
= read_1u (objfile
->obfd
, &op_ptr
);
960 result
= read_1s (objfile
->obfd
, &op_ptr
);
963 result
= read_2u (objfile
->obfd
, &op_ptr
);
966 result
= read_2s (objfile
->obfd
, &op_ptr
);
969 result
= read_4u (objfile
->obfd
, &op_ptr
);
972 result
= read_4s (objfile
->obfd
, &op_ptr
);
975 result
= read_8u (objfile
->obfd
, &op_ptr
);
978 result
= read_8s (objfile
->obfd
, &op_ptr
);
981 result
= read_uleb128 (objfile
->obfd
, &op_ptr
);
984 result
= read_sleb128 (objfile
->obfd
, &op_ptr
);
1019 get_reg ((char *) &result
, context
, op
- DW_OP_reg0
);
1022 reg
= read_uleb128 (objfile
->obfd
, &op_ptr
);
1023 get_reg ((char *) &result
, context
, reg
);
1058 offset
= read_sleb128 (objfile
->obfd
, &op_ptr
);
1059 get_reg ((char *) &result
, context
, op
- DW_OP_breg0
);
1063 reg
= read_uleb128 (objfile
->obfd
, &op_ptr
);
1064 offset
= read_sleb128 (objfile
->obfd
, &op_ptr
);
1065 get_reg ((char *) &result
, context
, reg
);
1071 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1072 result
= stack
[stack_elt
- 1];
1076 if (--stack_elt
< 0)
1077 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1082 if (offset
>= stack_elt
- 1)
1083 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1084 result
= stack
[stack_elt
- 1 - offset
];
1089 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1090 result
= stack
[stack_elt
- 2];
1095 CORE_ADDR t1
, t2
, t3
;
1098 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1099 t1
= stack
[stack_elt
- 1];
1100 t2
= stack
[stack_elt
- 2];
1101 t3
= stack
[stack_elt
- 3];
1102 stack
[stack_elt
- 1] = t2
;
1103 stack
[stack_elt
- 2] = t3
;
1104 stack
[stack_elt
- 3] = t1
;
1109 case DW_OP_deref_size
:
1113 case DW_OP_plus_uconst
:
1114 /* Unary operations. */
1115 if (--stack_elt
< 0)
1116 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1117 result
= stack
[stack_elt
];
1123 int len
= TARGET_ADDR_BIT
/ TARGET_CHAR_BIT
;
1124 if (len
!= 4 && len
!= 8)
1125 internal_error (__FILE__
, __LINE__
,
1126 "execute_stack_op error");
1127 result
= read_memory_unsigned_integer (result
, len
);
1131 case DW_OP_deref_size
:
1133 int len
= *op_ptr
++;
1134 if (len
!= 1 && len
!= 2 && len
!= 4 && len
!=8)
1135 internal_error (__FILE__
, __LINE__
,
1136 "execute_stack_op error");
1137 result
= read_memory_unsigned_integer (result
, len
);
1151 case DW_OP_plus_uconst
:
1152 result
+= read_uleb128 (objfile
->obfd
, &op_ptr
);
1173 /* Binary operations. */
1174 CORE_ADDR first
, second
;
1175 if ((stack_elt
-= 2) < 0)
1176 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1177 second
= stack
[stack_elt
];
1178 first
= stack
[stack_elt
+ 1];
1183 result
= second
& first
;
1186 result
= (LONGEST
) second
/ (LONGEST
) first
;
1189 result
= second
- first
;
1192 result
= (LONGEST
) second
% (LONGEST
) first
;
1195 result
= second
* first
;
1198 result
= second
| first
;
1201 result
= second
+ first
;
1204 result
= second
<< first
;
1207 result
= second
>> first
;
1210 result
= (LONGEST
) second
>> first
;
1213 result
= second
^ first
;
1216 result
= (LONGEST
) first
<= (LONGEST
) second
;
1219 result
= (LONGEST
) first
>= (LONGEST
) second
;
1222 result
= (LONGEST
) first
== (LONGEST
) second
;
1225 result
= (LONGEST
) first
< (LONGEST
) second
;
1228 result
= (LONGEST
) first
> (LONGEST
) second
;
1231 result
= (LONGEST
) first
!= (LONGEST
) second
;
1233 default: /* This label is here just to avoid warning. */
1240 offset
= read_2s (objfile
->obfd
, &op_ptr
);
1245 if (--stack_elt
< 0)
1246 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1247 offset
= read_2s (objfile
->obfd
, &op_ptr
);
1248 if (stack
[stack_elt
] != 0)
1256 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1259 /* Most things push a result value. */
1260 if ((size_t) stack_elt
>= sizeof (stack
) / sizeof (*stack
))
1261 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1262 stack
[++stack_elt
] = result
;
1266 /* We were executing this program to get a value. It should be
1268 if (--stack_elt
< 0)
1269 internal_error (__FILE__
, __LINE__
, "execute_stack_op error");
1270 return stack
[stack_elt
];
1274 update_context (struct context
*context
, struct frame_state
*fs
, int chain
)
1276 struct context
*orig_context
;
1280 unwind_tmp_obstack_init ();
1282 orig_context
= context_alloc ();
1283 context_cpy (orig_context
, context
);
1285 /* Compute this frame's CFA. */
1286 switch (fs
->cfa_how
)
1288 case CFA_REG_OFFSET
:
1289 get_reg ((char *) &cfa
, context
, fs
->cfa_reg
);
1290 cfa
+= fs
->cfa_offset
;
1294 /* ??? No way of knowing what register number is the stack pointer
1295 to do the same sort of handling as above. Assume that if the
1296 CFA calculation is so complicated as to require a stack program
1297 that this will not be a problem. */
1299 char *exp
= fs
->cfa_exp
;
1302 len
= read_uleb128 (fs
->objfile
->obfd
, &exp
);
1303 cfa
= (CORE_ADDR
) execute_stack_op (fs
->objfile
, exp
,
1304 exp
+ len
, context
, 0);
1313 orig_context
->cfa
= cfa
;
1315 /* Compute the addresses of all registers saved in this frame. */
1316 for (i
= 0; i
< NUM_REGS
; ++i
)
1317 switch (fs
->regs
.reg
[i
].how
)
1322 context
->reg
[i
].how
= REG_CTX_VALUE
;
1323 context
->reg
[i
].loc
.addr
= cfa
;
1326 context
->reg
[i
].how
= REG_CTX_UNSAVED
;
1328 case REG_SAVED_OFFSET
:
1329 context
->reg
[i
].how
= REG_CTX_SAVED_OFFSET
;
1330 context
->reg
[i
].loc
.offset
= fs
->regs
.reg
[i
].loc
.offset
;
1333 switch (orig_context
->reg
[fs
->regs
.reg
[i
].loc
.reg
].how
)
1335 case REG_CTX_UNSAVED
:
1336 context
->reg
[i
].how
= REG_CTX_UNSAVED
;
1338 case REG_CTX_SAVED_OFFSET
:
1339 context
->reg
[i
].how
= REG_CTX_SAVED_OFFSET
;
1340 context
->reg
[i
].loc
.offset
= orig_context
->cfa
- context
->cfa
+
1341 orig_context
->reg
[fs
->regs
.reg
[i
].loc
.reg
].loc
.offset
;
1343 case REG_CTX_SAVED_REG
:
1344 context
->reg
[i
].how
= REG_CTX_SAVED_REG
;
1345 context
->reg
[i
].loc
.reg
=
1346 orig_context
->reg
[fs
->regs
.reg
[i
].loc
.reg
].loc
.reg
;
1348 case REG_CTX_SAVED_ADDR
:
1349 context
->reg
[i
].how
= REG_CTX_SAVED_ADDR
;
1350 context
->reg
[i
].loc
.addr
=
1351 orig_context
->reg
[fs
->regs
.reg
[i
].loc
.reg
].loc
.addr
;
1353 internal_error (__FILE__
, __LINE__
,
1354 "%s: unknown register rule", __func__
);
1359 char *exp
= fs
->regs
.reg
[i
].loc
.exp
;
1363 len
= read_uleb128 (fs
->objfile
->obfd
, &exp
);
1364 val
= execute_stack_op (fs
->objfile
, exp
, exp
+ len
,
1366 context
->reg
[i
].how
= REG_CTX_SAVED_ADDR
;
1367 context
->reg
[i
].loc
.addr
= val
;
1371 internal_error (__FILE__
, __LINE__
,
1372 "%s: unknown register rule", __func__
);
1374 get_reg ((char *) &context
->ra
, context
, fs
->retaddr_column
);
1375 unwind_tmp_obstack_free ();
1379 is_cie (ULONGEST cie_id
, int dwarf64
)
1381 return dwarf64
? (cie_id
== 0xffffffffffffffff) : (cie_id
== 0xffffffff);
1385 compare_fde_unit (const void *a
, const void *b
)
1387 struct fde_unit
**first
, **second
;
1388 first
= (struct fde_unit
**) a
;
1389 second
= (struct fde_unit
**) b
;
1390 if ((*first
)->initial_location
> (*second
)->initial_location
)
1392 else if ((*first
)->initial_location
< (*second
)->initial_location
)
1398 /* Build the cie_chunks and fde_chunks tables from informations
1399 found in .debug_frame and .eh_frame sections. */
1400 /* We can handle both of these sections almost in the same way, however there
1401 are some exceptions:
1402 - CIE ID is -1 in debug_frame, but 0 in eh_frame
1403 - eh_frame may contain some more information that are used only by gcc
1404 (eg. personality pointer, LSDA pointer, ...). Most of them we can ignore.
1405 - In debug_frame FDE's item cie_id contains offset of it's parent CIE.
1406 In eh_frame FDE's item cie_id is a relative pointer to the parent CIE.
1407 Anyway we don't need to bother with this, because we are smart enough
1408 to keep the pointer to the parent CIE of oncomming FDEs in 'last_cie'.
1409 - Although debug_frame items can contain Augmentation as well as
1410 eh_frame ones, I have never seen them non-empty. Thus only in eh_frame
1411 we can encounter for example non-absolute pointers (Aug. 'R').
1414 parse_frame_info (struct objfile
*objfile
, file_ptr frame_offset
,
1415 unsigned int frame_size
, int eh_frame
)
1417 bfd
*abfd
= objfile
->obfd
;
1418 asection
*curr_section_ptr
;
1421 char *frame_buffer
= NULL
;
1422 char *curr_section_name
, *aug_data
;
1423 struct cie_unit
*last_cie
= NULL
;
1424 int last_dup_fde
= 0;
1426 CORE_ADDR curr_section_vma
= 0;
1428 unwind_tmp_obstack_init ();
1430 frame_buffer
= dwarf2_read_section (objfile
, frame_offset
, frame_size
);
1432 start
= frame_buffer
;
1433 end
= frame_buffer
+ frame_size
;
1435 curr_section_name
= eh_frame
? ".eh_frame" : ".debug_frame";
1436 curr_section_ptr
= bfd_get_section_by_name (abfd
, curr_section_name
);
1437 if (curr_section_ptr
)
1438 curr_section_vma
= curr_section_ptr
->vma
;
1444 unsigned long length
;
1446 ULONGEST unit_offset
= start
- frame_buffer
;
1447 int bytes_read
, dwarf64
;
1450 length
= read_initial_length (abfd
, start
, &bytes_read
);
1451 start
+= bytes_read
;
1452 dwarf64
= (bytes_read
== 12);
1453 block_end
= start
+ length
;
1461 cie_id
= read_length (abfd
, start
, &bytes_read
, dwarf64
);
1462 start
+= bytes_read
;
1464 if ((eh_frame
&& cie_id
== 0) || is_cie (cie_id
, dwarf64
))
1466 struct cie_unit
*cie
= cie_unit_alloc ();
1469 cie
->objfile
= objfile
;
1470 cie
->next
= cie_chunks
;
1473 cie
->objfile
= objfile
;
1475 cie
->offset
= unit_offset
;
1477 start
++; /* version */
1479 cie
->augmentation
= aug
= start
;
1480 while (*start
++); /* Skips last NULL as well */
1482 cie
->code_align
= read_uleb128 (abfd
, &start
);
1483 cie
->data_align
= read_sleb128 (abfd
, &start
);
1484 cie
->ra
= read_1u (abfd
, &start
);
1487 z Indicates that a uleb128 is present to size the
1488 augmentation section.
1489 L Indicates the encoding (and thus presence) of
1490 an LSDA pointer in the FDE augmentation.
1491 R Indicates a non-default pointer encoding for
1493 P Indicates the presence of an encoding + language
1494 personality routine in the CIE augmentation.
1496 [This info comes from GCC's dwarf2out.c]
1500 aug_len
= read_uleb128 (abfd
, &start
);
1507 cie
->data_length
= block_end
- cie
->data
;
1509 while (*aug
!= '\0')
1511 if (aug
[0] == 'e' && aug
[1] == 'h')
1513 aug_data
+= sizeof (void *);
1516 else if (aug
[0] == 'R')
1517 cie
->addr_encoding
= *aug_data
++;
1518 else if (aug
[0] == 'P')
1520 CORE_ADDR pers_addr
;
1523 pers_addr_enc
= *aug_data
++;
1524 /* We don't need pers_addr value and so we
1525 don't care about it's encoding. */
1526 pers_addr
= read_encoded_pointer (abfd
, &aug_data
,
1529 else if (aug
[0] == 'L' && eh_frame
)
1533 /* Perhaps we should save this to CIE for later use?
1534 Do we need it for something in GDB? */
1535 lsda_addr_enc
= *aug_data
++;
1538 warning ("CFI warning: unknown augmentation \"%c\""
1540 "\t%s", aug
[0], curr_section_name
,
1549 struct fde_unit
*fde
;
1550 struct cie_unit
*cie
;
1554 /* We assume that debug_frame is in order
1555 CIE,FDE,CIE,FDE,FDE,... and thus the CIE for this FDE
1556 should be stored in last_cie pointer. If not, we'll
1557 try to find it by the older way. */
1562 warning ("CFI: last_cie == NULL. "
1563 "Perhaps a malformed %s section in '%s'...?\n",
1564 curr_section_name
, objfile
->name
);
1569 if (cie
->objfile
== objfile
)
1573 (unit_offset
+ bytes_read
- cie_id
)))
1575 if (!eh_frame
&& (cie
->offset
== cie_id
))
1582 error ("CFI: can't find CIE pointer");
1585 init_loc
= read_encoded_pointer (abfd
, &start
,
1586 cie
->addr_encoding
);
1588 switch (pointer_encoding (cie
->addr_encoding
))
1593 /* start-frame_buffer gives offset from
1594 the beginning of actual section. */
1595 init_loc
+= curr_section_vma
+ start
- frame_buffer
;
1598 warning ("CFI: Unsupported pointer encoding\n");
1601 /* For relocatable objects we must add an offset telling
1602 where the section is actually mapped in the memory. */
1603 init_loc
+= ANOFFSET (objfile
->section_offsets
,
1604 SECT_OFF_TEXT (objfile
));
1606 /* If we have both .debug_frame and .eh_frame present in
1607 a file, we must eliminate duplicate FDEs. For now we'll
1608 run through all entries in fde_chunks and check it one
1609 by one. Perhaps in the future we can implement a faster
1610 searching algorithm. */
1611 /* eh_frame==2 indicates, that this file has an already
1612 parsed .debug_frame too. When eh_frame==1 it means, that no
1613 .debug_frame is present and thus we don't need to check for
1614 duplicities. eh_frame==0 means, that we parse .debug_frame
1615 and don't need to care about duplicate FDEs, because
1616 .debug_frame is parsed first. */
1618 for (i
= 0; eh_frame
== 2 && i
< fde_chunks
.elems
; i
++)
1620 /* We assume that FDEs in .debug_frame and .eh_frame
1621 have the same order (if they are present, of course).
1622 If we find a duplicate entry for one FDE and save
1623 it's index to last_dup_fde it's very likely, that
1624 we'll find an entry for the following FDE right after
1625 the previous one. Thus in many cases we'll run this
1627 last_dup_fde
= (last_dup_fde
+ i
) % fde_chunks
.elems
;
1628 if (fde_chunks
.array
[last_dup_fde
]->initial_location
1636 /* Allocate a new entry only if this FDE isn't a duplicate of
1637 something we have already seen. */
1640 fde_chunks_need_space ();
1641 fde
= fde_unit_alloc ();
1643 fde_chunks
.array
[fde_chunks
.elems
++] = fde
;
1645 fde
->initial_location
= init_loc
;
1646 fde
->address_range
= read_encoded_pointer (abfd
, &start
,
1652 /* Here we intentionally ignore augmentation data
1653 from FDE, because we don't need them. */
1654 if (cie
->augmentation
[0] == 'z')
1655 start
+= read_uleb128 (abfd
, &start
);
1658 fde
->data_length
= block_end
- start
;
1663 qsort (fde_chunks
.array
, fde_chunks
.elems
,
1664 sizeof (struct fde_unit
*), compare_fde_unit
);
1668 /* We must parse both .debug_frame section and .eh_frame because
1669 * not all frames must be present in both of these sections. */
1671 dwarf2_build_frame_info (struct objfile
*objfile
)
1673 int after_debug_frame
= 0;
1675 /* If we have .debug_frame then the parser is called with
1676 eh_frame==0 for .debug_frame and eh_frame==2 for .eh_frame,
1677 otherwise it's only called once for .eh_frame with argument
1680 if (dwarf_frame_offset
)
1682 parse_frame_info (objfile
, dwarf_frame_offset
,
1683 dwarf_frame_size
, 0 /* = debug_frame */ );
1684 after_debug_frame
= 1;
1687 if (dwarf_eh_frame_offset
)
1688 parse_frame_info (objfile
, dwarf_eh_frame_offset
, dwarf_eh_frame_size
,
1689 1 /* = eh_frame */ + after_debug_frame
);
1692 /* Return the frame address. */
1696 struct context
*context
;
1697 struct frame_state
*fs
;
1700 unwind_tmp_obstack_init ();
1702 context
= context_alloc ();
1703 fs
= frame_state_alloc ();
1705 context
->ra
= read_pc () + 1;
1707 frame_state_for (context
, fs
);
1708 update_context (context
, fs
, 0);
1712 unwind_tmp_obstack_free ();
1717 /* Store the frame address. This function is not used. */
1720 cfi_write_fp (CORE_ADDR val
)
1722 struct context
*context
;
1723 struct frame_state
*fs
;
1725 unwind_tmp_obstack_init ();
1727 context
= context_alloc ();
1728 fs
= frame_state_alloc ();
1730 context
->ra
= read_pc () + 1;
1732 frame_state_for (context
, fs
);
1734 if (fs
->cfa_how
== CFA_REG_OFFSET
)
1736 val
-= fs
->cfa_offset
;
1737 write_register_gen (fs
->cfa_reg
, (char *) &val
);
1740 warning ("Can't write fp.");
1742 unwind_tmp_obstack_free ();
1745 /* Restore the machine to the state it had before the current frame
1748 cfi_pop_frame (struct frame_info
*fi
)
1750 char *regbuf
= alloca (MAX_REGISTER_RAW_SIZE
);
1753 for (regnum
= 0; regnum
< NUM_REGS
; regnum
++)
1755 get_reg (regbuf
, UNWIND_CONTEXT (fi
), regnum
);
1756 write_register_bytes (REGISTER_BYTE (regnum
), regbuf
,
1757 REGISTER_RAW_SIZE (regnum
));
1759 write_register (PC_REGNUM
, UNWIND_CONTEXT (fi
)->ra
);
1761 flush_cached_frames ();
1764 /* Determine the address of the calling function's frame. */
1766 cfi_frame_chain (struct frame_info
*fi
)
1768 struct context
*context
;
1769 struct frame_state
*fs
;
1772 unwind_tmp_obstack_init ();
1774 context
= context_alloc ();
1775 fs
= frame_state_alloc ();
1776 context_cpy (context
, UNWIND_CONTEXT (fi
));
1778 /* outermost frame */
1779 if (context
->ra
== 0)
1781 unwind_tmp_obstack_free ();
1785 frame_state_for (context
, fs
);
1786 update_context (context
, fs
, 1);
1789 unwind_tmp_obstack_free ();
1794 /* Sets the pc of the frame. */
1796 cfi_init_frame_pc (int fromleaf
, struct frame_info
*fi
)
1799 get_reg ((char *) &(fi
->pc
), UNWIND_CONTEXT (fi
->next
), PC_REGNUM
);
1801 fi
->pc
= read_pc ();
1804 /* Initialize unwind context informations of the frame. */
1806 cfi_init_extra_frame_info (int fromleaf
, struct frame_info
*fi
)
1808 struct frame_state
*fs
;
1810 unwind_tmp_obstack_init ();
1812 fs
= frame_state_alloc ();
1813 fi
->context
= frame_obstack_alloc (sizeof (struct context
));
1814 UNWIND_CONTEXT (fi
)->reg
=
1815 frame_obstack_alloc (sizeof (struct context_reg
) * NUM_REGS
);
1816 memset (UNWIND_CONTEXT (fi
)->reg
, 0,
1817 sizeof (struct context_reg
) * NUM_REGS
);
1821 context_cpy (UNWIND_CONTEXT (fi
), UNWIND_CONTEXT (fi
->next
));
1822 frame_state_for (UNWIND_CONTEXT (fi
), fs
);
1823 update_context (UNWIND_CONTEXT (fi
), fs
, 1);
1827 UNWIND_CONTEXT (fi
)->ra
= fi
->pc
+ 1;
1828 frame_state_for (UNWIND_CONTEXT (fi
), fs
);
1829 update_context (UNWIND_CONTEXT (fi
), fs
, 0);
1832 unwind_tmp_obstack_free ();
1835 /* Obtain return address of the frame. */
1837 cfi_get_ra (struct frame_info
*fi
)
1839 return UNWIND_CONTEXT (fi
)->ra
;
1842 /* Find register number REGNUM relative to FRAME and put its
1843 (raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable
1844 was optimized out (and thus can't be fetched). If the variable
1845 was fetched from memory, set *ADDRP to where it was fetched from,
1846 otherwise it was fetched from a register.
1848 The argument RAW_BUFFER must point to aligned memory. */
1850 cfi_get_saved_register (char *raw_buffer
,
1853 struct frame_info
*frame
,
1854 int regnum
, enum lval_type
*lval
)
1856 if (!target_has_registers
)
1857 error ("No registers.");
1859 /* Normal systems don't optimize out things with register numbers. */
1860 if (optimized
!= NULL
)
1863 if (addrp
) /* default assumption: not found in memory */
1868 read_register_gen (regnum
, raw_buffer
);
1870 *lval
= lval_register
;
1872 *addrp
= REGISTER_BYTE (regnum
);
1876 frame
= frame
->next
;
1877 switch (UNWIND_CONTEXT (frame
)->reg
[regnum
].how
)
1879 case REG_CTX_UNSAVED
:
1880 read_register_gen (regnum
, raw_buffer
);
1883 if (optimized
!= NULL
)
1886 case REG_CTX_SAVED_OFFSET
:
1887 target_read_memory (UNWIND_CONTEXT (frame
)->cfa
+
1888 UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.offset
,
1889 raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1891 *lval
= lval_memory
;
1894 UNWIND_CONTEXT (frame
)->cfa
+
1895 UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.offset
;
1897 case REG_CTX_SAVED_REG
:
1898 read_register_gen (UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.reg
,
1901 *lval
= lval_register
;
1904 REGISTER_BYTE (UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.reg
);
1906 case REG_CTX_SAVED_ADDR
:
1907 target_read_memory (UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.addr
,
1908 raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1910 *lval
= lval_memory
;
1912 *addrp
= UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.addr
;
1915 memcpy (raw_buffer
, &UNWIND_CONTEXT (frame
)->reg
[regnum
].loc
.addr
,
1916 REGISTER_RAW_SIZE (regnum
));
1919 if (optimized
!= NULL
)
1923 internal_error (__FILE__
, __LINE__
,
1924 "cfi_get_saved_register: unknown register rule");
1929 /* Return the register that the function uses for a frame pointer,
1930 plus any necessary offset to be applied to the register before
1931 any frame pointer offsets. */
1933 cfi_virtual_frame_pointer (CORE_ADDR pc
, int *frame_reg
,
1934 LONGEST
* frame_offset
)
1936 struct context
*context
;
1937 struct frame_state
*fs
;
1939 unwind_tmp_obstack_init ();
1941 context
= context_alloc ();
1942 fs
= frame_state_alloc ();
1944 context
->ra
= read_pc () + 1;
1946 frame_state_for (context
, fs
);
1948 if (fs
->cfa_how
== CFA_REG_OFFSET
)
1950 *frame_reg
= fs
->cfa_reg
;
1951 *frame_offset
= fs
->cfa_offset
;
1954 error ("dwarf cfi error: CFA is not defined as CFA_REG_OFFSET");
1956 unwind_tmp_obstack_free ();