public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/18144] New: the skip prologue functionality doesn't work well for same assembly functions
@ 2015-03-19 11:16 mihail.nistor at freescale dot com
  2015-03-19 13:18 ` [Bug tdep/18144] [aarch64] " mihail.nistor at freescale dot com
  2015-03-19 18:36 ` [Bug breakpoints/18144] " keiths at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: mihail.nistor at freescale dot com @ 2015-03-19 11:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18144
           Summary: the skip prologue functionality doesn't work well for
                    same assembly functions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: mihail.nistor at freescale dot com

Created attachment 8198
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8198&action=edit
an example, gdb and gcc information

The gdb always sets the break-point to an assembly function (or a symbol) at
the next line when the ASM file is compiled with debug information (-g option)
even if the function does not have prologue instructions. 

Let's have an example:

  .global _start
_start: 
    nop
    nop
  ret

The gdb will put the break-point at the second nop instruction - that is wrong
- when the user uses the break-point _start command.
In this scenario, the gdb should put the break-point at the first nop
instruction.

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


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

* [Bug tdep/18144] [aarch64] the skip prologue functionality doesn't work well for same assembly functions
  2015-03-19 11:16 [Bug tdep/18144] New: the skip prologue functionality doesn't work well for same assembly functions mihail.nistor at freescale dot com
@ 2015-03-19 13:18 ` mihail.nistor at freescale dot com
  2015-03-19 18:36 ` [Bug breakpoints/18144] " keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: mihail.nistor at freescale dot com @ 2015-03-19 13:18 UTC (permalink / raw)
  To: gdb-prs

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

Mihail-Marian Nistor <mihail.nistor at freescale dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64
                 CC|                            |mihail.nistor at freescale dot com
            Summary|the skip prologue           |[aarch64] the skip prologue
                   |functionality doesn't work  |functionality doesn't work
                   |well for same assembly      |well for same assembly
                   |functions                   |functions

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


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

* [Bug breakpoints/18144] [aarch64] the skip prologue functionality doesn't work well for same assembly functions
  2015-03-19 11:16 [Bug tdep/18144] New: the skip prologue functionality doesn't work well for same assembly functions mihail.nistor at freescale dot com
  2015-03-19 13:18 ` [Bug tdep/18144] [aarch64] " mihail.nistor at freescale dot com
@ 2015-03-19 18:36 ` keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: keiths at redhat dot com @ 2015-03-19 18:36 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com
          Component|tdep                        |breakpoints
           Severity|normal                      |enhancement

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
In the attachment is a reproducer:

---- from readme.txt in the attachment ----
1) The command line to compile the assembly file with debug information
aarch64-none-elf-gcc -O0 -g -nostartfiles -o main.elf main.S

2) You can see below the steps in order to reproduce the aarch64 gdb problem.
aarch64-none-elf-gdb main.elf
(gdb) b _start
Breakpoint 1 at 0x400028: file main.S, line 4.

Observed:
The breakpoint was set at the second nop instruction. 
Expected:
The breakpoint should be set at the first nop instruction.
---- end readme.txt ----

The problem here is that when you use the break command and give it a linespec
location, it *will* attempt to skip prologue instructions. Always.

However, if you give it an address location instead, gdb will *not* attempt to
skip the prologue. I guess some of us old-timers have the proper idiom hammered
into our fingers already.

Using "break *_start" should better suit your needs when debugging assembler
source files.

I am recategorizing this to "enhancement" because I think it might be desirable
to change the behavior based on the source language, e.g., if the source
language of a breakpoint location is assembler, do not do prologue-skipping. I
can see arguments both ways for this, so I will wait for maintainers to weigh
in on the issue.

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


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

end of thread, other threads:[~2015-03-19 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 11:16 [Bug tdep/18144] New: the skip prologue functionality doesn't work well for same assembly functions mihail.nistor at freescale dot com
2015-03-19 13:18 ` [Bug tdep/18144] [aarch64] " mihail.nistor at freescale dot com
2015-03-19 18:36 ` [Bug breakpoints/18144] " keiths at redhat dot com

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