public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15802] New: (gdb) start will run entire program if there is no "main" symbol
@ 2013-07-30  7:10 b.r.longbons at gmail dot com
  2013-07-30 13:56 ` [Bug breakpoints/15802] " palves at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: b.r.longbons at gmail dot com @ 2013-07-30  7:10 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 15802
           Summary: (gdb) start will run entire program if there is no
                    "main" symbol
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: b.r.longbons at gmail dot com

(gdb) start    will try to run the entire program if it fails to set the
breakpoint on main.

(Of course, arguably it's wrong to break specifically on main, since there may
be static constructors that run earlier ...)

$ gdb /bin/true
GNU gdb (GDB) 7.6 (Debian 7.6-5)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Parsing .gdbinit
Reading symbols from /bin/true...(no debugging symbols found)...done.
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n

Starting program: /bin/true 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Inferior 1 (process 31851) exited normally]
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Temporary breakpoint 1 (main) pending.
Starting program: /bin/true 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Inferior 1 (process 31855) exited normally]

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


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

* [Bug breakpoints/15802] (gdb) start will run entire program if there is no "main" symbol
  2013-07-30  7:10 [Bug breakpoints/15802] New: (gdb) start will run entire program if there is no "main" symbol b.r.longbons at gmail dot com
@ 2013-07-30 13:56 ` palves at redhat dot com
  2024-01-08 16:52 ` ssbssa at sourceware dot org
  2024-01-09  0:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: palves at redhat dot com @ 2013-07-30 13:56 UTC (permalink / raw)
  To: gdb-prs

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

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
Thanks for filing this.  It's annoyed me before too.

> (Of course, arguably it's wrong to break specifically on main, since there 
> may be static constructors that run earlier ...)

That's how the command is defined:

 (gdb) help start
 Run the debugged program until the beginning of the main procedure.
 You may specify arguments to give to your program, just as with the
 "run" command.

I once hacked a patch to add a "create" command, that creates the inferior
process, but leaves it held at the entry point.  This was like setting a break
at the entry point (b *_start; run), but easier, with no breakpoint at all:

 https://github.com/palves/gdb/commit/be1bc6c802bc5f07b648f45901120dae2278c330

Never got myself to gather enough strength to submit and face the potential
bikeshed.  :-)

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


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

* [Bug breakpoints/15802] (gdb) start will run entire program if there is no "main" symbol
  2013-07-30  7:10 [Bug breakpoints/15802] New: (gdb) start will run entire program if there is no "main" symbol b.r.longbons at gmail dot com
  2013-07-30 13:56 ` [Bug breakpoints/15802] " palves at redhat dot com
@ 2024-01-08 16:52 ` ssbssa at sourceware dot org
  2024-01-09  0:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-08 16:52 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
Does the 'starti' command satisfy to resolve this ticket?

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

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

* [Bug breakpoints/15802] (gdb) start will run entire program if there is no "main" symbol
  2013-07-30  7:10 [Bug breakpoints/15802] New: (gdb) start will run entire program if there is no "main" symbol b.r.longbons at gmail dot com
  2013-07-30 13:56 ` [Bug breakpoints/15802] " palves at redhat dot com
  2024-01-08 16:52 ` ssbssa at sourceware dot org
@ 2024-01-09  0:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2024-01-09  0:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Hannes Domani from comment #2)
> Does the 'starti' command satisfy to resolve this ticket?

starti definitely addresses comment #1 but I wonder if
it would be better for 'start' to fail if no appropriate
'main' can be found. After all in this situation you
could get the same behavior form 'run'.

-- 
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:[~2024-01-09  0:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30  7:10 [Bug breakpoints/15802] New: (gdb) start will run entire program if there is no "main" symbol b.r.longbons at gmail dot com
2013-07-30 13:56 ` [Bug breakpoints/15802] " palves at redhat dot com
2024-01-08 16:52 ` ssbssa at sourceware dot org
2024-01-09  0:02 ` 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).