From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id D148C395C41D for ; Tue, 10 Jan 2023 15:18:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D148C395C41D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd33.google.com with SMTP id g20so6278922iob.2 for ; Tue, 10 Jan 2023 07:18:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Sy+fRuVt+s8Pfa2zngfSb2M+ylIY1uA37xCBafnfPmA=; b=YyOfc5vCF6kHArf4aSoTHVQgtvUy8vj2ZTWnSQ39M4ZrlI1azSzuGPLcquK0wmz92Y K9YN3HKZ3VOJrHXfNnzvxAXNLA1kj9M5demzm0mTgTQOKm7liPNYZKyik0+zv8TIhvio U39nCvN+lxLR+wPPfU7ZyiCTTbGJZF5FsHkTQhAmYV5eSr54joS9eLqNZVNFLnhsr/Jq eeZksMEQ0whWWAha4lUhQr9LNBbFuoz0Z37VfZcSnAXhnGdoYty66WM95XECLooO3aNe SFbQbs/XG2nBKScZTz/jVeT99Ax7KxA1Avvta1AEEMtpBf/kOmzM0cO6mkQZCntqPf8j gU/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Sy+fRuVt+s8Pfa2zngfSb2M+ylIY1uA37xCBafnfPmA=; b=UNnfxw97LD5HRlW8sR3CYDarZMhNJPS56CYEAzzfrqyRXEyPD3/kOsZWrkl65YT1Ql mON2XW14TBSN3X7TAEtHBlUBUTxeaBIP30OOdimWdYncCCkCXPcr1S2M5pvu3+4BQaXM 5PvBj8GUNkONlioR1IgCklXphLHL3YgUg+BOkv2bfnNJ38HVyynyYTzlO8Tjqn9W5kM3 z189HGFDcHzOeKVrUsJoRT3lqHidAv3t6H0mx+9iA68MhHf+5jrtYGvhHasbep+hiE0z MgRSUaXmZooBWCHHNlgEU2W2t/w3hjmiNGinYy1JlFaafBAo1yoS1/wIFxO48HznfHmq F6Tw== X-Gm-Message-State: AFqh2kobFNm2u8Z67LB88XCl9C+fxDgIFGGV+FxfNTNUz/5a/d71YtUF 5XXz52/L9EIRXbTmDAzELO349KV/koLiZ/xP X-Google-Smtp-Source: AMrXdXtxJQ6PLdKrElw+60BAY5HTP6eAv4zvxInkbJgwtZzQpmYrjhck59dwCX3E2iCiBiBHqyb1Cg== X-Received: by 2002:a6b:d109:0:b0:6e3:187:f4ef with SMTP id l9-20020a6bd109000000b006e30187f4efmr45101982iob.19.1673363908975; Tue, 10 Jan 2023 07:18:28 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id 1-20020a056e0211a100b003024b62725dsm3308949ilj.22.2023.01.10.07.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:28 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Convert say_where to method on code_breakpoint Date: Tue, 10 Jan 2023 08:18:21 -0700 Message-Id: <20230110151821.2302229-1-tromey@adacore.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 'say_where' is only useful (and only called for) code breakpoints, so convert it to be a protected method on code_breakpoint. --- gdb/breakpoint.c | 49 ++++++++++++++++++++++++------------------------ gdb/breakpoint.h | 4 ++++ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8cfc46e0bed..6762fad5d2c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11496,11 +11496,10 @@ bpstat_remove_breakpoint_callback (struct thread_info *th, void *data) return 0; } -/* Helper for breakpoint and tracepoint breakpoint->mention - callbacks. */ +/* See breakpoint.h. */ -static void -say_where (const breakpoint *b) +void +code_breakpoint::say_where () const { struct value_print_options opts; @@ -11508,58 +11507,58 @@ say_where (const breakpoint *b) /* i18n: cagney/2005-02-11: Below needs to be merged into a single string. */ - if (b->loc == NULL) + if (loc == NULL) { /* For pending locations, the output differs slightly based - on b->extra_string. If this is non-NULL, it contains either + on extra_string. If this is non-NULL, it contains either a condition or dprintf arguments. */ - if (b->extra_string == NULL) + if (extra_string == NULL) { - gdb_printf (_(" (%s) pending."), b->locspec->to_string ()); + gdb_printf (_(" (%s) pending."), locspec->to_string ()); } - else if (b->type == bp_dprintf) + else if (type == bp_dprintf) { gdb_printf (_(" (%s,%s) pending."), - b->locspec->to_string (), - b->extra_string.get ()); + locspec->to_string (), + extra_string.get ()); } else { gdb_printf (_(" (%s %s) pending."), - b->locspec->to_string (), - b->extra_string.get ()); + locspec->to_string (), + extra_string.get ()); } } else { - if (opts.addressprint || b->loc->symtab == NULL) + if (opts.addressprint || loc->symtab == NULL) gdb_printf (" at %ps", styled_string (address_style.style (), - paddress (b->loc->gdbarch, - b->loc->address))); - if (b->loc->symtab != NULL) + paddress (loc->gdbarch, + loc->address))); + if (loc->symtab != NULL) { /* If there is a single location, we can print the location more nicely. */ - if (b->loc->next == NULL) + if (loc->next == NULL) { const char *filename - = symtab_to_filename_for_display (b->loc->symtab); + = symtab_to_filename_for_display (loc->symtab); gdb_printf (": file %ps, line %d.", styled_string (file_name_style.style (), filename), - b->loc->line_number); + loc->line_number); } else /* This is not ideal, but each location may have a different file name, and this at least reflects the real situation somewhat. */ - gdb_printf (": %s.", b->locspec->to_string ()); + gdb_printf (": %s.", locspec->to_string ()); } - if (b->loc->next) + if (loc->next) { - struct bp_location *loc = b->loc; + struct bp_location *loc = loc; int n = 0; for (; loc; loc = loc->next) ++n; @@ -11794,7 +11793,7 @@ ordinary_breakpoint::print_mention () const break; } - say_where (this); + say_where (); } void @@ -12054,7 +12053,7 @@ tracepoint::print_mention () const internal_error (_("unhandled tracepoint type %d"), (int) type); } - say_where (this); + say_where (); } void diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7289a09e95c..399bd037977 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -898,6 +898,10 @@ struct code_breakpoint : public breakpoint (location_spec *locspec, struct program_space *search_pspace, int *found); + + /* Helper for breakpoint and tracepoint breakpoint->mention + callbacks. */ + void say_where () const; }; /* An instance of this type is used to represent a watchpoint, -- 2.38.1