public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/15642] New: Crash using 'rbreak'
@ 2013-06-18  8:56 vgiraud at neotion dot com
  2013-06-18 10:19 ` [Bug cli/15642] " vgiraud at neotion dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vgiraud at neotion dot com @ 2013-06-18  8:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15642

            Bug ID: 15642
           Summary: Crash using 'rbreak'
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: minor
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: vgiraud at neotion dot com

Hi all,

I've found something strange trying to use 'rbreak'
I instantanetly get a segfault. A bt bring me in gdb code, here :
jimregexp.c:1021
static int regtry( regex_t *preg, const char *string )
{
    int i;

    preg->reginput = string;

    for (i = 0; i < preg->nmatch; i++) {
        preg->pmatch[i].rm_so = -1;
        preg->pmatch[i].rm_eo = -1;
    }
    if (regmatch(preg, 1)) {
        preg->pmatch[0].rm_so = string - preg->start;
        preg->pmatch[0].rm_eo = preg->reginput - preg->start; // It crash here
!!!
        return(1);
    } else
        return(0);
}

If I go back I see that the problem may come from here :
symtab.c:3386
static int
search_symbols_name_matches (const char *symname, void *user_data)
{
  struct search_symbols_data *data = user_data;

  return !data->preg_p || regexec (&data->preg, symname, 0, NULL, 0) == 0;
}

Signature of regexec :
int regexec(regex_t  *preg,  const  char *string, size_t nmatch, regmatch_t
pmatch[], int eflags)

Why NULL ?? It's clear that if pmatch is NULL preg->pmatch[0].rm_eo =
preg->reginput - preg->start; can't work !

I only load an .elf and type rbreak 1. I know it's not like that it work, but
it should not segfault.

Vivien !

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-05  2:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  8:56 [Bug cli/15642] New: Crash using 'rbreak' vgiraud at neotion dot com
2013-06-18 10:19 ` [Bug cli/15642] " vgiraud at neotion dot com
2013-06-18 14:00 ` tromey at redhat dot com
2022-12-05  2:57 ` tromey at sourceware dot org

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).