https://sourceware.org/bugzilla/show_bug.cgi?id=33166

--- Comment #1 from Sterling Augustine <saugustine at google dot com> ---
If a cfi directive doesn't have an instruction following, then objdump crashes.

I believe this is valid assembly--at least it doesn't seem to bother the other
unwinding formats. I would favor making the dumper robust to a situation where
an fre has zero relevant length. Or if it isn't, gas should error out. 

With current top of trunk binutils-gdb:

$ cat extra_cfi.s
        .text
foo:    
        .cfi_startproc
        nop
        .cfi_def_cfa %rbp, 16
        .cfi_endproc

$ ~/gdb/build/gas/as-new --gsframe extra_cfi.s -o extra_cfi.o &&
~/gdb/build/binutils/objdump --sframe extra_cfi.o

extra_cfi.o:     file format elf64-x86-64

/usr/local/google/home/saugustine/gdb/build/binutils/objdump: Error: SFrame
decode failure: Out of Memory.


Debian unstable gives a somewhat more helpful error message:

augustine:~/sframebugs $ as --gsframe extra_cfi.s -o extra_cfi.o && objdump
--sframe extra_cfi.o

extra_cfi.o:     file format elf64-x86-64

Contents of the SFrame section .sframe:
  Header :

    Version: SFRAME_VERSION_2
    Flags: NONE
    CFA fixed RA offset: -8
    Num FDEs: 1
    Num FREs: 2

  Function Index :

    func idx [0]: pc = 0x0, size = 1 bytes
    STARTPC         CFA       FP        RA           
objdump: ../../libsframe/sframe.c:1282: sframe_decoder_get_fre: Assertion
`fre->fre_start_addr < fdep->sfde_func_size' failed.
Aborted (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to