From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17413 invoked by alias); 7 Dec 2008 22:24:00 -0000 Received: (qmail 17402 invoked by uid 22791); 7 Dec 2008 22:23:59 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Dec 2008 22:23:00 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mB7MMxHR004088 for ; Sun, 7 Dec 2008 17:22:59 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mB7MMwxk011814 for ; Sun, 7 Dec 2008 17:22:58 -0500 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mB7MMulG000470 for ; Sun, 7 Dec 2008 17:22:58 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.2) with ESMTP id mB7MMsEh013856 for ; Sun, 7 Dec 2008 23:22:55 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id mB7MMrdd013836 for gdb-patches@sourceware.org; Sun, 7 Dec 2008 23:22:53 +0100 Date: Sun, 07 Dec 2008 22:24:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Simplify breakpoint.c function parameters Message-ID: <20081207222253.GA6749@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00142.txt.bz2 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 409 Hi, the patch has no effect on the functionality but I find the simplified code less magic to understand. It fixes a small bug - update_watchpoint() for bp_watchpoint (software watchpoint) created breakpoint locations bp_loc_hardware_watchpoint while it should be bp_loc_other. But I am not aware of any (possibly negative) effect it had. No regressions on {x86_64,ia64}-unknown-linux-gnu. Regards, Jan --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="gdb-breakpoint-type-simplify.patch" Content-length: 3582 2008-12-07 Jan Kratochvil Fix loc_type of `bp_location's created by update_watchpoint. * breakpoint.c (allocate_bp_location): Remove the bp_type parameter. Replace bp_type by bpt->type. Update prototype. All callers updated. (add_location_to_breakpoint): Remove the bp_type parameter. Replace bp_type by b->type. All callers updated. (set_breakpoint_location_function): Replace bptype by b->type. --- gdb/breakpoint.c 7 Dec 2008 15:59:51 -0000 1.364 +++ gdb/breakpoint.c 7 Dec 2008 19:19:40 -0000 @@ -181,8 +181,7 @@ static int single_step_breakpoint_insert static void free_bp_location (struct bp_location *loc); -static struct bp_location * -allocate_bp_location (struct breakpoint *bpt, enum bptype bp_type); +static struct bp_location *allocate_bp_location (struct breakpoint *bpt); static void update_global_location_list (int); @@ -924,7 +923,7 @@ update_watchpoint (struct breakpoint *b, else if (b->type == bp_access_watchpoint) type = hw_access; - loc = allocate_bp_location (b, bp_hardware_watchpoint); + loc = allocate_bp_location (b); for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) ; *tmp = loc; @@ -4013,7 +4044,7 @@ adjust_breakpoint_address (CORE_ADDR bpa /* Allocate a struct bp_location. */ static struct bp_location * -allocate_bp_location (struct breakpoint *bpt, enum bptype bp_type) +allocate_bp_location (struct breakpoint *bpt) { struct bp_location *loc, *loc_p; @@ -4025,7 +4056,7 @@ allocate_bp_location (struct breakpoint loc->shlib_disabled = 0; loc->enabled = 1; - switch (bp_type) + switch (bpt->type) { case bp_breakpoint: case bp_until: @@ -4144,9 +4175,9 @@ set_breakpoint_location_function (struct breakpoint may cause target_read_memory() to be called and we do not want its scan of the location chain to find a breakpoint and location that's only been partially initialized. */ - adjusted_address = adjust_breakpoint_address (sal.pc, bptype); + adjusted_address = adjust_breakpoint_address (sal.pc, b->type); - b->loc = allocate_bp_location (b, bptype); + b->loc = allocate_bp_location (b); b->loc->requested_address = sal.pc; b->loc->address = adjusted_address; @@ -4981,18 +5015,17 @@ mention (struct breakpoint *b) static struct bp_location * -add_location_to_breakpoint (struct breakpoint *b, enum bptype bptype, +add_location_to_breakpoint (struct breakpoint *b, const struct symtab_and_line *sal) { struct bp_location *loc, **tmp; - loc = allocate_bp_location (b, bptype); + loc = allocate_bp_location (b); for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) ; *tmp = loc; loc->requested_address = sal->pc; - loc->address = adjust_breakpoint_address (loc->requested_address, - bptype); + loc->address = adjust_breakpoint_address (loc->requested_address, b->type); loc->section = sal->section; set_breakpoint_location_function (loc); @@ -5090,7 +5125,7 @@ create_breakpoint (struct symtabs_and_li } else { - loc = add_location_to_breakpoint (b, type, &sal); + loc = add_location_to_breakpoint (b, &sal); } if (bp_loc_is_permanent (loc)) @@ -7226,7 +7263,7 @@ update_breakpoint_locations (struct brea for (i = 0; i < sals.nelts; ++i) { struct bp_location *new_loc = - add_location_to_breakpoint (b, b->type, &(sals.sals[i])); + add_location_to_breakpoint (b, &(sals.sals[i])); /* Reparse conditions, they might contain references to the old symtab. */ --jRHKVT23PllUwdXP--