From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26296 invoked by alias); 1 Aug 2004 05:35:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26288 invoked from network); 1 Aug 2004 05:35:39 -0000 Received: from unknown (HELO mclean.mail.mindspring.net) (207.69.200.57) by sourceware.org with SMTP; 1 Aug 2004 05:35:39 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by mclean.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1Br90T-0005xp-00; Sun, 01 Aug 2004 01:35:37 -0400 Received: from mindspring.com (localhost [127.0.0.1]) by berman.michael-chastain.com (Postfix) with SMTP id 2295C4B102; Sun, 1 Aug 2004 01:35:40 -0400 (EDT) Date: Sun, 01 Aug 2004 05:35:00 -0000 From: Michael Chastain To: eliz@gnu.org Subject: Re: [PATCH] Partial fix for PR backtrace/1718 Cc: kettenis@chello.nl, gdb-patches@sources.redhat.com Message-ID: <410C812B.nailF0311BIFR@mindspring.com> References: <200407241259.i6OCxu8R041119@elgar.kettenis.dyndns.org> <9178-Fri30Jul2004213249+0300-eliz@gnu.org> <200407302007.i6UK7ufh028813@elgar.kettenis.dyndns.org> <8632-Sat31Jul2004163849+0300-eliz@gnu.org> <410BB62F.nailFX111607H@mindspring.com> <7821-Sat31Jul2004214202+0300-eliz@gnu.org> In-Reply-To: <7821-Sat31Jul2004214202+0300-eliz@gnu.org> User-Agent: nail 10.8 6/28/04 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00003.txt.bz2 "Eli Zaretskii" wrote: > Perhaps, then, you could post a list of all the opcodes and subsequent > bytes that we need to cover in i386_analyze_frame_setup? The compiler could schedule just about anything into the prologue! Let's get empirical. I ran cc1plus and gdb through "objdump -d" and some perl fu. We have to have "mov 0xADDRESS, %reg". After that, recognizing "cmpl $IMMEDIATE, 0xADDRESS" would help. That instruction gets scheduled even before "push %ebp". Those two additions would cover 99.9% of cc1plus and gdb. This cc1plus is for gcc HEAD on native i686-pc-linux-gnu. It was built with gcc 3.3.4 on native i686-pc-linux-gnu on an Intel Celeron. cc1plus has 10849 symbols, broken down as: 10849 total symbols 9271 push %ebp | mov %esp, %ebp 1549 push %ebp | INSN | mov %esp, %ebp 19 push %ebp | INSN | INSN | mov %esp, %ebp 10 all other The 1549 single-instruction interleaves break down as: 2 push %ebp | fldz | mov %esp, %ebp 1 push %ebp | mov $0xIMMEDIATE, %al | mov %esp, %ebp 1 push %ebp | mov $0xIMMEDIATE, %cl | mov %esp, %ebp 473 push %ebp | mov $0xIMMEDIATE, %eax | mov %esp, %ebp 185 push %ebp | mov $0xIMMEDIATE, %ecx | mov %esp, %ebp 126 push %ebp | mov $0xIMMEDIATE, %edx | mov %esp, %ebp 76 push %ebp | mov 0xADDRESS, %eax | mov %esp, %ebp 8 push %ebp | mov 0xADDRESS, %ecx | mov %esp, %ebp 20 push %ebp | mov 0xADDRESS, %edx | mov %esp, %ebp 404 push %ebp | xor %eax, %eax | mov %esp, %ebp 124 push %ebp | xor %ecx, %ecx | mov %esp, %ebp 129 push %ebp | xor %edx, %edx | mov %esp, %ebp The 19 double-instruction interleaves are innocuous, just more MOV and XOR: clear_aux_for_edges : push %ebp | mov 0xADDRESS, %edx | mov 0xADDRESS, %ecx | mov %esp, %ebp cplus_demangle_set_style : push %ebp | mov 0xADDRESS, %eax | mov $0xIMMEDIATE, %edx | mov %esp, %ebp default_spill_heuristic : push %ebp | mov 0xADDRESS, %eax | mov $0xIMMEDIATE, %edx | mov %esp, %ebp dwarf2out_do_frame : push %ebp | mov 0xADDRESS, %edx | xor %eax, %eax | mov %esp, %ebp earlyclobber_operand_p : push %ebp | mov 0xADDRESS, %edx | xor %eax, %eax | mov %esp, %ebp enumerate_ldsts : push %ebp | mov 0xADDRESS, %edx | xor %ecx, %ecx | mov %esp, %ebp fast_math_flags_set_p : push %ebp | mov 0xADDRESS, %ecx | xor %eax, %eax | mov %esp, %ebp free_block_changes : push %ebp | mov 0xADDRESS, %eax | xor %edx, %edx | mov %esp, %ebp gate_all_optimizations : push %ebp | mov 0xADDRESS, %edx | xor %eax, %eax | mov %esp, %ebp ia32_multipass_dfa_lookahead : push %ebp | mov 0xADDRESS, %eax | mov $0xIMMEDIATE, %edx | mov %esp, %ebp kept_level_p : push %ebp | mov 0xADDRESS, %edx | xor %ecx, %ecx | mov %esp, %ebp move_replacements : push %ebp | mov 0xADDRESS, %ecx | xor %edx, %edx | mov %esp, %ebp optimization_options : push %ebp | xor %eax, %eax | mov 0xADDRESS, %ecx | mov %esp, %ebp pop_topmost_sequence : push %ebp | mov 0xADDRESS, %edx | xor %ecx, %ecx | mov %esp, %ebp reg_alternate_class : push %ebp | mov 0xADDRESS, %edx | mov $0xIMMEDIATE, %eax | mov %esp, %ebp reg_preferred_class : push %ebp | mov 0xADDRESS, %edx | mov $0xIMMEDIATE, %eax | mov %esp, %ebp schedule_more_p : push %ebp | mov 0xADDRESS, %eax | xor %edx, %edx | mov %esp, %ebp transfer_replacements : push %ebp | mov 0xADDRESS, %ecx | xor %edx, %edx | mov %esp, %ebp tree_ssa_lim_finalize : push %ebp | mov 0xADDRESS, %eax | mov 0xADDRESS, %edx | mov %esp, %ebp The 10 truly freaky prologues are: .plt : pushl 0x86039e8 | jmp *0x86039ec | add %al, (%eax) | add %al, (%eax) | jmp *0x86039f0 | push $0x0 | jmp 80494cc <_init+0x18> _start : xor %ebp, %ebp | pop %esi | mov %esp, %ecx | and $0xfffffff0, %esp | push %eax | push %esp | push %edx constrain_operands_cached : cmpl $0xffffffff, 0x8619c0c | push %ebp | mov %esp, %ebp | je 841d293 | pop %ebp | mov $0x1, %eax | ret default_elf_select_rtx_section : cmpl $0x0, 0x8610da8 | push %ebp | mov %esp, %ebp | mov 0x8(%ebp), %ecx | mov 0xc(%ebp), %eax | mov 0x10(%ebp), %edx | je 84898d4 get_best_mode : movzbl 0x85b0e0c, %ecx | push %ebp | mov %esp, %ebp | push %edi | test %ecx, %ecx | mov 0x8(%ebp), %edi | push %esi get_pending_sizes : push %ebp | mov 0x867793c, %eax | xor %edx, %edx | mov %edx, 0x867793c | mov %esp, %ebp | pop %ebp | ret init_branch_prob : push %ebp | xor %eax, %eax | xor %ecx, %ecx | mov %eax, 0x8611090 | xor %edx, %edx | mov %esp, %ebp | mov %ecx, 0x8611088 init_temp_slots : push %ebp | mov 0x860ff64, %eax | xor %edx, %edx | xor %ecx, %ecx | mov %esp, %ebp | mov %edx, 0xa8(%eax) | xor %edx, %edx is_body_block : cmpb $0x0, 0x8563326 | push %ebp | mov %esp, %ebp | mov 0x8(%ebp), %eax | jne 84548a5 | cmpb $0x4, 0xc(%eax) | je 84548b0 ix86_init_builtins : testb $0x20, 0x8677745 | push %ebp | mov %esp, %ebp | jne 84a7bd0 | pop %ebp | ret | mov %esi, %esi Next I did the same for gdb: 6612 total symbols 5492 push %ebp | mov %esp, %ebp 1087 push %ebp | INSN | mov %esp, %ebp 19 push %ebp | INSN | INSN | mov %esp, %ebp 18 all other There weren't any new surprise in the push|INSN|mov and push|INSN|INSN|mov prologues. Here are the "all other": .plt : pushl 0x8282f2c | jmp *0x8282f30 | add %al, (%eax) | add %al, (%eax) | jmp *0x8282f34 | push $0x0 | jmp 80797dc <_init+0x18> NOP_Fixup : cmpl $0x1, 0x829c3c4 | push %ebp | mov %esp, %ebp | je 81ed520 | pop %ebp | ret | mov %esi, %esi OP_0f07 : cmpl $0x3, 0x829c4d4 | push %ebp | mov %esp, %ebp | mov 0x8(%ebp), %edx | mov 0xc(%ebp), %eax | je 81ed458 | pop %ebp OP_M : cmpl $0x3, 0x829c4d4 | push %ebp | mov %esp, %ebp | mov 0x8(%ebp), %edx | mov 0xc(%ebp), %eax | je 81ed430 | mov %eax, 0xc(%ebp) OP_MS : cmpl $0x3, 0x829c4d4 | push %ebp | mov %esp, %ebp | je 81ed3e2 | pop %ebp | jmp 81ed8b0 | pop %ebp OP_Rd : cmpl $0x3, 0x829c4d4 | push %ebp | mov %esp, %ebp | je 81ed192 | pop %ebp | jmp 81ed8b0 | pop %ebp OP_XS : cmpl $0x3, 0x829c4d4 | push %ebp | mov %esp, %ebp | je 81ed402 | pop %ebp | jmp 81ed8b0 | pop %ebp __i686.get_pc_thunk.cx : mov (%esp, 1), %ecx | ret _initialize_annotate : cmpl $0x1, 0x82873ec | push %ebp | mov %esp, %ebp | jle 80cc800 <_initialize_annotate+0x20> | mov $0x80cc7d0, %eax | mov %eax, 0x829ca64 | mov $0x80cc7d0, %eax _start : xor %ebp, %ebp | pop %esi | mov %esp, %ecx | and $0xfffffff0, %esp | push %eax | push %esp | push %edx annotate_ignore_count_change : cmpl $0x1, 0x82873ec | push %ebp | mov %esp, %ebp | jle 80cba96 | mov $0x1, %eax | mov %eax, 0x8286d6c | pop %ebp init_child_ops : push %ebp | mov $0x82031d0, %eax | mov $0x80967c0, %ecx | mov %eax, 0x829cf04 | mov $0x80a2ab0, %edx | mov %esp, %ebp | mov %ecx, 0x829cf20 init_remote_async_ops : push %ebp | mov $0x8207f00, %eax | mov $0x8209094, %ecx | mov %eax, 0x8284e0c | mov $0x8208020, %edx | mov %esp, %ebp | mov %ecx, 0x8284e04 init_remote_ops : push %ebp | mov $0x820ec28, %eax | mov $0x80a50d0, %ecx | mov %eax, 0x8284b44 | mov $0x80a4d10, %edx | mov %esp, %ebp | mov %ecx, 0x8284b54 rl_insert : cmpl $0x1, 0x827f794 | push %ebp | mov %esp, %ebp | mov 0x8(%ebp), %edx | mov 0xc(%ebp), %eax | je 81e4c20 | mov %eax, 0xc(%ebp) selected_architecture_name : push %ebp | xor %eax, %eax | mov 0x82877a8, %edx | cmpl $0x0, 0x827d7b4 | mov %esp, %ebp | pop %ebp | setne %al set_inferior_args : push %ebp | mov 0x8287320, %eax | xor %ecx, %ecx | mov %ecx, 0x8287324 | mov %esp, %ebp | mov 0x8(%ebp), %edx | pop %ebp tui_clear_source_windows : push %ebp | mov 0x827f210, %eax | xor %ecx, %ecx | mov %ecx, 0x827f214 | mov %esp, %ebp | movl $0x0, (%eax) | movl $0x0, 0x4(%eax) These are both C programs, I'd feel better if I could do this on eclipse (java) and mozilla (c++) as well. Also some PIC code would be nice. I'm also ignoring floating point programs -- I bet a lot of floating point instructions could get scheduled into the prologue. Michael C