[Bug breakpoints/25280] New: breaking on pointer functions without specifying an asterisk yields an unexpected result.

me at tomaszubiri dot com sourceware-bugzilla@sourceware.org
Sat Dec 14 19:56:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=25280

            Bug ID: 25280
           Summary: breaking on pointer functions without specifying an
                    asterisk yields an unexpected result.
           Product: gdb
           Version: 8.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: me at tomaszubiri dot com
  Target Milestone: ---

Suppose we are inspecting a program and we encounter the following line:

a = foo()

We would like to enter this function and find where it's declared without
running
a grep search, so we run

break foo

If the function is defined as:

int *foo


then we can get the following, non-useful result.

(gdb) run
foo (name=0x0) at otherfile.c:1589
1589             unrelated_function();


the expected result would be one of the following:

1) gdb looks for foo, since it doesn't find it, it looks for *foo, if it finds
it, it assumes we meant *foo.

2) gdb returns that function foo was not found.


The specific case were I ran into this was when debugging the git source code,
I ran the following commands

break branch_get
run push

the result was:

branch_get (name=0x0) at remote.c:1589
1589            read_config();

Running break *branch_get solved the problem and returns:

(gdb) break *get_branch
Breakpoint 6 at 0x5555557e1849: file wt-status.c, line 1493.

What do you think? Are these solutions possible to implement without causing an
issue for other users?

Thank you for reading.

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


More information about the Gdb-prs mailing list