Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Craig Blackmore <craig.blackmore@embecosm.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Cc: Simon Cook <simon.cook@embecosm.com>
Subject: Re: [PATCH] Add missing null pointer check in get_sal_arch
Date: Fri, 21 Aug 2026 10:51:48 +0100	[thread overview]
Message-ID: <c7785a92-27b1-4fee-b5d3-3901129f20db@embecosm.com> (raw)
In-Reply-To: <48674391-f007-412e-8e47-3911d75b9378@suse.de>

Hi Tom,

Thanks for the review. I will include these cleanups and the suggested
comment in an updated test case which I will post shortly.

Craig

On 31/07/2026 14:27, Tom de Vries wrote:
> On 7/29/26 5:06 PM, Craig Blackmore wrote:
>
> Hi,
>
> thanks for the patch.
>
> Here are some comments on the test-case.
>
>> new file mode 100644
>> index 00000000000..7758a591fa7
>> --- /dev/null
>> +++ b/gdb/testsuite/gdb.base/bp-non-alloc.exp
>> @@ -0,0 +1,36 @@
>> +# Copyright (C) 2026 Free Software Foundation, Inc.
>> +#
>> +# This program is free software; you can redistribute it and/or modify
>> +# it under the terms of the GNU General Public License as published by
>> +# the Free Software Foundation; either version 3 of the License, or
>> +# (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program.  If not, see<http://www.gnu.org/licenses/>.
>> +
>> +# For an ELF that has no section called ".text" and the first 
>> section is
>> +# non-alloc, test that a breakpoint can be set on a function. This 
>> previously
>> +# caused GDB to crash due to a missing null pointer check.
>> +
>> +require is_elf_target
>> +
>> +global srcdir
>> +global subdir
>> +
>
> These can be dropped, they are only necessary inside a proc.
>
>> +standard_testfile
>> +
>> +set linker_script $srcdir/$subdir/$testfile.ld
>> +
>> +set options "debug ldscript=-Wl,-T${linker_script}"
>> +if {[build_executable "failed to prepare" $testfile $srcfile 
>> $options]} {
>> +    return -1
>> +}
>> +
>> +clean_restart $testfile
>> +
>
> The clean_restart can be dropped if you use prepare_for_testing 
> instead of build_executable.
>
>> +gdb_test "break main" "Breakpoint .* at .*"
>
> You could also use "gdb_breakpoint main -message".
>
> At this point, I wouldn't mind a comment pointing out that we don't 
> run to main.  I tried it out, and ran into a SIGSEGV in the inferior.  
> I'm assuming that's expected:
> ...
> $ readelf -h outputs/gdb.base/bp-non-alloc/bp-non-alloc | grep Entry
>   Entry point address:               0x0
> ...
>
> So, perhaps something like:
> ...
> # The executable doesn't support actually running, so we don't run to
> # main here.
> ...
>
> Thanks,
> - Tom

  reply	other threads:[~2026-08-21  9:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 15:06 Craig Blackmore
2026-07-31 13:27 ` Tom de Vries
2026-08-21  9:51   ` Craig Blackmore [this message]
2026-07-31 13:54 ` Andrew Burgess
2026-08-21 10:09   ` Craig Blackmore
2026-07-31 14:31 ` Andrew Burgess
2026-07-31 15:27   ` Andrew Burgess
2026-08-21 10:25     ` Craig Blackmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7785a92-27b1-4fee-b5d3-3901129f20db@embecosm.com \
    --to=craig.blackmore@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.cook@embecosm.com \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox