From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26984 invoked by alias); 16 Apr 2008 22:25:04 -0000 Received: (qmail 26912 invoked by uid 22791); 16 Apr 2008 22:25:01 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.191) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 16 Apr 2008 22:24:34 +0000 Received: by nf-out-0910.google.com with SMTP id b11so880824nfh.48 for ; Wed, 16 Apr 2008 15:24:31 -0700 (PDT) Received: by 10.78.147.6 with SMTP id u6mr920873hud.39.1208384671080; Wed, 16 Apr 2008 15:24:31 -0700 (PDT) Received: by 10.78.163.20 with HTTP; Wed, 16 Apr 2008 15:24:31 -0700 (PDT) Message-ID: <6dc9ffc80804161524g5fe8ea7mf972f570676456b4@mail.gmail.com> Date: Thu, 17 Apr 2008 01:02:00 -0000 From: "H.J. Lu" To: "H.J. Lu" , gdb@sourceware.org Subject: Re: Does hardware watchpoint work on Linux/x86-64? In-Reply-To: <20080416221945.GA1708@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6dc9ffc80804161505h739a3aa0t86556f71d6422772@mail.gmail.com> <20080416221945.GA1708@caradoc.them.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00162.txt.bz2 Not even very simple one works: [hjl@gnu-27 gdb]$ cat x.c int foo; main () { foo =1; } [hjl@gnu-27 gdb]$ gcc -g x.c [hjl@gnu-27 gdb]$ gdb a.out GNU gdb 6.6.50.20061121-cvs Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu"... Using host libthread_db library "/lib64/tls/libthread_db.so.1". Setting up the environment for debugging gdb. Function "internal_error" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] Function "info_command" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] /export/build/gnu/gdb/build-x86_64-linux/gdb/.gdbinit:8: Error in sourced command file: No breakpoint number 0. (gdb) watch foo Hardware watchpoint 1: foo (gdb) q [hjl@gnu-27 gdb]$ ./gdb a.out GNU gdb 6.8.50.20080416-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu"... Setting up the environment for debugging gdb. Function "internal_error" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] Function "info_command" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] /export/build/gnu/gdb/build-x86_64-linux/gdb/.gdbinit:8: Error in sourced command file: No breakpoint number 0. (gdb) watch foo Watchpoint 1: foo (gdb) q [hjl@gnu-27 gdb]$ [hjl@gnu-27 gdb]$ readelf -w a.out The section .debug_aranges contains: Length: 44 Version: 2 Offset into .debug_info: 0x0 Pointer Size: 8 Segment Size: 0 Address Length 0000000000400428 0000000000000010 0000000000000000 0000000000000000 Contents of the .debug_pubnames section: Length: 31 Version: 2 Offset into .debug_info section: 0x0 Size of area in .debug_info section: 184 Offset Name 121 main 161 foo The section .debug_info contains: Compilation Unit @ offset 0x0: Length: 0xb4 (32-bit) Version: 2 Abbrev Offset: 0 Pointer Size: 8 <0>: Abbrev Number: 1 (DW_TAG_compile_unit) < c> DW_AT_stmt_list : 0x0 <10> DW_AT_high_pc : 0x400438 <18> DW_AT_low_pc : 0x400428 <20> DW_AT_producer : GNU C 3.4.6 20060404 (Red Hat 3.4.6-9) <47> DW_AT_language : 1 (ANSI C) <48> DW_AT_name : x.c <4c> DW_AT_comp_dir : /export/build/gnu/gdb/build-x86_64-linux/gdb <1><79>: Abbrev Number: 2 (DW_TAG_subprogram) <7a> DW_AT_external : 1 <7b> DW_AT_name : main <80> DW_AT_decl_file : 1 <81> DW_AT_decl_line : 3 <82> DW_AT_type : <0x9a> <86> DW_AT_low_pc : 0x400428 <8e> DW_AT_high_pc : 0x400438 <96> DW_AT_frame_base : 0x0 (location list) <1><9a>: Abbrev Number: 3 (DW_TAG_base_type) <9b> DW_AT_name : int <9f> DW_AT_byte_size : 4 DW_AT_encoding : 5 (signed) <1>: Abbrev Number: 4 (DW_TAG_variable) DW_AT_name : foo DW_AT_decl_file : 1 DW_AT_decl_line : 1 DW_AT_type : <0x9a> DW_AT_external : 1 DW_AT_location : 9 byte block: 3 e4 7 60 0 0 0 0 0 (DW_OP_addr: 6007e4) Contents of the .debug_abbrev section: Number TAG 1 DW_TAG_compile_unit [has children] DW_AT_stmt_list DW_FORM_data4 DW_AT_high_pc DW_FORM_addr DW_AT_low_pc DW_FORM_addr DW_AT_producer DW_FORM_string DW_AT_language DW_FORM_data1 DW_AT_name DW_FORM_string DW_AT_comp_dir DW_FORM_string 2 DW_TAG_subprogram [no children] DW_AT_external DW_FORM_flag DW_AT_name DW_FORM_string DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_low_pc DW_FORM_addr DW_AT_high_pc DW_FORM_addr DW_AT_frame_base DW_FORM_data4 3 DW_TAG_base_type [no children] DW_AT_name DW_FORM_string DW_AT_byte_size DW_FORM_data1 DW_AT_encoding DW_FORM_data1 4 DW_TAG_variable [no children] DW_AT_name DW_FORM_string DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_external DW_FORM_flag DW_AT_location DW_FORM_block1 The section .debug_frame contains: 00000000 00000014 ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -8 Return address column: 16 DW_CFA_def_cfa: r7 (rsp) ofs 8 DW_CFA_offset: r16 (rip) at cfa-8 DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop 00000018 0000001c 00000000 FDE cie=00000000 pc=00400428..00400438 DW_CFA_advance_loc: 1 to 00400429 DW_CFA_def_cfa_offset: 16 DW_CFA_offset: r6 (rbp) at cfa-16 DW_CFA_advance_loc: 3 to 0040042c DW_CFA_def_cfa_register: r6 (rbp) Contents of the .debug_loc section: Offset Begin End Expression 00000000 0000000000400428 0000000000400429 (DW_OP_breg7: 8) 00000000 0000000000400429 000000000040042c (DW_OP_breg7: 16) 00000000 000000000040042c 0000000000400438 (DW_OP_breg6: 16) 00000000 [hjl@gnu-27 gdb]$ H.J. On Wed, Apr 16, 2008 at 3:19 PM, Daniel Jacobowitz wrote: > Yes, hardware watchpoints work on x86-64. > > > On Wed, Apr 16, 2008 at 03:05:23PM -0700, H.J. Lu wrote: > > (gdb) watch section_headers > > During symbol reading, DW_AT_type missing from DW_TAG_subrange_type. > > Watchpoint 1: section_headers > > Figure out what sort of symbol GDB thinks this is. It thinks it's too > complicated to use a hardware watchpoint for. Does it have a location > list (odd for a global variable)? > > -- > Daniel Jacobowitz > CodeSourcery >