Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Omair Javaid <omair.javaid@linaro.org>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <yao@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] testsuite/gdb.dwarf2: Fix for dw2-ifort-parameter failure on ARM
Date: Thu, 16 Jan 2014 13:55:00 -0000	[thread overview]
Message-ID: <52D7E4C5.4040504@linaro.org> (raw)
In-Reply-To: <52D7D222.9020403@redhat.com>

On Thu 16 Jan 2014 05:35:46 PM PKT, Pedro Alves wrote:
> On 01/16/2014 10:26 AM, Omair Javaid wrote:
>>
>>
>> On 01/16/2014 02:48 PM, Pedro Alves wrote:
>>> On 01/16/2014 09:03 AM, Omair Javaid wrote:
>>>
>>>> There seemed no problem with how breakpoint addresses were being adjusted. 
>>>> This test requires to build dwarf info by hand in dw2-ifort-parameter-debug.S
>>>> using compile time addresses so in case of arm (thumb mode) the least
>>>> significant bits of compile time address are set to 1. For that reason 
>>>> 0x000083bd was being used as a breakpoint address func. 
>>>
>>> OOC, what does the compiler debug info usually do instead to avoid this?
>>>
>>
>> Here is what compiler generates when there are thumb functions to handle:
>>         .thumb_func
>>         .type func, %function
>> func:
>> .LFB0:
>>
>> func is marked as thumb function and thus this func pointer will have the 
>> lower bit set. While .LFB0: non thumb label will be used to mark function
>> start address. Like this:         .4byte .LFB0 @ DW_AT_low_pc
>
> Ah.  I wonder if this works for you (and everyone).
>
> ---
>  gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S | 4 ++--
>  gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c       | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S
> index c7dd9be..6b08cb2 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S
> @@ -35,8 +35,8 @@
>  	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
>  	.byte		1			/* DW_AT_external */
>  	.ascii		"func\0"		/* DW_AT_name */
> -	.4byte		func			/* DW_AT_low_pc */
> -	.4byte		main			/* DW_AT_high_pc */
> +	.4byte		func_addr		/* DW_AT_low_pc */
> +	.4byte		main_addr		/* DW_AT_high_pc */
>  
>  	.uleb128	3			/* Abbrev: DW_TAG_formal_parameter */
>  	.ascii		"param\0"		/* DW_AT_name */
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
> index 361c44d..c866b0f 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
> @@ -29,3 +29,9 @@ main (void)
>    func ();
>    return 0;
>  }
> +
> +/* Addresses represented as data symbols, thus without Thumb (etc.)
> +   mode bits.  The dw2-ifort-parameter-debug.S file uses this as
> +   func's low_pc/high_pc.  */
> +extern void *func_addr __attribute__ ((alias ("func")));
> +extern void *main_addr __attribute__ ((alias ("main")));

Patch doesnt fix the issue and builds after making changes to alias definition like:

extern void func_addr() __attribute__ ((alias ("func")));
extern void main_addr() __attribute__ ((alias ("main")));

I have actually tried similar stuff before by adding:

asm(".globl func_addr");
asm(".4byte func_addr");

but issues remains the same.

Heres the output with your patch:

warning: Breakpoint address adjusted from 0x000083c5 to 0x000083c4.
Breakpoint 1 at 0x83c4 (2 locations)
(gdb) run 
Starting program: /home/omair/gdb_dev/gdb/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter 
warning: Breakpoint address adjusted from 0x000083c5 to 0x000083c4.
warning: Breakpoint address adjusted from 0x000083c5 to 0x000083c4.
warning: Breakpoint address adjusted from 0x000083c5 to 0x000083c4.
warning: Breakpoint 1 address previously adjusted from 0x000083c5 to 0x000083c4.

Breakpoint 1, 0x000083c4 in func_addr ()
(gdb) p/x param
No symbol "param" in current context.
(gdb) FAIL: gdb.dwarf2/dw2-ifort-parameter.exp: p/x param
testcase ./gdb.dwarf2/dw2-ifort-parameter.exp completed in 1 seconds


  reply	other threads:[~2014-01-16 13:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANW4E-2bQYjx6YdR3qGyKUsQa_KOrtmkWsZYqKzcuQBF==RPpw@mail.gmail.com>
2013-07-15 10:25 ` Omair Javaid
2013-07-16  2:53   ` Yao Qi
2013-09-19 15:31     ` Omair Javaid
2013-10-01  9:53       ` Omair Javaid
2013-11-11  9:53       ` Yao Qi
2014-01-16  9:09         ` Omair Javaid
2014-01-16  9:17           ` Will Newton
2014-01-16  9:48           ` Pedro Alves
2014-01-16  9:51             ` Pedro Alves
2014-01-16 10:26             ` Omair Javaid
2014-01-16 12:35               ` Pedro Alves
2014-01-16 13:55                 ` Omair Javaid [this message]
2014-01-16 14:00                   ` Pedro Alves
2014-01-16 14:17                     ` Omair Javaid
2014-01-16 16:24                       ` Pedro Alves

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=52D7E4C5.4040504@linaro.org \
    --to=omair.javaid@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=yao@codesourcery.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