public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Mike Gulick <mike.gulick@mathworks.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][PATCH] fix gdb segv when objfile can't be opened
Date: Thu, 19 Oct 2017 20:10:00 -0000	[thread overview]
Message-ID: <402f0a7a85cc7c3ba1c26cd296d570a1@polymtl.ca> (raw)
In-Reply-To: <c02f2408-7da3-710c-f278-48b682679c48@mathworks.com>

On 2017-10-19 15:39, Mike Gulick wrote:
> I had trouble figuring out what the 'error' function actually does (I
> couldn't find where it was defined).  When I'm stepping through GDB in
> the debugger, the lines past 'error' never seem to get called.  It's
> like 'error' throws an exception that is caught elsewhere.

Indeed, "error" throws an exception.  You should be able at least to 
step into the error function (although it's not particularly useful nor 
interesting).  It is defined in common/errors.c.

> I was also
> unable to figure out why the error message isn't displayed.  The new
> reproducer shows this issue.  I wasn't sure if setting *size or even
> descriptor->size was the right thing to do, but it seemed reasonable to
> me since the comment in gdb_bfd.h states that this function updates
> *size.  There's currently only one caller for 'gdb_bfd_map_section', so
> I have no problem updating *size there if that is preferred.

Actually it says "If successful, the section data is returned and *SIZE 
is set to the size of the section data;".  And this is what I would 
generally expect from functions.  Unless stated otherwise, the value of 
output parameters should be considered undefined if the function failed. 
  So I would lean towards blaming the caller for not taking enough 
precautions.  It trusts that gdb_bfd_map_section won't fail.

Simon

  reply	other threads:[~2017-10-19 20:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 14:10 Mike Gulick
2017-10-19 15:59 ` Mike Gulick
2017-10-19 17:54   ` Simon Marchi
2017-10-19 19:39     ` Mike Gulick
2017-10-19 20:10       ` Simon Marchi [this message]
2017-10-19 22:13         ` Mike Gulick
2017-10-23 23:19     ` Mike Gulick
2017-10-27 21:11       ` Simon Marchi
2017-10-28  1:19       ` Simon Marchi
2017-10-30 22:14         ` Mike Gulick
2017-10-30 23:38           ` Simon Marchi
2018-01-07 14:09             ` Simon Marchi
2018-01-08  0:45               ` Mike Gulick
2018-01-08  2:50                 ` Simon Marchi
2018-01-08  2:51                   ` Simon Marchi
2018-01-10 20:33                     ` Mike Gulick
2018-01-12  2:44                       ` Simon Marchi
2018-01-12 15:05                         ` Mike Gulick
2018-01-17 18:01                           ` Simon Marchi
2018-01-18 15:30                             ` Mike Gulick

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=402f0a7a85cc7c3ba1c26cd296d570a1@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=mike.gulick@mathworks.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).