public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
@ 2011-06-26 20:00 iam ahal
  2011-06-26 20:49 ` Phil Muldoon
  2012-04-09 15:39 ` Jan Kratochvil
  0 siblings, 2 replies; 69+ messages in thread
From: iam ahal @ 2011-06-26 20:00 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]

Some build systems (e.g. mozilla firefox) provides build of source
code with only full path to files (i.e. pass to gcc full path to
file).
Sometimes it's difficult to change build (especially if it's huge
project). If you debug compiled program you may see full path in
backtraces, like this:

(gdb) backtrace
#0  main (argc=4, argv=0xbffff884) at
/media/25b7639d-9a70-42ca-aaa7-28f4d1f417fd/firefox-dev/mozilla-central/browser/app/nsBrowserApp.cpp:204

I'm uncomfortable to read such backtraces.

I've implemented the new feature (patch for gdb-7.2 release from
"02-Sep-2010 20:12"):
New argument for "backtrace" called "nopath". If you run "backtrace
nopath" you will see something like this:

(gdb) backtrace nopath
#0  main (argc=4, argv=0xbffff884) at nsBrowserApp.cpp:204

(instead above result)

"nopath" argument just cuts full path to file and remains only filename.

If you think that this feature is useful for somebody you can see
ChangeLog and patch in attachment.
If it's useful feature but i made some mistakes (e.g. made ugly names)
i will change it if you want.

P.S. Sorry for my poor english.

ChangeLog:

2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>:

* stack.c (backtrace_command): Created new variable "nofull_path" for
implementation of "backtrace nopath" command.
                               It has similar logic as "fulltrace_arg"
for "backtrace full" command.
          (backtrace_full_command): nofull_path is just zero (i.e.
it's not used there).
          (backtrace_command_stub): just pass new argument
("args->nofull_path") to backtrace_command_1
          (backtrace_command_1): if "nofull_path" is enabled (by
"backtrace nopath") then call print_frame_info with LOC_NO_FULLPATH.
          (print_frame_info): work with LOC_NO_FULLPATH same as
LOCATION (because it's almost same thing).
          (print_frame): if LOC_NO_FULLPATH was passed then cut
fullpath (if exist) and remain only filename.
* frame.h (enum print_what): Added LOC_NO_FULLPATH with comment.

[-- Attachment #2: gdb-7.2-nofull-path.patch --]
[-- Type: text/x-patch, Size: 5462 bytes --]

diff -rup -x configure gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-06-26 21:56:52.000000000 +0400
@@ -582,7 +582,10 @@ enum print_what
     /* Print both of the above. */
     SRC_AND_LOC, 
     /* Print location only, but always include the address. */
-    LOC_AND_ADDRESS 
+    LOC_AND_ADDRESS,
+    /* Print only the location but without the full path to file,         *
+     * i.e. print only filename even if full path is defined in symtable. */
+    LOC_NO_FULLPATH
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
diff -rup -x configure gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-06-26 22:36:41.000000000 +0400
@@ -592,7 +592,8 @@ print_frame_info (struct frame_info *fra
 
   location_print = (print_what == LOCATION 
 		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+		    || print_what == SRC_AND_LOC
+            || print_what == LOC_NO_FULLPATH);
 
   if (location_print || !sal.symtab)
     print_frame (frame, print_level, print_what, print_args, sal);
@@ -652,7 +653,7 @@ print_frame_info (struct frame_info *fra
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
     set_default_breakpoint (1, sal.pspace,
 			    get_frame_pc (frame), sal.symtab, sal.line);
 
@@ -810,11 +811,24 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+
+      filename = NULL;
+      if (print_what == LOC_NO_FULLPATH)
+     {
+      filename = strrchr( sal.symtab->filename, '/' );
+      if (filename != NULL)
+        filename++;
+     }
+      if (filename == NULL || *filename == '\0')
+        filename = sal.symtab->filename;
+
+      ui_out_field_string (uiout, "file", filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
@@ -1269,7 +1283,7 @@ frame_info (char *addr_exp, int from_tty
    frames.  */
 
 static void
-backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty, int nofull_path)
 {
   struct frame_info *fi;
   int count;
@@ -1345,7 +1359,11 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          hand, perhaps the code does or could be fixed to make sure
          the frame->prev field gets set to NULL in that case).  */
-      print_frame_info (fi, 1, LOCATION, 1);
+      if (nofull_path)
+        print_frame_info (fi, 1, LOC_NO_FULLPATH, 1);
+      else
+        print_frame_info (fi, 1, LOCATION, 1);
+
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
 
@@ -1375,6 +1393,7 @@ struct backtrace_command_args
   char *count_exp;
   int show_locals;
   int from_tty;
+  int nofull_path;
 };
 
 /* Stub for catch_errors.  */
@@ -1384,7 +1403,7 @@ backtrace_command_stub (void *data)
 {
   struct backtrace_command_args *args = data;
 
-  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
+  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty, args->nofull_path);
   return 0;
 }
 
@@ -1392,7 +1411,7 @@ static void
 backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = NULL;
-  int fulltrace_arg = -1, arglen = 0, argc = 0;
+  int fulltrace_arg = -1, arglen = 0, argc = 0, nofull_path = -1;
   struct backtrace_command_args btargs;
 
   if (arg)
@@ -1412,6 +1431,8 @@ backtrace_command (char *arg, int from_t
 
 	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
 	    fulltrace_arg = argc;
+      else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
+        nofull_path = argc;
 	  else
 	    {
 	      arglen += strlen (argv[i]);
@@ -1419,7 +1440,7 @@ backtrace_command (char *arg, int from_t
 	    }
 	}
       arglen += argc;
-      if (fulltrace_arg >= 0)
+      if (fulltrace_arg >= 0 || nofull_path >= 0)
 	{
 	  if (arglen > 0)
 	    {
@@ -1427,7 +1448,7 @@ backtrace_command (char *arg, int from_t
 	      memset (arg, 0, arglen + 1);
 	      for (i = 0; i < (argc + 1); i++)
 		{
-		  if (i != fulltrace_arg)
+		  if (i != fulltrace_arg && i != nofull_path)
 		    {
 		      strcat (arg, argv[i]);
 		      strcat (arg, " ");
@@ -1442,9 +1463,10 @@ backtrace_command (char *arg, int from_t
   btargs.count_exp = arg;
   btargs.show_locals = (fulltrace_arg >= 0);
   btargs.from_tty = from_tty;
+  btargs.nofull_path = (nofull_path >= 0);
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 
-  if (fulltrace_arg >= 0 && arglen > 0)
+  if ((fulltrace_arg >= 0 || nofull_path >= 0) && arglen > 0)
     xfree (arg);
 
   if (old_chain)
@@ -1459,6 +1481,7 @@ backtrace_full_command (char *arg, int f
   btargs.count_exp = arg;
   btargs.show_locals = 1;
   btargs.from_tty = from_tty;
+  btargs.nofull_path = 0;
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 }
 \f

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-26 20:00 [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename) iam ahal
@ 2011-06-26 20:49 ` Phil Muldoon
  2011-06-27 16:00   ` Joel Brobecker
  2011-06-28 20:08   ` Tom Tromey
  2012-04-09 15:39 ` Jan Kratochvil
  1 sibling, 2 replies; 69+ messages in thread
From: Phil Muldoon @ 2011-06-26 20:49 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches

iam ahal <hal9000ed2k@gmail.com> writes:

You could use Python to write a custom backtrace to do this.  But that
is neither here or there to this patch.  I have no opinion on the patch
implementation itself, but a few nits.

> ChangeLog:
>
> 2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>:

No ":" at the end of that line.

> * stack.c (backtrace_command): Created new variable "nofull_path" for
> implementation of "backtrace nopath" command.
>                                It has similar logic as "fulltrace_arg"
> for "backtrace full" command.
>           (backtrace_full_command): nofull_path is just zero (i.e.
> it's not used there).
>           (backtrace_command_stub): just pass new argument
> ("args->nofull_path") to backtrace_command_1
>           (backtrace_command_1): if "nofull_path" is enabled (by
> "backtrace nopath") then call print_frame_info with LOC_NO_FULLPATH.
>           (print_frame_info): work with LOC_NO_FULLPATH same as
> LOCATION (because it's almost same thing).
>           (print_frame): if LOC_NO_FULLPATH was passed then cut
> fullpath (if exist) and remain only filename.
> * frame.h (enum print_what): Added LOC_NO_FULLPATH with comment.

A few small things.  The general rule of ChangeLog files is "what"
changed, not "why".  Proper punctuation and capitalisation also.  The
indenting seems off, too.  Any continuation of a comment should continue
at the first "(" of the previous function in a ChangeLog.

> diff -rup -x configure gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
> --- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
> +++ gdb-7.2/gdb/frame.h	2011-06-26 21:56:52.000000000 +0400
> @@ -582,7 +582,10 @@ enum print_what
>      /* Print both of the above. */
>      SRC_AND_LOC, 
>      /* Print location only, but always include the address. */
> -    LOC_AND_ADDRESS 
> +    LOC_AND_ADDRESS,
> +    /* Print only the location but without the full path to file,         *
> +     * i.e. print only filename even if full path is defined in symtable. */
> +    LOC_NO_FULLPATH
>    };

Two spaces after "." even before the */.

>    location_print = (print_what == LOCATION 
>  		    || print_what == LOC_AND_ADDRESS
> -		    || print_what == SRC_AND_LOC);
> +		    || print_what == SRC_AND_LOC
> +            || print_what == LOC_NO_FULLPATH);

Not sure if this is an issue with your editor, mail, or just plain patch
weirdness, but this indention looks off.  The first + line is indented
correctly, the second looks like it is missing a tab.
 

> -  if (print_what != LOCATION)
> +  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
>      set_default_breakpoint (1, sal.pspace,
>  			    get_frame_pc (frame), sal.symtab, sal.line);

Indention, might be the patch interpretation too.

  
> -      ui_out_field_string (uiout, "file", sal.symtab->filename);
> +
> +      filename = NULL;
> +      if (print_what == LOC_NO_FULLPATH)
> +     {
> +      filename = strrchr( sal.symtab->filename, '/' );
> +      if (filename != NULL)
> +        filename++;
> +     }

Indention, and space between function name and (.  IE, strrchr (.

>  /* Stub for catch_errors.  */
> @@ -1384,7 +1403,7 @@ backtrace_command_stub (void *data)
>  {
>    struct backtrace_command_args *args = data;
>  
> -  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
> +  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty, args->nofull_path);

This function probably need to be wrapped onto the next line.

>  	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
>  	    fulltrace_arg = argc;
> +      else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
> +        nofull_path = argc;
>  	  else
>  	    {

Indention looks a little off. The "else" should match the preceding "if"
and "nofull_patch..." line match the indention of the "fulltrace_argc =
arg" line.  Once again this may be a mailer issue on my part, but some
of your indention looks correct, while others look off.  Anyway please
check.

You should have a testing statement indicating that it has not
regressed any existing functionality, as well as the architecture/distro
you tested it on.  So you should run the GDB testsuite to test the
effects of your patch, before and after.  Also as this patch introduces
new functionality, you should write tests that test that functionality.
This helps prove the patch, and help the maintainers catch future
regressions.

This patch probably need a documentation patch to document the new
backtrace option.

Finally, I am not a maintainer, so don't take anything I have said as
approval for the patch. ;)  One of the maintainers will separately
comment on it. 

Thanks for your effort, and your patch!

Cheers,

Phil

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-26 20:49 ` Phil Muldoon
@ 2011-06-27 16:00   ` Joel Brobecker
  2011-06-27 16:18     ` Phil Muldoon
                       ` (2 more replies)
  2011-06-28 20:08   ` Tom Tromey
  1 sibling, 3 replies; 69+ messages in thread
From: Joel Brobecker @ 2011-06-27 16:00 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: iam ahal, gdb-patches

> You could use Python to write a custom backtrace to do this.  But that
> is neither here or there to this patch.

Yeah, I am wondering which way would be best. It seems like a Python
backtrace decorator would already work, or could be made to work.
But on the other hand, we can't ignore the fact that linking against
the Python library is not necessary easy. In particular, things seems
to work OK on Windows, but I noticed that GDB crashes when trying to
source a Python script. I haven't tried linking with Python on x64
Windows yet.

So, there are pluses and minuses on both ends.  I am wondering
what everyone else thinks...

If we were to implement this in GDB itself, I'd rather go with
a setting rather than a command-line option. But that's just
a suggestion.

-- 
Joel

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-27 16:00   ` Joel Brobecker
@ 2011-06-27 16:18     ` Phil Muldoon
  2011-06-28 20:08     ` Tom Tromey
  2011-07-03 18:15     ` Daniel Jacobowitz
  2 siblings, 0 replies; 69+ messages in thread
From: Phil Muldoon @ 2011-06-27 16:18 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: iam ahal, gdb-patches

Joel Brobecker <brobecker@adacore.com> writes:

>> You could use Python to write a custom backtrace to do this.  But that
>> is neither here or there to this patch.
>
> Yeah, I am wondering which way would be best. It seems like a Python
> backtrace decorator would already work, or could be made to work.
> But on the other hand, we can't ignore the fact that linking against
> the Python library is not necessary easy. In particular, things seems
> to work OK on Windows, but I noticed that GDB crashes when trying to
> source a Python script. I haven't tried linking with Python on x64
> Windows yet.

Yeah, agreed. Eventually my plan is to move all of the Python backtrace
code (as in the actual Python backtrace code written in Python) into GDB
'C' and implement call backs for a Python scripter to use.  But that
still won't solve the Python-on-X-platform issue.

> So, there are pluses and minuses on both ends.  I am wondering
> what everyone else thinks...
>
> If we were to implement this in GDB itself, I'd rather go with
> a setting rather than a command-line option. But that's just
> a suggestion.

Good point.  I have no strong opinion either way.  I think this would be
a cool addition, though.

Cheers

Phil

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-27 16:00   ` Joel Brobecker
  2011-06-27 16:18     ` Phil Muldoon
@ 2011-06-28 20:08     ` Tom Tromey
  2011-06-28 22:36       ` Phil Muldoon
                         ` (2 more replies)
  2011-07-03 18:15     ` Daniel Jacobowitz
  2 siblings, 3 replies; 69+ messages in thread
From: Tom Tromey @ 2011-06-28 20:08 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Phil Muldoon, iam ahal, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

>> You could use Python to write a custom backtrace to do this.  But that
>> is neither here or there to this patch.

Joel> Yeah, I am wondering which way would be best. It seems like a Python
Joel> backtrace decorator would already work, or could be made to work.

We have a plan to implement "frame filters" in Python.  The idea here is
basically pretty-printing for backtraces -- let libraries ship Python
code to modify frames while they are being displayed.  E.g., the Python
interpreter could replace C frames with synthetic frames representing
the Python stack.

Full details are available somewhere -- either archer or gdb list
archives.  If you want to read them and can't find them, let me know,
and I will either dig them up or write them again.

Phil would have to say the status of this work.

Joel> So, there are pluses and minuses on both ends.  I am wondering
Joel> what everyone else thinks...

I am happy adding any vaguely sensible setting that people want to the
core.  Why not?  The time more minimalism has long passed.

Whether this one meets the bar, I don't know.  Is basename really the
obvious transform to apply?  What about just dropping the compilation
directory?

Joel> If we were to implement this in GDB itself, I'd rather go with
Joel> a setting rather than a command-line option. But that's just
Joel> a suggestion.

Definitely a setting and not a command-line option.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-26 20:49 ` Phil Muldoon
  2011-06-27 16:00   ` Joel Brobecker
@ 2011-06-28 20:08   ` Tom Tromey
  1 sibling, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2011-06-28 20:08 UTC (permalink / raw)
  To: pmuldoon; +Cc: iam ahal, gdb-patches

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> Finally, I am not a maintainer, so don't take anything I have said as
Phil> approval for the patch. ;)  One of the maintainers will separately
Phil> comment on it. 

Thanks for the review, Phil.

Phil> Thanks for your effort, and your patch!

Also, Eldar, a patch this size will require copyright assignment papers
to be filed with the FSF.  Please email me off-list and I will get you
started on that.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-28 20:08     ` Tom Tromey
@ 2011-06-28 22:36       ` Phil Muldoon
  2011-07-03 18:12         ` iam ahal
  2011-06-29 10:09       ` Andrew Burgess
  2011-06-29 16:06       ` Joel Brobecker
  2 siblings, 1 reply; 69+ messages in thread
From: Phil Muldoon @ 2011-06-28 22:36 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Joel Brobecker, iam ahal, gdb-patches

Tom Tromey <tromey@redhat.com> writes:


> Joel> Yeah, I am wondering which way would be best. It seems like a Python
> Joel> backtrace decorator would already work, or could be made to work.
>
> We have a plan to implement "frame filters" in Python.  The idea here is
> basically pretty-printing for backtraces -- let libraries ship Python
> code to modify frames while they are being displayed.  E.g., the Python
> interpreter could replace C frames with synthetic frames representing
> the Python stack.
>
> Full details are available somewhere -- either archer or gdb list
> archives.  If you want to read them and can't find them, let me know,
> and I will either dig them up or write them again.
>
> Phil would have to say the status of this work.


This is long term work.  I hope to have it for 7.4.  The task is
complex, because I think the backtrace code right now is not too callback
friendly.  That being said, every new Python feature requires one to
become somewhat of an expert in that area. This is happy, if sometimes
long work.

Okay, enough excuses.  We need more GDB-Python hackers! I  don't want to
disappear down this hole for too long as there are other tasks that
are shorter term that I think are more important, and bugs that also
need addressing.  Tom and other have been doing a super job reviewing
existing Python patches, but I really need to do more of that.  If only
not to collide (like I did this week!) with the few others working in
this space. Anyway, the backtrace work is neat stuff.  It will be
implemented sooner rather than later.

> Joel> So, there are pluses and minuses on both ends.  I am wondering
> Joel> what everyone else thinks...
>
> I am happy adding any vaguely sensible setting that people want to the
> core.  Why not?  The time more minimalism has long passed.

Me too. Feature rich at this point.  Everyone wants something different
out of GDB, and debugging scenarios tend to be unique.  But I think some
features offer a common-ground, and this is one of them.

> Whether this one meets the bar, I don't know.  Is basename really the
> obvious transform to apply?  What about just dropping the compilation
> directory?

Well in this context, user-driven needs, to me, are the best bar.  If
this contributor has written this patch, with a specific need (not
super-specialised) in mind that is great.  I wish I had the backtrace
Pythonic interface ready, but, OTOH, every use-case is great to mould
that functionality. 

Cheers,

Phil

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-28 20:08     ` Tom Tromey
  2011-06-28 22:36       ` Phil Muldoon
@ 2011-06-29 10:09       ` Andrew Burgess
  2011-06-29 16:06       ` Joel Brobecker
  2 siblings, 0 replies; 69+ messages in thread
From: Andrew Burgess @ 2011-06-29 10:09 UTC (permalink / raw)
  To: gdb-patches

On 28/06/2011 21:07, Tom Tromey wrote:
>
> Whether this one meets the bar, I don't know.  Is basename really the
> obvious transform to apply?  What about just dropping the compilation
> directory?

I wonder if an option similar to how the -p switch too patch works might 
be a good fit?
The default value would be 0, leaving the path unchanged. A special 
value of -1 might give the basename behaviour, while any other positive 
value would strip off that number of leading directories (capped to the 
basename behaviour).



Andrew

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-28 20:08     ` Tom Tromey
  2011-06-28 22:36       ` Phil Muldoon
  2011-06-29 10:09       ` Andrew Burgess
@ 2011-06-29 16:06       ` Joel Brobecker
  2 siblings, 0 replies; 69+ messages in thread
From: Joel Brobecker @ 2011-06-29 16:06 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Phil Muldoon, iam ahal, gdb-patches

> Whether this one meets the bar, I don't know.  Is basename really the
> obvious transform to apply?  What about just dropping the compilation
> directory?

Seems like a good idea (too!).

-- 
Joel

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-28 22:36       ` Phil Muldoon
@ 2011-07-03 18:12         ` iam ahal
  2011-07-03 21:13           ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-07-03 18:12 UTC (permalink / raw)
  To: pmuldoon; +Cc: Tom Tromey, Joel Brobecker, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

I've read your review and i've corrected formatting on my patch. It's
seems correct now. I've also corrected ChangeLog but it was tricky for
myself (write correct and clear english and think about what is
necessary details that i have to write in ChangeLog).
I've wrote documentation for this feature. All of these you can find
in attachment.
I've run general testsuites in original unpatched gdb-7.2 and save
stdout and stderr to separate files. After i've run exactly same tests
(make check) in patched gdb-7.2 and save to another separate files.
diff between these files shows me that my patch don't bring side
effects. Of course i understand that general testsuites can check only
for rough mistakes. So i should learn DejaGNU to test my patch. I
think on how i can test possible side effects from my patch. I can
send 'make check' results if you want.
So my patch, doc patch and ChangeLog needs a new review in any case.
I'm also send separate email to Tom Tromey about how i should assign
copyright for the community.

On Wed, Jun 29, 2011 at 2:35 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> Tom Tromey <tromey@redhat.com> writes:

>> Whether this one meets the bar, I don't know.  Is basename really the
>> obvious transform to apply?  What about just dropping the compilation
>> directory?
>
> Well in this context, user-driven needs, to me, are the best bar.  If
> this contributor has written this patch, with a specific need (nota
> super-specialised) in mind that is great.  I wish I had the backtrace
> Pythonic interface ready, but, OTOH, every use-case is great to mould
> that functionality.
>
> Cheers,
>
> Phil
>

I thought on cutting off compilation path but i decided to make it
easier to start. If my tiny patch and idea is useful for somebody i
glad to improve this.

-- 
With best regards.
Eldar Gaynetdinov

[-- Attachment #2: gdb-7.2-nofull-path-3.patch --]
[-- Type: text/x-patch, Size: 5395 bytes --]

diff -rup gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-07-03 17:49:36.748460000 +0400
@@ -582,7 +582,10 @@ enum print_what
     /* Print both of the above. */
     SRC_AND_LOC, 
     /* Print location only, but always include the address. */
-    LOC_AND_ADDRESS 
+    LOC_AND_ADDRESS,
+    /* Print only the location but without the full path to file,          *
+     * i.e. print only filename even if full path is defined in symtable.  */
+    LOC_NO_FULLPATH
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
diff -rup gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-07-03 18:03:23.308460001 +0400
@@ -592,7 +592,8 @@ print_frame_info (struct frame_info *fra
 
   location_print = (print_what == LOCATION 
 		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+		    || print_what == SRC_AND_LOC
+		    || print_what == LOC_NO_FULLPATH);
 
   if (location_print || !sal.symtab)
     print_frame (frame, print_level, print_what, print_args, sal);
@@ -652,7 +653,7 @@ print_frame_info (struct frame_info *fra
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
     set_default_breakpoint (1, sal.pspace,
 			    get_frame_pc (frame), sal.symtab, sal.line);
 
@@ -810,11 +811,24 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+
+      filename = NULL;
+      if (print_what == LOC_NO_FULLPATH)
+	{
+	  filename = strrchr (sal.symtab->filename, '/');
+	  if (filename != NULL)
+	  filename++;
+	}
+      if (filename == NULL || *filename == '\0')
+	filename = sal.symtab->filename;
+
+      ui_out_field_string (uiout, "file", filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
@@ -1269,7 +1283,7 @@ frame_info (char *addr_exp, int from_tty
    frames.  */
 
 static void
-backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty, int nofull_path)
 {
   struct frame_info *fi;
   int count;
@@ -1345,7 +1359,11 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          hand, perhaps the code does or could be fixed to make sure
          the frame->prev field gets set to NULL in that case).  */
-      print_frame_info (fi, 1, LOCATION, 1);
+      if (nofull_path)
+	print_frame_info (fi, 1, LOC_NO_FULLPATH, 1);
+      else
+	print_frame_info (fi, 1, LOCATION, 1);
+
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
 
@@ -1375,6 +1393,7 @@ struct backtrace_command_args
   char *count_exp;
   int show_locals;
   int from_tty;
+  int nofull_path;
 };
 
 /* Stub for catch_errors.  */
@@ -1384,7 +1403,8 @@ backtrace_command_stub (void *data)
 {
   struct backtrace_command_args *args = data;
 
-  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
+  backtrace_command_1 (args->count_exp, args->show_locals,
+		       args->from_tty, args->nofull_path);
   return 0;
 }
 
@@ -1392,7 +1412,7 @@ static void
 backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = NULL;
-  int fulltrace_arg = -1, arglen = 0, argc = 0;
+  int fulltrace_arg = -1, arglen = 0, argc = 0, nofull_path = -1;
   struct backtrace_command_args btargs;
 
   if (arg)
@@ -1412,6 +1432,8 @@ backtrace_command (char *arg, int from_t
 
 	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
 	    fulltrace_arg = argc;
+	  else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
+	    nofull_path = argc;
 	  else
 	    {
 	      arglen += strlen (argv[i]);
@@ -1419,7 +1441,7 @@ backtrace_command (char *arg, int from_t
 	    }
 	}
       arglen += argc;
-      if (fulltrace_arg >= 0)
+      if (fulltrace_arg >= 0 || nofull_path >= 0)
 	{
 	  if (arglen > 0)
 	    {
@@ -1427,7 +1449,7 @@ backtrace_command (char *arg, int from_t
 	      memset (arg, 0, arglen + 1);
 	      for (i = 0; i < (argc + 1); i++)
 		{
-		  if (i != fulltrace_arg)
+		  if (i != fulltrace_arg && i != nofull_path)
 		    {
 		      strcat (arg, argv[i]);
 		      strcat (arg, " ");
@@ -1442,9 +1464,10 @@ backtrace_command (char *arg, int from_t
   btargs.count_exp = arg;
   btargs.show_locals = (fulltrace_arg >= 0);
   btargs.from_tty = from_tty;
+  btargs.nofull_path = (nofull_path >= 0);
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 
-  if (fulltrace_arg >= 0 && arglen > 0)
+  if ((fulltrace_arg >= 0 || nofull_path >= 0) && arglen > 0)
     xfree (arg);
 
   if (old_chain)
@@ -1459,6 +1482,7 @@ backtrace_full_command (char *arg, int f
   btargs.count_exp = arg;
   btargs.show_locals = 1;
   btargs.from_tty = from_tty;
+  btargs.nofull_path = 0;
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 }
 \f

[-- Attachment #3: gdb-7.2-nofull-path-texinfo.patch --]
[-- Type: text/x-patch, Size: 572 bytes --]

diff -rup gdb-7.2-doc-orig/gdb/doc/gdb.texinfo gdb-7.2/gdb/doc/gdb.texinfo
--- gdb-7.2-doc-orig/gdb/doc/gdb.texinfo	2010-09-01 23:15:59.000000000 +0400
+++ gdb-7.2/gdb/doc/gdb.texinfo	2011-07-03 17:36:48.328460001 +0400
@@ -5890,6 +5890,10 @@ Similar, but print only the outermost @v
 @itemx bt full -@var{n}
 Print the values of the local variables also.  @var{n} specifies the
 number of frames to print, as described above.
+
+@item backtrace nopath
+@itemx bt nopath
+It's similar to @code{backtrace}, but print without full path to file.
 @end table
 
 @kindex where

[-- Attachment #4: ChangeLog --]
[-- Type: application/octet-stream, Size: 1391 bytes --]

2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* frame.h (print_what): Added new element LOC_NO_FULLPATH with
	comment.
	* stack.c (print_frame_info): Added LOC_NO_FULLPATH in two places near
	LOCATION.
	(print_frame): Added new variable 'filename' in the condition
	scope and the new conditions in this scope with 'filename' and
	LOC_NO_FULLPATH before call ui_out_field_string with 'filename'.
	'sal.symtab->filename' is used in body of these new conditions.
	(backtrace_command_1): Added new argument of this function witn name
	'nofull_path'. Added new condition with 'nofull_path'. Arguments that
	are passed to print_frame_info depends on this new condition now.
	(backtrace_command_args): Added new member 'nofull_path'.
	(backtrace_command_stub): backtrace_command_1 is now called with new
	argument 'args->nofull_path'.
	(backtrace_command): Added new variable 'nofull_path' at this function
	scope. Added new condition with 'nofull_path' and 'argv[i]'. 'argc' is
	assigned to 'nofull_path' if this new condition is satisfied.
	Modified condition with 'fulltrace_arg' by adding 'nofull_path'.
	Modified condition with 'fulltrace_arg' in the for-loop by adding
	'nofull_path'. Added assignment with 'btargs.nofull_path'. Modified
	condition with 'fulltrace_arg' and 'arglen' by adding 'nofull_path'.
	(backtrace_full_command): Assign zero to 'btargs.nofull_path' was
	added.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-27 16:00   ` Joel Brobecker
  2011-06-27 16:18     ` Phil Muldoon
  2011-06-28 20:08     ` Tom Tromey
@ 2011-07-03 18:15     ` Daniel Jacobowitz
  2 siblings, 0 replies; 69+ messages in thread
From: Daniel Jacobowitz @ 2011-07-03 18:15 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Phil Muldoon, iam ahal, gdb-patches

On Mon, Jun 27, 2011 at 09:00:29AM -0700, Joel Brobecker wrote:
> Yeah, I am wondering which way would be best. It seems like a Python
> backtrace decorator would already work, or could be made to work.
> But on the other hand, we can't ignore the fact that linking against
> the Python library is not necessary easy. In particular, things seems
> to work OK on Windows, but I noticed that GDB crashes when trying to
> source a Python script. I haven't tried linking with Python on x64
> Windows yet.

FYI, when you get this symptom, it probably means (used to mean?) that
the Python library is linked to a different version of the MSVC
runtime than GDB is.

I think someone posted a patch to work around this issue by not
passing a FILE* to Python.  Then again, my memory's not so good... I
thought it was you... :-)

-- 
Daniel Jacobowitz

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-03 18:12         ` iam ahal
@ 2011-07-03 21:13           ` Eli Zaretskii
  2011-07-04 11:26             ` iam ahal
  0 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-07-03 21:13 UTC (permalink / raw)
  To: iam ahal; +Cc: pmuldoon, tromey, brobecker, gdb-patches

> Date: Sun, 3 Jul 2011 20:34:55 +0400
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: Tom Tromey <tromey@redhat.com>, Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
> 
> +@item backtrace nopath
> +@itemx bt nopath
> +It's similar to @code{backtrace}, but print without full path to file.

I would remove the "It's" part, it's redundant and not very
English-like.

But a larger concern is that GNU coding standards frown on using
"path" when you really mean "file name".  So I think we should rename
the option "basename" and the documentation should say

  Same as @code{backtrace}, but print only the basename of the file.

> +      if (print_what == LOC_NO_FULLPATH)
> +	{
> +	  filename = strrchr (sal.symtab->filename, '/');

This is non-portable (directory separator is not guaranteed to be
'/'), you need to use lbasename instead.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-03 21:13           ` Eli Zaretskii
@ 2011-07-04 11:26             ` iam ahal
  2011-07-04 12:05               ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-07-04 11:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pmuldoon, tromey, brobecker, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

On Sun, Jul 3, 2011 at 10:12 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> But a larger concern is that GNU coding standards frown on using
> "path" when you really mean "file name".  So I think we should rename
> the option "basename" and the documentation should say
>
>  Same as @code{backtrace}, but print only the basename of the file.

Fixed. New doc's patch in attachment. What's about backtrace's
argument name "nopath"?

> This is non-portable (directory separator is not guaranteed to be
> '/'), you need to use lbasename instead.

Fixed. Patch in attachment.

[-- Attachment #2: gdb-7.2-nofull-path-4.patch --]
[-- Type: text/x-patch, Size: 5342 bytes --]

diff -rup gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-07-04 12:38:24.756263001 +0400
@@ -582,7 +582,10 @@ enum print_what
     /* Print both of the above. */
     SRC_AND_LOC, 
     /* Print location only, but always include the address. */
-    LOC_AND_ADDRESS 
+    LOC_AND_ADDRESS,
+    /* Print only the location but without the full path to file,          *
+     * i.e. print only filename even if full path is defined in symtable.  */
+    LOC_NO_FULLPATH
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
diff -rup gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-07-04 12:44:58.866263001 +0400
@@ -592,7 +592,8 @@ print_frame_info (struct frame_info *fra
 
   location_print = (print_what == LOCATION 
 		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+		    || print_what == SRC_AND_LOC
+		    || print_what == LOC_NO_FULLPATH);
 
   if (location_print || !sal.symtab)
     print_frame (frame, print_level, print_what, print_args, sal);
@@ -652,7 +653,7 @@ print_frame_info (struct frame_info *fra
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
     set_default_breakpoint (1, sal.pspace,
 			    get_frame_pc (frame), sal.symtab, sal.line);
 
@@ -810,11 +811,21 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+
+      filename = NULL;
+      if (print_what == LOC_NO_FULLPATH)
+	filename = lbasename (sal.symtab->filename);
+
+      if (filename == NULL || *filename == '\0')
+	filename = sal.symtab->filename;
+
+      ui_out_field_string (uiout, "file", filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
@@ -1269,7 +1280,7 @@ frame_info (char *addr_exp, int from_tty
    frames.  */
 
 static void
-backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty, int nofull_path)
 {
   struct frame_info *fi;
   int count;
@@ -1345,7 +1356,11 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          hand, perhaps the code does or could be fixed to make sure
          the frame->prev field gets set to NULL in that case).  */
-      print_frame_info (fi, 1, LOCATION, 1);
+      if (nofull_path)
+	print_frame_info (fi, 1, LOC_NO_FULLPATH, 1);
+      else
+	print_frame_info (fi, 1, LOCATION, 1);
+
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
 
@@ -1375,6 +1390,7 @@ struct backtrace_command_args
   char *count_exp;
   int show_locals;
   int from_tty;
+  int nofull_path;
 };
 
 /* Stub for catch_errors.  */
@@ -1384,7 +1400,8 @@ backtrace_command_stub (void *data)
 {
   struct backtrace_command_args *args = data;
 
-  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
+  backtrace_command_1 (args->count_exp, args->show_locals,
+		       args->from_tty, args->nofull_path);
   return 0;
 }
 
@@ -1392,7 +1409,7 @@ static void
 backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = NULL;
-  int fulltrace_arg = -1, arglen = 0, argc = 0;
+  int fulltrace_arg = -1, arglen = 0, argc = 0, nofull_path = -1;
   struct backtrace_command_args btargs;
 
   if (arg)
@@ -1412,6 +1429,8 @@ backtrace_command (char *arg, int from_t
 
 	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
 	    fulltrace_arg = argc;
+	  else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
+	    nofull_path = argc;
 	  else
 	    {
 	      arglen += strlen (argv[i]);
@@ -1419,7 +1438,7 @@ backtrace_command (char *arg, int from_t
 	    }
 	}
       arglen += argc;
-      if (fulltrace_arg >= 0)
+      if (fulltrace_arg >= 0 || nofull_path >= 0)
 	{
 	  if (arglen > 0)
 	    {
@@ -1427,7 +1446,7 @@ backtrace_command (char *arg, int from_t
 	      memset (arg, 0, arglen + 1);
 	      for (i = 0; i < (argc + 1); i++)
 		{
-		  if (i != fulltrace_arg)
+		  if (i != fulltrace_arg && i != nofull_path)
 		    {
 		      strcat (arg, argv[i]);
 		      strcat (arg, " ");
@@ -1442,9 +1461,10 @@ backtrace_command (char *arg, int from_t
   btargs.count_exp = arg;
   btargs.show_locals = (fulltrace_arg >= 0);
   btargs.from_tty = from_tty;
+  btargs.nofull_path = (nofull_path >= 0);
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 
-  if (fulltrace_arg >= 0 && arglen > 0)
+  if ((fulltrace_arg >= 0 || nofull_path >= 0) && arglen > 0)
     xfree (arg);
 
   if (old_chain)
@@ -1459,6 +1479,7 @@ backtrace_full_command (char *arg, int f
   btargs.count_exp = arg;
   btargs.show_locals = 1;
   btargs.from_tty = from_tty;
+  btargs.nofull_path = 0;
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 }
 \f

[-- Attachment #3: gdb-7.2-nofull-path-texinfo.patch --]
[-- Type: text/x-patch, Size: 568 bytes --]

diff -rup gdb-7.2-doc-orig/gdb/doc/gdb.texinfo gdb-7.2/gdb/doc/gdb.texinfo
--- gdb-7.2-doc-orig/gdb/doc/gdb.texinfo	2010-09-01 23:15:59.000000000 +0400
+++ gdb-7.2/gdb/doc/gdb.texinfo	2011-07-03 17:36:48.328460001 +0400
@@ -5890,6 +5890,10 @@ Similar, but print only the outermost @v
 @itemx bt full -@var{n}
 Print the values of the local variables also.  @var{n} specifies the
 number of frames to print, as described above.
+
+@item backtrace nopath
+@itemx bt nopath
+Same as @code{backtrace}, but print only the basename of the file.
 @end table
 
 @kindex where

[-- Attachment #4: ChangeLog --]
[-- Type: application/octet-stream, Size: 1391 bytes --]

2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* frame.h (print_what): Added new element LOC_NO_FULLPATH with
	comment.
	* stack.c (print_frame_info): Added LOC_NO_FULLPATH in two places near
	LOCATION.
	(print_frame): Added new variable 'filename' in the condition
	scope and the new conditions in this scope with 'filename' and
	LOC_NO_FULLPATH before call ui_out_field_string with 'filename'.
	'sal.symtab->filename' is used in body of these new conditions.
	(backtrace_command_1): Added new argument of this function witn name
	'nofull_path'. Added new condition with 'nofull_path'. Arguments that
	are passed to print_frame_info depends on this new condition now.
	(backtrace_command_args): Added new member 'nofull_path'.
	(backtrace_command_stub): backtrace_command_1 is now called with new
	argument 'args->nofull_path'.
	(backtrace_command): Added new variable 'nofull_path' at this function
	scope. Added new condition with 'nofull_path' and 'argv[i]'. 'argc' is
	assigned to 'nofull_path' if this new condition is satisfied.
	Modified condition with 'fulltrace_arg' by adding 'nofull_path'.
	Modified condition with 'fulltrace_arg' in the for-loop by adding
	'nofull_path'. Added assignment with 'btargs.nofull_path'. Modified
	condition with 'fulltrace_arg' and 'arglen' by adding 'nofull_path'.
	(backtrace_full_command): Assign zero to 'btargs.nofull_path' was
	added.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 11:26             ` iam ahal
@ 2011-07-04 12:05               ` Eli Zaretskii
  2011-07-04 21:47                 ` Joel Brobecker
  2011-07-17 19:24                 ` iam ahal
  0 siblings, 2 replies; 69+ messages in thread
From: Eli Zaretskii @ 2011-07-04 12:05 UTC (permalink / raw)
  To: iam ahal; +Cc: pmuldoon, tromey, brobecker, gdb-patches

> Date: Mon, 4 Jul 2011 15:14:08 +0400
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: pmuldoon@redhat.com, tromey@redhat.com, brobecker@adacore.com, 
> 	gdb-patches@sourceware.org
> 
> On Sun, Jul 3, 2011 at 10:12 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > But a larger concern is that GNU coding standards frown on using
> > "path" when you really mean "file name".  So I think we should rename
> > the option "basename" and the documentation should say
> >
> >  Same as @code{backtrace}, but print only the basename of the file.
> 
> Fixed. New doc's patch in attachment.

Thanks.

> What's about backtrace's argument name "nopath"?

I stated my suggestion.  I'll let Joel and others decide whether it is
mandatory to change to "basename" or somesuch.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 12:05               ` Eli Zaretskii
@ 2011-07-04 21:47                 ` Joel Brobecker
  2011-07-05  4:35                   ` Eli Zaretskii
                                     ` (2 more replies)
  2011-07-17 19:24                 ` iam ahal
  1 sibling, 3 replies; 69+ messages in thread
From: Joel Brobecker @ 2011-07-04 21:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: iam ahal, pmuldoon, tromey, gdb-patches

> > What's about backtrace's argument name "nopath"?
> 
> I stated my suggestion.  I'll let Joel and others decide whether it is
> mandatory to change to "basename" or somesuch.

FWIW, I think "basename" is better than "nopath". However, I'm more
concerned about the fact that this is implemented as an option of
the backtrace argument rather than as a setting. Those of us who
have expressed an opinion seem to clearly favor the user of a setting.
Now, to find an appropriate name for that setting...

-- 
Joel

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 21:47                 ` Joel Brobecker
@ 2011-07-05  4:35                   ` Eli Zaretskii
  2011-07-19 14:43                     ` Pedro Alves
  2011-07-05  8:38                   ` iam ahal
  2011-07-19 14:19                   ` Pedro Alves
  2 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-07-05  4:35 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: hal9000ed2k, pmuldoon, tromey, gdb-patches

> Date: Mon, 4 Jul 2011 13:51:01 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: iam ahal <hal9000ed2k@gmail.com>, pmuldoon@redhat.com,
> 	tromey@redhat.com, gdb-patches@sourceware.org
> 
> Now, to find an appropriate name for that setting...

backtrace-display-basename-only?

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 21:47                 ` Joel Brobecker
  2011-07-05  4:35                   ` Eli Zaretskii
@ 2011-07-05  8:38                   ` iam ahal
  2011-07-19 14:19                   ` Pedro Alves
  2 siblings, 0 replies; 69+ messages in thread
From: iam ahal @ 2011-07-05  8:38 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Eli Zaretskii, pmuldoon, tromey, gdb-patches

On Tue, Jul 5, 2011 at 12:51 AM, Joel Brobecker <brobecker@adacore.com> wrote:
> However, I'm more concerned about the fact that this is implemented as an option
> of the backtrace argument rather than as a setting. Those of us who
> have expressed an opinion seem to clearly favor the user of a setting.
> Now, to find an appropriate name for that setting...

You mean 'set' command (e.g. 'set bt-display-only-basename')?
I can do this if necessary.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 12:05               ` Eli Zaretskii
  2011-07-04 21:47                 ` Joel Brobecker
@ 2011-07-17 19:24                 ` iam ahal
  2011-07-19 13:28                   ` iam ahal
  1 sibling, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-07-17 19:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: pmuldoon, tromey, brobecker, eliz

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

I've wrote test for my feature. You can see all in the patch. Also,
I've added this in ChangeLog.

I don't know TCL but I hope that my test script is written correctly
(at least in the main).

If necessary, I can write new version with 'set backtrace nopath'
instead of 'backtrace nopath'.

Is this version ok? If Yes, I will send filled form of copyright
assignment to fsf-records(d0t)gnu.org and Tom Tromey.

[-- Attachment #2: gdb-7.2-backtrace-nofull.patch --]
[-- Type: text/x-patch, Size: 9475 bytes --]

diff -rupN gdb-7.2-orig/gdb/doc/gdb.texinfo gdb-7.2/gdb/doc/gdb.texinfo
--- gdb-7.2-orig/gdb/doc/gdb.texinfo	2010-09-01 23:15:59.000000000 +0400
+++ gdb-7.2/gdb/doc/gdb.texinfo	2011-07-15 23:37:57.800511002 +0400
@@ -5890,6 +5890,10 @@ Similar, but print only the outermost @v
 @itemx bt full -@var{n}
 Print the values of the local variables also.  @var{n} specifies the
 number of frames to print, as described above.
+
+@item backtrace nopath
+@itemx bt nopath
+Same as @code{backtrace}, but print only the basename of the file.
 @end table
 
 @kindex where
diff -rupN gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-07-15 23:37:48.600511002 +0400
@@ -582,7 +582,10 @@ enum print_what
     /* Print both of the above. */
     SRC_AND_LOC, 
     /* Print location only, but always include the address. */
-    LOC_AND_ADDRESS 
+    LOC_AND_ADDRESS,
+    /* Print only the location but without the full path to file,          *
+     * i.e. print only filename even if full path is defined in symtable.  */
+    LOC_NO_FULLPATH
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
diff -rupN gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-07-15 23:37:48.600511002 +0400
@@ -592,7 +592,8 @@ print_frame_info (struct frame_info *fra
 
   location_print = (print_what == LOCATION 
 		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+		    || print_what == SRC_AND_LOC
+		    || print_what == LOC_NO_FULLPATH);
 
   if (location_print || !sal.symtab)
     print_frame (frame, print_level, print_what, print_args, sal);
@@ -652,7 +653,7 @@ print_frame_info (struct frame_info *fra
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
     set_default_breakpoint (1, sal.pspace,
 			    get_frame_pc (frame), sal.symtab, sal.line);
 
@@ -810,11 +811,21 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+
+      filename = NULL;
+      if (print_what == LOC_NO_FULLPATH)
+	filename = lbasename (sal.symtab->filename);
+
+      if (filename == NULL || *filename == '\0')
+	filename = sal.symtab->filename;
+
+      ui_out_field_string (uiout, "file", filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
@@ -1269,7 +1280,7 @@ frame_info (char *addr_exp, int from_tty
    frames.  */
 
 static void
-backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty, int nofull_path)
 {
   struct frame_info *fi;
   int count;
@@ -1345,7 +1356,11 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          hand, perhaps the code does or could be fixed to make sure
          the frame->prev field gets set to NULL in that case).  */
-      print_frame_info (fi, 1, LOCATION, 1);
+      if (nofull_path)
+	print_frame_info (fi, 1, LOC_NO_FULLPATH, 1);
+      else
+	print_frame_info (fi, 1, LOCATION, 1);
+
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
 
@@ -1375,6 +1390,7 @@ struct backtrace_command_args
   char *count_exp;
   int show_locals;
   int from_tty;
+  int nofull_path;
 };
 
 /* Stub for catch_errors.  */
@@ -1384,7 +1400,8 @@ backtrace_command_stub (void *data)
 {
   struct backtrace_command_args *args = data;
 
-  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
+  backtrace_command_1 (args->count_exp, args->show_locals,
+		       args->from_tty, args->nofull_path);
   return 0;
 }
 
@@ -1392,7 +1409,7 @@ static void
 backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = NULL;
-  int fulltrace_arg = -1, arglen = 0, argc = 0;
+  int fulltrace_arg = -1, arglen = 0, argc = 0, nofull_path = -1;
   struct backtrace_command_args btargs;
 
   if (arg)
@@ -1412,6 +1429,8 @@ backtrace_command (char *arg, int from_t
 
 	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
 	    fulltrace_arg = argc;
+	  else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
+	    nofull_path = argc;
 	  else
 	    {
 	      arglen += strlen (argv[i]);
@@ -1419,7 +1438,7 @@ backtrace_command (char *arg, int from_t
 	    }
 	}
       arglen += argc;
-      if (fulltrace_arg >= 0)
+      if (fulltrace_arg >= 0 || nofull_path >= 0)
 	{
 	  if (arglen > 0)
 	    {
@@ -1427,7 +1446,7 @@ backtrace_command (char *arg, int from_t
 	      memset (arg, 0, arglen + 1);
 	      for (i = 0; i < (argc + 1); i++)
 		{
-		  if (i != fulltrace_arg)
+		  if (i != fulltrace_arg && i != nofull_path)
 		    {
 		      strcat (arg, argv[i]);
 		      strcat (arg, " ");
@@ -1442,9 +1461,10 @@ backtrace_command (char *arg, int from_t
   btargs.count_exp = arg;
   btargs.show_locals = (fulltrace_arg >= 0);
   btargs.from_tty = from_tty;
+  btargs.nofull_path = (nofull_path >= 0);
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 
-  if (fulltrace_arg >= 0 && arglen > 0)
+  if ((fulltrace_arg >= 0 || nofull_path >= 0) && arglen > 0)
     xfree (arg);
 
   if (old_chain)
@@ -1459,6 +1479,7 @@ backtrace_full_command (char *arg, int f
   btargs.count_exp = arg;
   btargs.show_locals = 1;
   btargs.from_tty = from_tty;
+  btargs.nofull_path = 0;
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 }
 \f
diff -rupN gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.c gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.c
--- gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.c	1970-01-01 03:00:00.000000000 +0300
+++ gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.c	2011-07-15 23:38:23.840511002 +0400
@@ -0,0 +1,17 @@
+
+void func1()
+{
+
+}
+
+void func()
+{
+    func1();
+}
+
+int main()
+{
+    func();
+
+    return 0;
+}
diff -rupN gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.exp gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.exp
--- gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.exp	1970-01-01 03:00:00.000000000 +0300
+++ gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.exp	2011-07-15 23:38:23.840511002 +0400
@@ -0,0 +1,112 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set testfile "bt-nopath"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc bt_compile { path } {
+    global binfile
+
+    if  { [gdb_compile "$path" "${binfile}" executable {debug nowarnings}] != "" } {
+	return -1
+    }
+
+    if [get_compiler_info ${binfile}] {
+	return -1
+    }
+}
+
+proc bt_line { num func {flag ""} } {
+    global srcfile
+
+    if { [string match $flag full] } {
+	return "\#$num.*$func.*().*at\\s*/.*${srcfile}.*"
+    } elseif { [string match $flag rel] } {
+	return "\#$num.*$func.*().*at\\s*\\..*${srcfile}.*"
+    } else {
+	return "\#$num.*$func.*().*at.*${srcfile}.*"
+    }
+}
+
+proc nopath_test { {flag ""} } {
+    global srcdir
+    global subdir
+    global binfile
+    global gdb_prompt
+
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir $srcdir/$subdir
+    gdb_load ${binfile}
+
+    gdb_breakpoint main
+    gdb_breakpoint func
+    gdb_breakpoint func1
+
+    gdb_run_cmd
+    gdb_expect {
+	-re "Breakpoint 1,.*main.* at .*:.*$gdb_prompt $" {
+	    pass "run until function breakpoint"
+	}
+	-re "$gdb_prompt $" {
+	    fail "run until function breakpoint"
+	}
+	timeout {
+	    fail "run until function breakpoint (timeout)"
+	}
+    }
+
+    gdb_test "backtrace"        [bt_line 0 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 main]
+
+    gdb_continue func
+
+    gdb_test "backtrace"        [bt_line 0 func $flag][bt_line 1 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 func][bt_line 1 main]
+
+    gdb_continue func1
+
+    gdb_test "backtrace"        [bt_line 0 func1 $flag][bt_line 1 func $flag][bt_line 2 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 func1][bt_line 1 func][bt_line 2 main]
+}
+
+set save_pwd [pwd]
+cd ${subdir}
+set full_src_path [pwd]/${srcfile}
+cd ${save_pwd}
+
+if { [bt_compile $full_src_path] == -1 } {
+    untested bt-nopath.exp
+    return -1
+}
+
+nopath_test full
+
+set rel_src_path ${srcdir}/${subdir}/${srcfile}
+
+remote_exec build "rm -f ${binfile}"
+
+if { [bt_compile $rel_src_path] == -1 } {
+    untested bt-nopath.exp
+    return -1
+}
+
+nopath_test rel
+

[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 1445 bytes --]

2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* frame.h (print_what): Added new element LOC_NO_FULLPATH with
	comment.
	* stack.c (print_frame_info): Added LOC_NO_FULLPATH in two places near
	LOCATION.
	(print_frame): Added new variable 'filename' in the condition
	scope and the new conditions in this scope with 'filename' and
	LOC_NO_FULLPATH before call ui_out_field_string with 'filename'.
	'sal.symtab->filename' is used in body of these new conditions.
	(backtrace_command_1): Added new argument of this function witn name
	'nofull_path'. Added new condition with 'nofull_path'. Arguments that
	are passed to print_frame_info depends on this new condition now.
	(backtrace_command_args): Added new member 'nofull_path'.
	(backtrace_command_stub): backtrace_command_1 is now called with new
	argument 'args->nofull_path'.
	(backtrace_command): Added new variable 'nofull_path' at this function
	scope. Added new condition with 'nofull_path' and 'argv[i]'. 'argc' is
	assigned to 'nofull_path' if this new condition is satisfied.
	Modified condition with 'fulltrace_arg' by adding 'nofull_path'.
	Modified condition with 'fulltrace_arg' in the for-loop by adding
	'nofull_path'. Added assignment with 'btargs.nofull_path'. Modified
	condition with 'fulltrace_arg' and 'arglen' by adding 'nofull_path'.
	(backtrace_full_command): Assign zero to 'btargs.nofull_path' was
	added.
	* bt-nopath.exp: New file.
	* bt-nopath.c: New file.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-17 19:24                 ` iam ahal
@ 2011-07-19 13:28                   ` iam ahal
  2011-07-19 17:04                     ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-07-19 13:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: pmuldoon, tromey, brobecker, eliz

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

I've made tiny changes in my test script. You can find out everything
in the attachment (i.e. every my message with attachment is suitable
to possible commit, if it will be reviewed).

My test script is separate *.exp file but I don't sure that it's right.
To test I just run:

... gdb-7.2/gdb/testsuite$ runtest --all gdb.base/bt-nopath.exp

Is everything ok? Or what I should change?

[-- Attachment #2: gdb-7.2-backtrace-nofull-2.patch --]
[-- Type: text/x-patch, Size: 9504 bytes --]

diff -rupN gdb-7.2-orig/gdb/doc/gdb.texinfo gdb-7.2/gdb/doc/gdb.texinfo
--- gdb-7.2-orig/gdb/doc/gdb.texinfo	2010-09-01 23:15:59.000000000 +0400
+++ gdb-7.2/gdb/doc/gdb.texinfo	2011-07-18 22:36:21.714535001 +0400
@@ -5890,6 +5890,10 @@ Similar, but print only the outermost @v
 @itemx bt full -@var{n}
 Print the values of the local variables also.  @var{n} specifies the
 number of frames to print, as described above.
+
+@item backtrace nopath
+@itemx bt nopath
+Same as @code{backtrace}, but print only the basename of the file.
 @end table
 
 @kindex where
diff -rupN gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-07-18 22:36:21.714535001 +0400
@@ -582,7 +582,10 @@ enum print_what
     /* Print both of the above. */
     SRC_AND_LOC, 
     /* Print location only, but always include the address. */
-    LOC_AND_ADDRESS 
+    LOC_AND_ADDRESS,
+    /* Print only the location but without the full path to file,          *
+     * i.e. print only filename even if full path is defined in symtable.  */
+    LOC_NO_FULLPATH
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
diff -rupN gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-07-18 22:36:21.714535001 +0400
@@ -592,7 +592,8 @@ print_frame_info (struct frame_info *fra
 
   location_print = (print_what == LOCATION 
 		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+		    || print_what == SRC_AND_LOC
+		    || print_what == LOC_NO_FULLPATH);
 
   if (location_print || !sal.symtab)
     print_frame (frame, print_level, print_what, print_args, sal);
@@ -652,7 +653,7 @@ print_frame_info (struct frame_info *fra
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (print_what != LOCATION || print_what != LOC_NO_FULLPATH)
     set_default_breakpoint (1, sal.pspace,
 			    get_frame_pc (frame), sal.symtab, sal.line);
 
@@ -810,11 +811,21 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+
+      filename = NULL;
+      if (print_what == LOC_NO_FULLPATH)
+	filename = lbasename (sal.symtab->filename);
+
+      if (filename == NULL || *filename == '\0')
+	filename = sal.symtab->filename;
+
+      ui_out_field_string (uiout, "file", filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
@@ -1269,7 +1280,7 @@ frame_info (char *addr_exp, int from_tty
    frames.  */
 
 static void
-backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty, int nofull_path)
 {
   struct frame_info *fi;
   int count;
@@ -1345,7 +1356,11 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          hand, perhaps the code does or could be fixed to make sure
          the frame->prev field gets set to NULL in that case).  */
-      print_frame_info (fi, 1, LOCATION, 1);
+      if (nofull_path)
+	print_frame_info (fi, 1, LOC_NO_FULLPATH, 1);
+      else
+	print_frame_info (fi, 1, LOCATION, 1);
+
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
 
@@ -1375,6 +1390,7 @@ struct backtrace_command_args
   char *count_exp;
   int show_locals;
   int from_tty;
+  int nofull_path;
 };
 
 /* Stub for catch_errors.  */
@@ -1384,7 +1400,8 @@ backtrace_command_stub (void *data)
 {
   struct backtrace_command_args *args = data;
 
-  backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
+  backtrace_command_1 (args->count_exp, args->show_locals,
+		       args->from_tty, args->nofull_path);
   return 0;
 }
 
@@ -1392,7 +1409,7 @@ static void
 backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = NULL;
-  int fulltrace_arg = -1, arglen = 0, argc = 0;
+  int fulltrace_arg = -1, arglen = 0, argc = 0, nofull_path = -1;
   struct backtrace_command_args btargs;
 
   if (arg)
@@ -1412,6 +1429,8 @@ backtrace_command (char *arg, int from_t
 
 	  if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
 	    fulltrace_arg = argc;
+	  else if (nofull_path < 0 && subset_compare (argv[i], "nopath"))
+	    nofull_path = argc;
 	  else
 	    {
 	      arglen += strlen (argv[i]);
@@ -1419,7 +1438,7 @@ backtrace_command (char *arg, int from_t
 	    }
 	}
       arglen += argc;
-      if (fulltrace_arg >= 0)
+      if (fulltrace_arg >= 0 || nofull_path >= 0)
 	{
 	  if (arglen > 0)
 	    {
@@ -1427,7 +1446,7 @@ backtrace_command (char *arg, int from_t
 	      memset (arg, 0, arglen + 1);
 	      for (i = 0; i < (argc + 1); i++)
 		{
-		  if (i != fulltrace_arg)
+		  if (i != fulltrace_arg && i != nofull_path)
 		    {
 		      strcat (arg, argv[i]);
 		      strcat (arg, " ");
@@ -1442,9 +1461,10 @@ backtrace_command (char *arg, int from_t
   btargs.count_exp = arg;
   btargs.show_locals = (fulltrace_arg >= 0);
   btargs.from_tty = from_tty;
+  btargs.nofull_path = (nofull_path >= 0);
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 
-  if (fulltrace_arg >= 0 && arglen > 0)
+  if ((fulltrace_arg >= 0 || nofull_path >= 0) && arglen > 0)
     xfree (arg);
 
   if (old_chain)
@@ -1459,6 +1479,7 @@ backtrace_full_command (char *arg, int f
   btargs.count_exp = arg;
   btargs.show_locals = 1;
   btargs.from_tty = from_tty;
+  btargs.nofull_path = 0;
   catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
 }
 \f
diff -rupN gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.c gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.c
--- gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.c	1970-01-01 03:00:00.000000000 +0300
+++ gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.c	2011-07-18 22:36:21.714535001 +0400
@@ -0,0 +1,17 @@
+
+void func1()
+{
+
+}
+
+void func()
+{
+    func1();
+}
+
+int main()
+{
+    func();
+
+    return 0;
+}
diff -rupN gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.exp gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.exp
--- gdb-7.2-orig/gdb/testsuite/gdb.base/bt-nopath.exp	1970-01-01 03:00:00.000000000 +0300
+++ gdb-7.2/gdb/testsuite/gdb.base/bt-nopath.exp	2011-07-19 14:55:58.845733001 +0400
@@ -0,0 +1,112 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set testfile "bt-nopath"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc bt_compile { path } {
+    global binfile
+
+    if  { [gdb_compile $path $binfile executable {debug nowarnings}] != "" } {
+	return -1
+    }
+
+    if [get_compiler_info $binfile] {
+	return -1
+    }
+}
+
+proc bt_line { num func {flag ""} } {
+    global srcfile
+
+    if { [string match $flag full] } {
+	return "\#${num}.*${func}.*().*at\\s*/.*${srcfile}.*"
+    } elseif { [string match $flag rel] } {
+	return "\#${num}.*${func}.*().*at\\s*\\..*${srcfile}.*"
+    } else {
+	return "\#${num}.*${func}.*().*at\\s*${srcfile}.*"
+    }
+}
+
+proc nopath_test { {flag ""} } {
+    global srcdir
+    global subdir
+    global binfile
+    global gdb_prompt
+
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir ${srcdir}/${subdir}
+    gdb_load ${binfile}
+
+    gdb_breakpoint main
+    gdb_breakpoint func
+    gdb_breakpoint func1
+
+    gdb_run_cmd
+    gdb_expect {
+	-re "Breakpoint 1,.*main.* at .*:.*${gdb_prompt} $" {
+	    pass "run until function breakpoint"
+	}
+	-re "$gdb_prompt $" {
+	    fail "run until function breakpoint"
+	}
+	timeout {
+	    fail "run until function breakpoint (timeout)"
+	}
+    }
+
+    gdb_test "backtrace"        [bt_line 0 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 main]
+
+    gdb_continue func
+
+    gdb_test "backtrace"        [bt_line 0 func $flag][bt_line 1 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 func][bt_line 1 main]
+
+    gdb_continue func1
+
+    gdb_test "backtrace"        [bt_line 0 func1 $flag][bt_line 1 func $flag][bt_line 2 main $flag]
+    gdb_test "backtrace nopath" [bt_line 0 func1][bt_line 1 func][bt_line 2 main]
+}
+
+set save_pwd [pwd]
+cd $subdir
+set full_src_path [pwd]/${srcfile}
+cd $save_pwd
+
+if { [bt_compile $full_src_path] == -1 } {
+    untested bt-nopath.exp
+    return -1
+}
+
+nopath_test full
+
+remote_exec build "rm -f ${binfile}"
+
+set rel_src_path [exec find . -path *${srcdir}/${subdir}/${srcfile}]
+
+if { [bt_compile $rel_src_path] == -1 } {
+    untested bt-nopath.exp
+    return -1
+}
+
+nopath_test rel
+

[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 1445 bytes --]

2011-06-26 Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* frame.h (print_what): Added new element LOC_NO_FULLPATH with
	comment.
	* stack.c (print_frame_info): Added LOC_NO_FULLPATH in two places near
	LOCATION.
	(print_frame): Added new variable 'filename' in the condition
	scope and the new conditions in this scope with 'filename' and
	LOC_NO_FULLPATH before call ui_out_field_string with 'filename'.
	'sal.symtab->filename' is used in body of these new conditions.
	(backtrace_command_1): Added new argument of this function witn name
	'nofull_path'. Added new condition with 'nofull_path'. Arguments that
	are passed to print_frame_info depends on this new condition now.
	(backtrace_command_args): Added new member 'nofull_path'.
	(backtrace_command_stub): backtrace_command_1 is now called with new
	argument 'args->nofull_path'.
	(backtrace_command): Added new variable 'nofull_path' at this function
	scope. Added new condition with 'nofull_path' and 'argv[i]'. 'argc' is
	assigned to 'nofull_path' if this new condition is satisfied.
	Modified condition with 'fulltrace_arg' by adding 'nofull_path'.
	Modified condition with 'fulltrace_arg' in the for-loop by adding
	'nofull_path'. Added assignment with 'btargs.nofull_path'. Modified
	condition with 'fulltrace_arg' and 'arglen' by adding 'nofull_path'.
	(backtrace_full_command): Assign zero to 'btargs.nofull_path' was
	added.
	* bt-nopath.exp: New file.
	* bt-nopath.c: New file.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-04 21:47                 ` Joel Brobecker
  2011-07-05  4:35                   ` Eli Zaretskii
  2011-07-05  8:38                   ` iam ahal
@ 2011-07-19 14:19                   ` Pedro Alves
  2 siblings, 0 replies; 69+ messages in thread
From: Pedro Alves @ 2011-07-19 14:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker, Eli Zaretskii, iam ahal, pmuldoon, tromey

On Monday 04 July 2011 21:51:01, Joel Brobecker wrote:

> Eli Zaretskii wrote:
> > From: iam ahal <hal9000ed2k@gmail.com>
> > > On Sun, Jul 3, 2011 at 10:12 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > > > But a larger concern is that GNU coding standards frown on using
> > > > "path" when you really mean "file name".  So I think we should rename
> > > > the option "basename" and the documentation should say
> > >
> > > What's about backtrace's argument name "nopath"?
> > 
> > I stated my suggestion.  I'll let Joel and others decide whether it is
> > mandatory to change to "basename" or somesuch.
> 
> FWIW, I think "basename" is better than "nopath".

Another +1.

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-05  4:35                   ` Eli Zaretskii
@ 2011-07-19 14:43                     ` Pedro Alves
  0 siblings, 0 replies; 69+ messages in thread
From: Pedro Alves @ 2011-07-19 14:43 UTC (permalink / raw)
  To: gdb-patches, Eli Zaretskii; +Cc: Joel Brobecker, hal9000ed2k, pmuldoon, tromey

On Tuesday 05 July 2011 03:46:21, Eli Zaretskii wrote:
> > Date: Mon, 4 Jul 2011 13:51:01 -0700
> > From: Joel Brobecker <brobecker@adacore.com>
> > Cc: iam ahal <hal9000ed2k@gmail.com>, pmuldoon@redhat.com,
> > 	tromey@redhat.com, gdb-patches@sourceware.org
> > 
> > Now, to find an appropriate name for that setting...
> 
> backtrace-display-basename-only?

We already have the set backtrace prefix:

(gdb) set backtrace 
limit       past-entry  past-main 

So that'd make it "set backtrace display-basename-only on|off"

Or maybe an enum.  Something like:

set backtrace display basename-only|the-whole-sheebang

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-19 13:28                   ` iam ahal
@ 2011-07-19 17:04                     ` Eli Zaretskii
  2011-07-24 21:12                       ` iam ahal
  0 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-07-19 17:04 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches, pmuldoon, tromey, brobecker

> Date: Tue, 19 Jul 2011 16:16:36 +0400
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: pmuldoon@redhat.com, tromey@redhat.com, brobecker@adacore.com, 
> 	eliz@gnu.org
> 
> Is everything ok? Or what I should change?

I believe the consensus is that "nopath" should be replaced with
"basename".  I like Pedro's suggestion from today to add this option
to the existing "set backtrace" family.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-19 17:04                     ` Eli Zaretskii
@ 2011-07-24 21:12                       ` iam ahal
  2011-07-26 14:17                         ` iam ahal
                                           ` (2 more replies)
  0 siblings, 3 replies; 69+ messages in thread
From: iam ahal @ 2011-07-24 21:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: eliz, pmuldoon, tromey, brobecker, pedro, drow

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

I've created new patch where I've added new option called
skip-compile-dir. Patch in attachment. I didn't make ChangeLog yet.
If you like this implementation I prepare ChangeLog and testsuite script.
I can change something if you want.

Here is example:

$ gcc -g -Wall /home/eldar/testdir/test.c
$ ./contrib/gdb-7.2/gdb/gdb ./a.out
...
(gdb) b main
...
(gdb) r
...
(gdb) backtrace
#0  main () at /home/eldar/testdir/test.c:4
...
(gdb) set backtrace
List of set backtrace subcommands:
...
set backtrace skip-compile-dir -- Set whether compile path should be
skipped in backtraces
...
(gdb) set backtrace skip-compile-dir on
(gdb) backtrace
#0  main () at testdir/test.c:4
(gdb) show backtrace
...
skip-compile-dir:  Whether compile path should be skipped in backtraces is on.
(gdb) show backtrace skip-compile-dir
Whether compile path should be skipped in backtraces is on.

[-- Attachment #2: gdb-7.2-skip-compile-dir.patch --]
[-- Type: text/x-patch, Size: 3523 bytes --]

diff -rup gdb-7.2-orig/gdb/frame.c gdb-7.2/gdb/frame.c
--- gdb-7.2-orig/gdb/frame.c	2010-07-01 19:36:15.000000000 +0400
+++ gdb-7.2/gdb/frame.c	2011-07-24 23:33:44.297616001 +0400
@@ -205,6 +205,15 @@ An upper bound on the number of backtrac
 		    value);
 }
 
+static int backtrace_skip_compile;
+static void
+show_backtrace_skip_compile (struct ui_file *file, int from_tty,
+			     struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+Whether compile path should be skipped in backtraces is %s.\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -1900,6 +1909,22 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (get_frame_pc (frame), notcurrent);
 }
 
+char *
+get_display_filename_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+
+  if (backtrace_skip_compile && filename && dirname
+      && strstr(filename, dirname))
+    {
+      /* +1 means skip directory separator */
+      return filename + strlen(dirname) + 1;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2270,6 +2295,16 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_boolean_cmd ("skip-compile-dir", class_obscure,
+			   &backtrace_skip_compile, _("\
+Set whether compile path should be skipped in backtraces."), _("\
+Show whether compile path should be skipped in backtraces."), _("\
+Normally compile path is displayed if it's exists."),
+			   NULL,
+			   show_backtrace_skip_compile,
+			   &set_backtrace_cmdlist,
+			   &show_backtrace_cmdlist);
+
   /* Debug this files internals. */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-07-24 23:33:36.827616001 +0400
@@ -327,6 +327,11 @@ extern CORE_ADDR get_frame_func (struct
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns filename with or without compile path.
+   It depends on 'set backtrace skip-compile-dir'.  */
+
+extern char *get_display_filename_from_sal (struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-07-24 23:33:44.437616001 +0400
@@ -810,11 +810,15 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *display_filename = get_display_filename_from_sal(&sal);
+      if (display_filename == NULL)
+	  display_filename = sal.symtab->filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", display_filename);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-24 21:12                       ` iam ahal
@ 2011-07-26 14:17                         ` iam ahal
  2011-07-28 15:34                         ` Tom Tromey
  2011-07-29 13:35                         ` Jan Kratochvil
  2 siblings, 0 replies; 69+ messages in thread
From: iam ahal @ 2011-07-26 14:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: eliz, pmuldoon, tromey, brobecker, pedro, drow

Does anyone has an opinion on my previous patch?

http://sourceware.org/ml/gdb-patches/2011-07/msg00676.html

-- 
Eldar

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-24 21:12                       ` iam ahal
  2011-07-26 14:17                         ` iam ahal
@ 2011-07-28 15:34                         ` Tom Tromey
  2011-07-28 15:57                           ` Tom Tromey
                                             ` (2 more replies)
  2011-07-29 13:35                         ` Jan Kratochvil
  2 siblings, 3 replies; 69+ messages in thread
From: Tom Tromey @ 2011-07-28 15:34 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow

>>>>> "iam" == iam ahal <hal9000ed2k@gmail.com> writes:

iam> I've created new patch where I've added new option called
iam> skip-compile-dir. Patch in attachment. I didn't make ChangeLog yet.
iam> If you like this implementation I prepare ChangeLog and testsuite script.
iam> I can change something if you want.

Thanks.

I forget (I never keep records of this, I think perhaps I should) -- did
we get you started on the copyright assignment paperwork?

iam> +static int backtrace_skip_compile;
iam> +static void

Newline between these two lines.

iam> +char *
iam> +get_display_filename_from_sal (struct symtab_and_line *sal)

Should have an introductory comment before this function.
It should return a 'const char *'.

iam> +  if (backtrace_skip_compile && filename && dirname
iam> +      && strstr(filename, dirname))

Space before the open paren.  But this seems like a strange test to me,
strstr can't really be correct.

iam> +    {
iam> +      /* +1 means skip directory separator */
iam> +      return filename + strlen(dirname) + 1;

Comments should end with a period and two spaces, per GNU standards.

Can there never be multiple separators?
It seems like there could be, in which case you want a loop.

iam> +  add_setshow_boolean_cmd ("skip-compile-dir", class_obscure,

I'm not especially fond of this name.

I don't have a better suggestion though.

iam> +      const char *display_filename = get_display_filename_from_sal(&sal);

Space before open paren.

iam> +      if (display_filename == NULL)
iam> +	  display_filename = sal.symtab->filename;

It seems that perhaps get_display_filename_from_sal should do this.

iam> -      ui_out_field_string (uiout, "file", sal.symtab->filename);
iam> +      ui_out_field_string (uiout, "file", display_filename);

I'm surprised this change has any effect.
I thought the compilation directory and the source file name were kept
separate in the symtab.  What is actually happening?

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 15:34                         ` Tom Tromey
@ 2011-07-28 15:57                           ` Tom Tromey
  2011-07-28 16:36                             ` Joel Brobecker
  2011-07-28 17:51                           ` Tom Tromey
  2011-08-02 19:41                           ` iam ahal
  2 siblings, 1 reply; 69+ messages in thread
From: Tom Tromey @ 2011-07-28 15:57 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow

iam> -      ui_out_field_string (uiout, "file", sal.symtab->filename);
iam> +      ui_out_field_string (uiout, "file", display_filename);

Tom> I'm surprised this change has any effect.
Tom> I thought the compilation directory and the source file name were kept
Tom> separate in the symtab.  What is actually happening?

Ah, ok -- you are using the absolute file name when compiling.
That seems weird to me, but I understand now.

I think instead of 'strstr' as a test, you want strncmp, followed by a
check to make sure that either the compilation directory ends with a
directory separator, or the following character in the source file name
is one.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 15:57                           ` Tom Tromey
@ 2011-07-28 16:36                             ` Joel Brobecker
  2011-07-28 17:39                               ` Tom Tromey
  0 siblings, 1 reply; 69+ messages in thread
From: Joel Brobecker @ 2011-07-28 16:36 UTC (permalink / raw)
  To: Tom Tromey; +Cc: iam ahal, gdb-patches, eliz, pmuldoon, pedro, drow

> I think instead of 'strstr' as a test, you want strncmp, followed by a
> check to make sure that either the compilation directory ends with a
> directory separator, or the following character in the source file name
> is one.

Seems like filename_ncmp would be better?

(should we write a specific routine that checks whether a given
fullpath "starts with" a given directory name?)
-- 
Joel

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 16:36                             ` Joel Brobecker
@ 2011-07-28 17:39                               ` Tom Tromey
  0 siblings, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2011-07-28 17:39 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: iam ahal, gdb-patches, eliz, pmuldoon, pedro, drow

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

>> I think instead of 'strstr' as a test, you want strncmp, followed by a
>> check to make sure that either the compilation directory ends with a
>> directory separator, or the following character in the source file name
>> is one.

Joel> Seems like filename_ncmp would be better?

Yeah, whoops.

Joel> (should we write a specific routine that checks whether a given
Joel> fullpath "starts with" a given directory name?)

It wouldn't hurt.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 15:34                         ` Tom Tromey
  2011-07-28 15:57                           ` Tom Tromey
@ 2011-07-28 17:51                           ` Tom Tromey
  2011-07-29 12:01                             ` Joel Brobecker
  2011-07-29 12:36                             ` Eli Zaretskii
  2011-08-02 19:41                           ` iam ahal
  2 siblings, 2 replies; 69+ messages in thread
From: Tom Tromey @ 2011-07-28 17:51 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

iam> +  add_setshow_boolean_cmd ("skip-compile-dir", class_obscure,

Tom> I'm not especially fond of this name.

Tom> I don't have a better suggestion though.

How about "set backtrace filename-display"?  With possible values "full"
and "filename"?  Then we can add "basename" later if we care to.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 17:51                           ` Tom Tromey
@ 2011-07-29 12:01                             ` Joel Brobecker
  2011-07-29 12:36                             ` Eli Zaretskii
  1 sibling, 0 replies; 69+ messages in thread
From: Joel Brobecker @ 2011-07-29 12:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: iam ahal, gdb-patches, eliz, pmuldoon, pedro, drow

> How about "set backtrace filename-display"?  With possible values "full"
> and "filename"?  Then we can add "basename" later if we care to.

Sounds good to me :)

-- 
Joel

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 17:51                           ` Tom Tromey
  2011-07-29 12:01                             ` Joel Brobecker
@ 2011-07-29 12:36                             ` Eli Zaretskii
  1 sibling, 0 replies; 69+ messages in thread
From: Eli Zaretskii @ 2011-07-29 12:36 UTC (permalink / raw)
  To: Tom Tromey; +Cc: hal9000ed2k, gdb-patches, pmuldoon, brobecker, pedro, drow

> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org, eliz@gnu.org, pmuldoon@redhat.com,        brobecker@adacore.com, pedro@codesourcery.com, drow@false.org
> Date: Thu, 28 Jul 2011 11:32:57 -0600
> 
> How about "set backtrace filename-display"?  With possible values "full"
> and "filename"?  Then we can add "basename" later if we care to.

Sounds good.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-24 21:12                       ` iam ahal
  2011-07-26 14:17                         ` iam ahal
  2011-07-28 15:34                         ` Tom Tromey
@ 2011-07-29 13:35                         ` Jan Kratochvil
  2011-08-01 18:04                           ` Tom Tromey
  2 siblings, 1 reply; 69+ messages in thread
From: Jan Kratochvil @ 2011-07-29 13:35 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches, eliz, pmuldoon, tromey, brobecker, pedro, drow

On Sun, 24 Jul 2011 22:25:44 +0200, iam ahal wrote:
> +char *
> +get_display_filename_from_sal (struct symtab_and_line *sal)
> +{
> +  const char *filename = sal->symtab->filename;
> +  const char *dirname = sal->symtab->dirname;
> +
> +  if (backtrace_skip_compile && filename && dirname
> +      && strstr(filename, dirname))
> +    {
> +      /* +1 means skip directory separator */
> +      return filename + strlen(dirname) + 1;
> +    }
> +
> +  return filename;
> +}

I am against just omitting compilation directory, if something should be
omitted I am more for really printing just the basename.

Compilation directory can help only during some forms of compilations, various
packages use very complicated compilation setups and in some cases this patch
would have no effect:

$ echo 'int main(void){return 0;}' >17.c;x=$PWD;(cd /tmp;echo "#include <$x/17.c>" >17b.c;gcc -g -o $x/17 17b.c -Wall)
->
(gdb) set backtrace skip-compile-dir on
(gdb) bt
#0  main () at /home/jkratoch/redhat/gdb-clean/gdb/17.c:1
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               Still displaying the very long pathname.
(gdb) 
readelf -wil
    <11>   DW_AT_name        : (indirect string, offset: 0x0): 17b.c    
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x6): /tmp     
 The Directory Table:
  /home/jkratoch/redhat/gdb-clean/gdb
 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       17.c


But afterwards the backtraces get even more ambigous.  This further discussions
may be out of the scope of this patch:

Already now with FSF GDB when debugging OpenOffice.org the debug line:
#3  0x00000034c72428ad in g_main_context_iteration (context=0x1149980, may_block=1) at gmain.c:2843

is not clear for newcomers that the functions comes from glib2 (and for example
not from gtk2 or OpenOffice.org itself) (I got even informal bugreport for it).

BTW it is a bit "easier" to debug it by `rm -rf /usr/lib/debug':
#2  0x00000034c72428ad in g_main_context_iteration () from /lib64/libglib-2.0.so.0

In fact the library path can be also pretty long without debug info:
#4  0x000000306231ffd1 in Application::Yield(bool) () from /usr/lib64/openoffice.org3/program/../basis-link/program/libvcllx.so

With the mail thread on mind:
	[RFC] canonical linespec and multiple breakpoints ...

I have some idea in display with debug info to use:
#3  0x00000034c72428ad in libglib-2.0.so.0:g_main_context_iteration (context=0x1149980, may_block=1) at gmain.c:2843
and without debug info:
#3  0x00000034c72428ad in libglib-2.0.so.0:g_main_context_iteration (context=0x1149980, may_block=1)
and also without debug info:
#4  0x000000306231ffd1 in libvcllx.so:Application::Yield(bool) ()

So that one can copy-paste it for less-ambiguous (currently not yet implemented):
(gdb) break libglib-2.0.so.0:g_main_context_iteration
(gdb) list libglib-2.0.so.0:g_main_context_iteration


A realwold OpenOffice.org dump showing the problem (the glibc functions also
may not be clear they come from glibc):

#0  0x00000034c76d7283 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=<value optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00000034c7242374 in g_main_context_poll (context=0x1149980, block=1, dispatch=1, self=<value optimized out>) at gmain.c:3093
#2  g_main_context_iterate (context=0x1149980, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2775
#3  0x00000034c72428ad in g_main_context_iteration (context=0x1149980, may_block=1) at gmain.c:2843
#4  0x0000003a6341a3be in GtkXLib::Yield (this=0x7f947aa2d008, bWait=true, bHandleAllCurrentEvents=<value optimized out>) at /usr/src/debug/OOO330_m20/vcl/unx/gtk/app/gtkdata.cxx:860
#5  0x000000306231ffd1 in ImplYield (i_bAllEvents=false) at /usr/src/debug/OOO330_m20/vcl/source/app/svapp.cxx:471
#6  Application::Yield (i_bAllEvents=false) at /usr/src/debug/OOO330_m20/vcl/source/app/svapp.cxx:505
#7  0x0000003062320087 in Application::Execute () at /usr/src/debug/OOO330_m20/vcl/source/app/svapp.cxx:448
#8  0x0000003e32c30465 in desktop::Desktop::Main (this=0x7ffff56f07b0) at /usr/src/debug/OOO330_m20/desktop/source/app/app.cxx:1877
#9  0x0000003062326731 in ImplSVMain () at /usr/src/debug/OOO330_m20/vcl/source/app/svmain.cxx:183
#10 0x00000030623267c5 in SVMain () at /usr/src/debug/OOO330_m20/vcl/source/app/svmain.cxx:224
#11 0x0000003e32c5195c in soffice_main () at /usr/src/debug/OOO330_m20/desktop/source/app/sofficemain.cxx:49
#12 0x00000000004010bb in sal_main (argc=<value optimized out>, argv=<value optimized out>) at main.c:35
#13 main (argc=<value optimized out>, argv=<value optimized out>) at main.c:34


Thanks for addressing it, I am preparing for this expected longterm arguing
about the backtrace output change for some years.  Sorry for so late followup.

FYI your patch does not apply to FSF GDB HEAD but the person doing final comit
can do some simple adjustments of it.


Thanks,
Jan

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-29 13:35                         ` Jan Kratochvil
@ 2011-08-01 18:04                           ` Tom Tromey
  0 siblings, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2011-08-01 18:04 UTC (permalink / raw)
  To: Jan Kratochvil
  Cc: iam ahal, gdb-patches, eliz, pmuldoon, brobecker, pedro, drow

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> I am against just omitting compilation directory, if something should be
Jan> omitted I am more for really printing just the basename.

Ok.

Jan> I have some idea in display with debug info to use:
Jan> #3  0x00000034c72428ad in libglib-2.0.so.0:g_main_context_iteration (context=0x1149980, may_block=1) at gmain.c:2843

There is already a PR open with this as a feature request.
I think it would be a good addition.

Jan> So that one can copy-paste it for less-ambiguous (currently not yet implemented):
Jan> (gdb) break libglib-2.0.so.0:g_main_context_iteration
Jan> (gdb) list libglib-2.0.so.0:g_main_context_iteration

Yeah, nice.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-07-28 15:34                         ` Tom Tromey
  2011-07-28 15:57                           ` Tom Tromey
  2011-07-28 17:51                           ` Tom Tromey
@ 2011-08-02 19:41                           ` iam ahal
  2011-08-03 17:45                             ` Tom Tromey
  2 siblings, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-08-02 19:41 UTC (permalink / raw)
  To: Tom Tromey
  Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow, jan.kratochvil

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

I've created the new patch. Here is example of usage patched gdb:

(gdb) backtrace
#0  main () at /home/eldar/testdir/test.c:4

(gdb) set backtrace filename-display basename
(gdb) backtrace
#0  main () at test.c:4

(gdb) set backtrace filename-display without-compile-dir
(gdb) backtrace
#0  main () at testdir/test.c:4

(gdb) set backtrace filename-display full
(gdb) backtrace
#0  main () at /home/eldar/testdir/test.c:4

I can change something if you want. If this implementation is good I
will prepare ChangeLog and testsuite.

On Thu, Jul 28, 2011 at 7:17 PM, Tom Tromey <tromey@redhat.com> wrote:
> I forget (I never keep records of this, I think perhaps I should) -- did
> we get you started on the copyright assignment paperwork?

Not yet, because my previous patches is very different. I mean the
different files was changed and I don't know which files I need to
change in the next patch.
I hope some people here can accept implementation in this last patch.
After I can start the copyright assignment.

> iam> +static int backtrace_skip_compile;
> iam> +static void
>
> Newline between these two lines.

I'm not sure that's right because I see that there's no newline in
this case (if you look at other places related 'set backtrace ...').

> iam> +char *
> iam> +get_display_filename_from_sal (struct symtab_and_line *sal)
>
> Should have an introductory comment before this function.

Comment was added in 'frame.h'

> Ah, ok -- you are using the absolute file name when compiling.
> That seems weird to me, but I understand now.

Some big build systems uses absolute file name (e.g. Mozilla) because
I started this topic. I wrote about motivation idea in my first
message with patch.

With best regards,
Eldar.

[-- Attachment #2: gdb-7.2-filename-display.patch --]
[-- Type: text/x-patch, Size: 6822 bytes --]

diff -rup gdb-7.2-orig/gdb/frame.c gdb-7.2/gdb/frame.c
--- gdb-7.2-orig/gdb/frame.c	2010-07-01 19:36:15.000000000 +0400
+++ gdb-7.2/gdb/frame.c	2011-08-02 22:44:00.699942001 +0400
@@ -44,6 +44,7 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "filenames.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -135,6 +136,18 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_full[] = "full";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_without_comp_dir[] = "without-compile-dir";
+
+static const char *filename_display_kind_names[] = {
+  filename_display_full,
+  filename_display_basename,
+  filename_display_without_comp_dir,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -205,6 +218,15 @@ An upper bound on the number of backtrac
 		    value);
 }
 
+static const char *filename_display_string = filename_display_full;
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -1900,6 +1922,34 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (get_frame_pc (frame), notcurrent);
 }
 
+const char *
+get_filename_display_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t flen = strlen (filename);
+  size_t dlen = strlen (dirname);
+
+  if (filename_display_string == filename_display_basename
+      && filename)
+    {
+      return lbasename (filename);
+    }
+  else
+  if (filename_display_string == filename_display_without_comp_dir
+      && filename && dirname && dlen <= flen
+      && !FILENAME_NCMP (filename, dirname, dlen))
+    {
+      const char *result = filename + strlen (dirname);
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      return result;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2270,6 +2320,21 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set a way how to display filename."), _("\
+Show a way how to display filename."), _("\
+filename-display can be:\n\
+  full                 - display full filename\n\
+  basename             - display only basename of filename\n\
+  without-compile-dir  - display filename without compile directory part\n\
+By default, full filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals. */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.2-orig/gdb/frame.h gdb-7.2/gdb/frame.h
--- gdb-7.2-orig/gdb/frame.h	2010-01-01 10:31:32.000000000 +0300
+++ gdb-7.2/gdb/frame.h	2011-08-02 22:44:00.579942001 +0400
@@ -327,6 +327,12 @@ extern CORE_ADDR get_frame_func (struct
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either full filename or basename from filename or filename
+   without compile directory part.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *get_filename_display_from_sal (struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.2-orig/gdb/stack.c gdb-7.2/gdb/stack.c
--- gdb-7.2-orig/gdb/stack.c	2010-07-01 19:36:17.000000000 +0400
+++ gdb-7.2/gdb/stack.c	2011-08-02 22:44:00.729942001 +0400
@@ -810,11 +810,15 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+ 
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
diff -rup gdb-7.2-orig/include/filenames.h gdb-7.2/include/filenames.h
--- gdb-7.2-orig/include/filenames.h	2010-04-26 22:04:23.000000000 +0400
+++ gdb-7.2/include/filenames.h	2011-08-02 22:44:00.499942001 +0400
@@ -71,7 +71,9 @@ extern "C" {
    || HAS_DRIVE_SPEC_1 (dos_based, f))
 
 extern int filename_cmp (const char *s1, const char *s2);
-#define FILENAME_CMP(s1, s2)	filename_cmp(s1, s2)
+extern int filename_ncmp (const char *s1, const char *s2, size_t n);
+#define FILENAME_CMP(s1, s2)		filename_cmp(s1, s2)
+#define FILENAME_NCMP(s1, s2, n)	filename_ncmp(s1, s2, n)
 
 #ifdef __cplusplus
 }
diff -rup gdb-7.2-orig/libiberty/filename_cmp.c gdb-7.2/libiberty/filename_cmp.c
--- gdb-7.2-orig/libiberty/filename_cmp.c	2007-05-04 03:40:11.000000000 +0400
+++ gdb-7.2/libiberty/filename_cmp.c	2011-08-02 23:17:57.079942001 +0400
@@ -29,6 +29,48 @@
 
 /*
 
+@deftypefn Extension int filename_ncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
+
+The function is similar as filename_cmp, except it only compares the 
+first (at most) @var{n} characters.
+
+@end deftypefn
+
+*/
+
+int
+filename_ncmp (const char *s1, const char *s2, size_t n)
+{
+#ifndef HAVE_DOS_BASED_FILE_SYSTEM
+  return strncmp (s1, s2, n);
+#else
+  size_t i;
+
+  for (i = 0; i < n; i++)
+    {
+      int c1 = TOLOWER (*s1);
+      int c2 = TOLOWER (*s2);
+
+      /* On DOS-based file systems, the '/' and the '\' are equivalent.  */
+      if (c1 == '/')
+        c1 = '\\';
+      if (c2 == '/')
+        c2 = '\\';
+
+      if (c1 != c2)
+        return (c1 - c2);
+
+      if (c1 == '\0')
+        return 0;
+
+      s1++;
+      s2++;
+    }
+#endif
+}
+
+/*
+
 @deftypefn Extension int filename_cmp (const char *@var{s1}, const char *@var{s2})
 
 Return zero if the two file names @var{s1} and @var{s2} are equivalent.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-08-02 19:41                           ` iam ahal
@ 2011-08-03 17:45                             ` Tom Tromey
  2011-10-30 19:52                               ` iam ahal
  0 siblings, 1 reply; 69+ messages in thread
From: Tom Tromey @ 2011-08-03 17:45 UTC (permalink / raw)
  To: iam ahal
  Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow, jan.kratochvil

>>>>> "Eldar" == iam ahal <hal9000ed2k@gmail.com> writes:

Tom> I forget (I never keep records of this, I think perhaps I should) -- did
Tom> we get you started on the copyright assignment paperwork?

Eldar> Not yet, because my previous patches is very different. I mean the
Eldar> different files was changed and I don't know which files I need to
Eldar> change in the next patch.
Eldar> I hope some people here can accept implementation in this last patch.
Eldar> After I can start the copyright assignment.

It is best to start early.  Sometimes it can take quite a while, and in
the meantime your patch will not go in.

The list of files does not really matter, since the assignment is for
past and future changes.  You can ask the copyright clerk for
clarification on this point if you need it.

I think the patch is basically fine, just a few nits.

Eldar> +static int backtrace_skip_compile;
Eldar> +static void

Tom> Newline between these two lines.

Eldar> I'm not sure that's right because I see that there's no newline in
Eldar> this case (if you look at other places related 'set backtrace ...').

Yeah, I think a newline is better, though.

Eldar> +char *
Eldar> +get_display_filename_from_sal (struct symtab_and_line *sal)
Tom> 
Tom> Should have an introductory comment before this function.

Eldar> Comment was added in 'frame.h'

Ok, thanks.
Add a comment saying to see the documentation in frame.h.

Eldar> +static const char filename_display_without_comp_dir[] = "without-compile-dir";

I think spelling out "directory" would be better.

Eldar> +  const char *filename = sal->symtab->filename;
Eldar> +  const char *dirname = sal->symtab->dirname;
Eldar> +  size_t flen = strlen (filename);
Eldar> +  size_t dlen = strlen (dirname);

This will crash if filename==NULL or dirname==NULL.

Eldar> +  if (filename_display_string == filename_display_without_comp_dir
Eldar> +      && filename && dirname && dlen <= flen
Eldar> +      && !FILENAME_NCMP (filename, dirname, dlen))

This test is not correct, in that it will match "/tmp/x" with "/tmp/xaaa".
I think it needs an additional check for a separator.

Eldar> diff -rup gdb-7.2-orig/include/filenames.h gdb-7.2/include/filenames.h

Changes to libiberty have to go to gcc-patches.
I don't think you actually need this change, though, so it would be
simpler and quicker if you left it out.

Eldar> +extern int filename_ncmp (const char *s1, const char *s2, size_t n);

This is already declared in the trunk filenames.h.
Be sure to always write patches against the trunk, not something older.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-08-03 17:45                             ` Tom Tromey
@ 2011-10-30 19:52                               ` iam ahal
  2011-11-02 19:06                                 ` Tom Tromey
  2011-11-02 22:53                                 ` Doug Evans
  0 siblings, 2 replies; 69+ messages in thread
From: iam ahal @ 2011-10-30 19:52 UTC (permalink / raw)
  To: Tom Tromey
  Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow, jan.kratochvil

[-- Attachment #1: Type: text/plain, Size: 3022 bytes --]

Copyright assignment by [gnu.org #703515] is completed.
I've corrected some pieces of the patch by your notes.
Also, I've attached the change log.

Please, check it.

Thank you.

~Eldar.

On Wed, Aug 3, 2011 at 9:44 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Eldar" == iam ahal <hal9000ed2k@gmail.com> writes:
>
> Tom> I forget (I never keep records of this, I think perhaps I should) -- did
> Tom> we get you started on the copyright assignment paperwork?
>
> Eldar> Not yet, because my previous patches is very different. I mean the
> Eldar> different files was changed and I don't know which files I need to
> Eldar> change in the next patch.
> Eldar> I hope some people here can accept implementation in this last patch.
> Eldar> After I can start the copyright assignment.
>
> It is best to start early.  Sometimes it can take quite a while, and in
> the meantime your patch will not go in.
>
> The list of files does not really matter, since the assignment is for
> past and future changes.  You can ask the copyright clerk for
> clarification on this point if you need it.
>
> I think the patch is basically fine, just a few nits.
>
> Eldar> +static int backtrace_skip_compile;
> Eldar> +static void
>
> Tom> Newline between these two lines.
>
> Eldar> I'm not sure that's right because I see that there's no newline in
> Eldar> this case (if you look at other places related 'set backtrace ...').
>
> Yeah, I think a newline is better, though.
>
> Eldar> +char *
> Eldar> +get_display_filename_from_sal (struct symtab_and_line *sal)
> Tom>
> Tom> Should have an introductory comment before this function.
>
> Eldar> Comment was added in 'frame.h'
>
> Ok, thanks.
> Add a comment saying to see the documentation in frame.h.
>
> Eldar> +static const char filename_display_without_comp_dir[] = "without-compile-dir";
>
> I think spelling out "directory" would be better.
>
> Eldar> +  const char *filename = sal->symtab->filename;
> Eldar> +  const char *dirname = sal->symtab->dirname;
> Eldar> +  size_t flen = strlen (filename);
> Eldar> +  size_t dlen = strlen (dirname);
>
> This will crash if filename==NULL or dirname==NULL.
>
> Eldar> +  if (filename_display_string == filename_display_without_comp_dir
> Eldar> +      && filename && dirname && dlen <= flen
> Eldar> +      && !FILENAME_NCMP (filename, dirname, dlen))
>
> This test is not correct, in that it will match "/tmp/x" with "/tmp/xaaa".
> I think it needs an additional check for a separator.
>
> Eldar> diff -rup gdb-7.2-orig/include/filenames.h gdb-7.2/include/filenames.h
>
> Changes to libiberty have to go to gcc-patches.
> I don't think you actually need this change, though, so it would be
> simpler and quicker if you left it out.
>
> Eldar> +extern int filename_ncmp (const char *s1, const char *s2, size_t n);
>
> This is already declared in the trunk filenames.h.
> Be sure to always write patches against the trunk, not something older.
>
> Tom
>

[-- Attachment #2: gdb-7.3.1-filename-display-v1.patch --]
[-- Type: text/x-patch, Size: 6012 bytes --]

diff -rup gdb-7.3.1-orig/gdb/doc/gdb.texinfo gdb-7.3.1/gdb/doc/gdb.texinfo
--- gdb-7.3.1-orig/gdb/doc/gdb.texinfo	2011-09-04 21:10:37.000000000 +0400
+++ gdb-7.3.1/gdb/doc/gdb.texinfo	2011-10-30 21:26:34.450274962 +0400
@@ -6052,6 +6052,19 @@ unlimited.
 
 @item show backtrace limit
 Display the current limit on backtrace levels.
+
+@item set backtrace filename-display
+@itemx set backtrace filename-display full
+Display a full filename.  This is the default.
+
+@item set backtrace filename-display basename
+Display only basename of a filename.
+
+@item set backtrace filename-display basename
+Display a filename without the compile directory part.
+
+@item show backtrace filename-display
+Display the current way to display a filename.
 @end table
 
 @node Selection
diff -rup gdb-7.3.1-orig/gdb/frame.c gdb-7.3.1/gdb/frame.c
--- gdb-7.3.1-orig/gdb/frame.c	2011-03-18 21:52:30.000000000 +0300
+++ gdb-7.3.1/gdb/frame.c	2011-10-30 21:28:45.170271140 +0400
@@ -45,6 +45,7 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "filenames.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -136,6 +137,18 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_full[] = "full";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_without_comp_directory[] = "without-compile-directory";
+
+static const char *filename_display_kind_names[] = {
+  filename_display_full,
+  filename_display_basename,
+  filename_display_without_comp_directory,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -208,6 +221,16 @@ show_backtrace_limit (struct ui_file *fi
 		    value);
 }
 
+static const char *filename_display_string = filename_display_full;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -2113,6 +2136,39 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename_display_string == filename_display_basename
+      && filename)
+    {
+      return lbasename (filename);
+    }
+  else
+  if (filename_display_string == filename_display_without_comp_directory
+      && filename && dirname && dlen && dlen <= strlen (filename)
+      && !filename_ncmp (filename, dirname, dlen))
+    {
+      const char *start = filename + dlen;
+      const char *result = start;
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
+	return result;
+      else
+	return result == start ? filename : result;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2484,6 +2540,21 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set a way how to display filename."), _("\
+Show a way how to display filename."), _("\
+filename-display can be:\n\
+  full                       - display a full filename, this is the default\n\
+  basename                   - display only basename of a filename\n\
+  without-compile-directory  - display a filename without the compile directory part\n\
+By default, full filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.3.1-orig/gdb/frame.h gdb-7.3.1/gdb/frame.h
--- gdb-7.3.1-orig/gdb/frame.h	2011-03-18 21:52:30.000000000 +0300
+++ gdb-7.3.1/gdb/frame.h	2011-10-30 20:53:23.178333185 +0400
@@ -352,6 +352,12 @@ extern int get_frame_func_if_available (
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either full filename or basename or filename
+   without compile directory part.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *get_filename_display_from_sal (struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.3.1-orig/gdb/stack.c gdb-7.3.1/gdb/stack.c
--- gdb-7.3.1-orig/gdb/stack.c	2011-03-18 21:48:56.000000000 +0300
+++ gdb-7.3.1/gdb/stack.c	2011-10-30 20:53:23.182333185 +0400
@@ -835,11 +835,15 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 839 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	Add a new variable that controls a way in which filenames in
	backtraces is displayed.
	* gdb.texinfo: Added description of 'filename-display' variable in
	'set/show backtrace' section.
	* frame.c: Added including of a header file.  Added definition of
	three global string variables and global array of string variables.
	Added definition of one global string variable.
	(show_filename_display_string): New function.
	(get_filename_display_from_sal): New function with commentary.
	(_initialize_frame): Added initialization of 'filename-display'
	variable.
	* frame.h: Added declaration of a new function with commentary.
	* stack.c (print_frame): Added new variable and calling of a new
	function and condition with this variable. Changed third argument of
	calling of a function.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-10-30 19:52                               ` iam ahal
@ 2011-11-02 19:06                                 ` Tom Tromey
  2011-11-02 22:53                                 ` Doug Evans
  1 sibling, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2011-11-02 19:06 UTC (permalink / raw)
  To: iam ahal
  Cc: gdb-patches, eliz, pmuldoon, brobecker, pedro, drow, jan.kratochvil

>>>>> "Eldar" == iam ahal <hal9000ed2k@gmail.com> writes:

Eldar> Copyright assignment by [gnu.org #703515] is completed.
Eldar> I've corrected some pieces of the patch by your notes.
Eldar> Also, I've attached the change log.

Thanks.

Eldar> diff -rup gdb-7.3.1-orig/gdb/doc/gdb.texinfo gdb-7.3.1/gdb/doc/gdb.texinfo

I don't recall whether this has had a doc review yet.

I think the patch should also include a NEWS entry.

Eldar> +@item set backtrace filename-display basename
Eldar> +Display only basename of a filename.
Eldar> +
Eldar> +@item set backtrace filename-display basename
Eldar> +Display a filename without the compile directory part.

"basename" is repeated; I think the second one should be
without-compile-directory.

Eldar> +      const char *filename_display = get_filename_display_from_sal (&sal);
Eldar> +      if (filename_display == NULL)

Blank line between these two lines.

Eldar> 2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>
Eldar> 	Add a new variable that controls a way in which filenames in
Eldar> 	backtraces is displayed.
Eldar> 	* gdb.texinfo: Added description of 'filename-display' variable in
Eldar> 	'set/show backtrace' section.

doc/ has its own ChangeLog, so this entry must go there.

Otherwise looks good, I think one more revision + doc review and it is
ready.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-10-30 19:52                               ` iam ahal
  2011-11-02 19:06                                 ` Tom Tromey
@ 2011-11-02 22:53                                 ` Doug Evans
  2011-12-04 15:52                                   ` iam ahal
  1 sibling, 1 reply; 69+ messages in thread
From: Doug Evans @ 2011-11-02 22:53 UTC (permalink / raw)
  To: iam ahal
  Cc: Tom Tromey, gdb-patches, eliz, pmuldoon, brobecker, pedro, drow,
	jan.kratochvil

On Sun, Oct 30, 2011 at 11:16 AM, iam ahal <hal9000ed2k@gmail.com> wrote:
> Copyright assignment by [gnu.org #703515] is completed.
> I've corrected some pieces of the patch by your notes.
> Also, I've attached the change log.
>
> Please, check it.
>
> Thank you.
>
> ~Eldar.

Hi.
Here's my $0.02 review.
These are all nits.

---

For your changelog entry:
[these are all for consistency with existing entries]

        Add a new variable that controls a way in which filenames in
        backtraces is displayed.

For this entry:

        * gdb.texinfo: Added description of 'filename-display' variable in
        'set/show backtrace' section.

Specify which @node the gdb.texinfo entry is for.
Existing example:
       * gdb.texinfo (Values From Inferior): Add is_lazy attribute,
       fetch_lazy method.

For this entry:

        * frame.c: Added including of a header file.  Added definition of
        three global string variables and global array of string variables.
        Added definition of one global string variable.

Specify what the variable names are.
Existing example:
       * infrun.c (disable_randomization): New global variable.

        (show_filename_display_string): New function.

For this entry:

        (get_filename_display_from_sal): New function with commentary.

No need to write "with commentary" here or below.

        (_initialize_frame): Added initialization of 'filename-display'
        variable.

For this entry:

        * frame.h: Added declaration of a new function with commentary.

You need to write the name of the function here.
Existing example:
       * value.h (read_frame_register_value): Add declaration.

        * stack.c (print_frame): Added new variable and calling of a new
        function and condition with this variable. Changed third argument of
        calling of a function.

---

For your patch:

I wish I could think of a shorter name than
"without-compile-directory", but I can't.
OTOH gdb uses "compilation directory" everywhere"
$ grep "compile.*directory" *.[ch] | wc
0 ...
$ grep "compilation.*directory" *.[ch] | wc
9 ...

Can we change this to without-compilation-directory?
[It's already long, and it still tab-completes in one character. :-)]

In get_filename_display_from_sal:

+const char *
+get_filename_display_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename_display_string == filename_display_basename
+      && filename)
+    {
+      return lbasename (filename);
+    }
[...]

There are a few "&& filename" checks.
The code would be easier to read if you did

  if (filename == NULL)
    return NULL;

at the start.

+  else
+  if (filename_display_string == filename_display_without_comp_directory

"else" and "if" go on the same line.

In stack.c:

diff -rup gdb-7.3.1-orig/gdb/stack.c gdb-7.3.1/gdb/stack.c
--- gdb-7.3.1-orig/gdb/stack.c	2011-03-18 21:48:56.000000000 +0300
+++ gdb-7.3.1/gdb/stack.c	2011-10-30 20:53:23.182333185 +0400
@@ -835,11 +835,15 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

If filename_display is NULL it's because sal.symtab->filename was NULL.
[right?]
This is confusing.
I suggest removing this code:

+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-11-02 22:53                                 ` Doug Evans
@ 2011-12-04 15:52                                   ` iam ahal
  2011-12-04 16:55                                     ` Eli Zaretskii
                                                       ` (2 more replies)
  0 siblings, 3 replies; 69+ messages in thread
From: iam ahal @ 2011-12-04 15:52 UTC (permalink / raw)
  To: Tom Tromey
  Cc: Doug Evans, gdb-patches, eliz, pmuldoon, brobecker, pedro, drow,
	jan.kratochvil

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

To Tom Tromey, Doug Evans:

Sorry for a late response, unfortunately, I've been busy at work.
Thanks for the review. I've checked and corrected the patch by your
comments.
See changed files in the attachment.

On Wed, Nov 2, 2011 at 11:05 PM, Tom Tromey <tromey@redhat.com> wrote:
> I don't recall whether this has had a doc review yet.

You have not reviewed a text for this feature in the documentation.

> I think the patch should also include a NEWS entry.

I don't have an idea how to fill out a NEWS entry. It has descriptions
only for release versions.

On Thu, Nov 3, 2011 at 2:53 AM, Doug Evans <dje@google.com> wrote:
> If filename_display is NULL it's because sal.symtab->filename was NULL.
> [right?]
> This is confusing.
> I suggest removing this code:
>
> +      if (filename_display == NULL)
> +         filename_display = sal.symtab->filename;

I leave this check because I suppose that we don't need to know how to
work this function.
So I don't need to know when it can return NULL.
It's reliable in a sense that everybody can modify this function (e.g.
I can add new cases when it returns NULL).

~Eldar.

[-- Attachment #2: gdb-filename-display.patch --]
[-- Type: text/x-patch, Size: 6089 bytes --]

diff -rup gdb-7.3.1-orig/gdb/doc/gdb.texinfo gdb-7.3.1/gdb/doc/gdb.texinfo
--- gdb-7.3.1-orig/gdb/doc/gdb.texinfo	2011-09-04 21:10:37.000000000 +0400
+++ gdb-7.3.1/gdb/doc/gdb.texinfo	2011-12-04 18:16:03.182293844 +0400
@@ -6052,6 +6052,19 @@ unlimited.
 
 @item show backtrace limit
 Display the current limit on backtrace levels.
+
+@item set backtrace filename-display
+@itemx set backtrace filename-display full
+Display a full filename.  This is the default.
+
+@item set backtrace filename-display basename
+Display only basename of a filename.
+
+@item set backtrace filename-display without-compilation-directory
+Display a filename without the compilation directory part.
+
+@item show backtrace filename-display
+Display the current way to display a filename.
 @end table
 
 @node Selection
diff -rup gdb-7.3.1-orig/gdb/frame.c gdb-7.3.1/gdb/frame.c
--- gdb-7.3.1-orig/gdb/frame.c	2011-03-18 21:52:30.000000000 +0300
+++ gdb-7.3.1/gdb/frame.c	2011-12-04 18:20:23.594286230 +0400
@@ -45,6 +45,7 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "filenames.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -136,6 +137,18 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_full[] = "full";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_without_comp_directory[] = "without-compilation-directory";
+
+static const char *filename_display_kind_names[] = {
+  filename_display_full,
+  filename_display_basename,
+  filename_display_without_comp_directory,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -208,6 +221,16 @@ show_backtrace_limit (struct ui_file *fi
 		    value);
 }
 
+static const char *filename_display_string = filename_display_full;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -2113,6 +2136,41 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename == NULL)
+    {
+      return NULL;
+    }
+  else if (filename_display_string == filename_display_basename)
+    {
+      return lbasename (filename);
+    }
+  else if (filename_display_string == filename_display_without_comp_directory
+      && dirname && dlen && dlen <= strlen (filename)
+      && !filename_ncmp (filename, dirname, dlen))
+    {
+      const char *start = filename + dlen;
+      const char *result = start;
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
+	return result;
+      else
+	return result == start ? filename : result;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2484,6 +2542,21 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set a way how to display filename."), _("\
+Show a way how to display filename."), _("\
+filename-display can be:\n\
+  full                           - display a full filename, this is the default\n\
+  basename                       - display only basename of a filename\n\
+  without-compilation-directory  - display a filename without the compilation directory part\n\
+By default, full filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.3.1-orig/gdb/frame.h gdb-7.3.1/gdb/frame.h
--- gdb-7.3.1-orig/gdb/frame.h	2011-03-18 21:52:30.000000000 +0300
+++ gdb-7.3.1/gdb/frame.h	2011-12-04 17:22:55.998387032 +0400
@@ -352,6 +352,12 @@ extern int get_frame_func_if_available (
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either full filename or basename or filename
+   without compile directory part.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *get_filename_display_from_sal (struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.3.1-orig/gdb/stack.c gdb-7.3.1/gdb/stack.c
--- gdb-7.3.1-orig/gdb/stack.c	2011-03-18 21:48:56.000000000 +0300
+++ gdb-7.3.1/gdb/stack.c	2011-12-04 17:31:30.194371998 +0400
@@ -835,11 +835,16 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 796 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	Add a new variable that controls a way in which filenames in
	backtraces is displayed.
	* frame.c: Added including of a header file.
	(filename_display_full): New global variable.
	(filename_display_basename): New global variable.
	(filename_display_without_comp_directory): New global variable.
	(filename_display_kind_names): New global array.
	(show_filename_display_string): New function.
	(get_filename_display_from_sal): New function.
	(_initialize_frame): Added initialization of 'filename-display'
	variable.
	* frame.h (get_filename_display_from_sal): Added declaration.
	* stack.c (print_frame): Added new variable and calling of a new
	function and condition with this variable. Changed third argument of
	calling of a function.

[-- Attachment #4: ChangeLog-doc --]
[-- Type: application/octet-stream, Size: 166 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* gdb.texinfo (Backtrace): Added description of 'filename-display'
	variable in 'set/show backtrace' section.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 15:52                                   ` iam ahal
@ 2011-12-04 16:55                                     ` Eli Zaretskii
  2011-12-04 18:41                                       ` iam ahal
  2011-12-06 20:40                                     ` Tom Tromey
  2011-12-06 23:02                                     ` Jan Kratochvil
  2 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-04 16:55 UTC (permalink / raw)
  To: iam ahal
  Cc: tromey, dje, gdb-patches, pmuldoon, brobecker, pedro, drow,
	jan.kratochvil

> Date: Sun, 4 Dec 2011 18:52:19 +0300
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: Doug Evans <dje@google.com>, gdb-patches@sourceware.org, eliz@gnu.org, 
> 	pmuldoon@redhat.com, brobecker@adacore.com, pedro@codesourcery.com, 
> 	drow@false.org, jan.kratochvil@redhat.com
> 
> On Wed, Nov 2, 2011 at 11:05 PM, Tom Tromey <tromey@redhat.com> wrote:
> > I don't recall whether this has had a doc review yet.
> 
> You have not reviewed a text for this feature in the documentation.

Below.

> > I think the patch should also include a NEWS entry.
> 
> I don't have an idea how to fill out a NEWS entry. It has descriptions
> only for release versions.

A NEWS entry should announce the new option, see the section "New
options" for a few examples.

> --- gdb-7.3.1-orig/gdb/doc/gdb.texinfo	2011-09-04 21:10:37.000000000 +0400
> +++ gdb-7.3.1/gdb/doc/gdb.texinfo	2011-12-04 18:16:03.182293844 +0400
> @@ -6052,6 +6052,19 @@ unlimited.
>  
>  @item show backtrace limit
>  Display the current limit on backtrace levels.
> +
> +@item set backtrace filename-display
> +@itemx set backtrace filename-display full
> +Display a full filename.  This is the default.
> +
> +@item set backtrace filename-display basename
> +Display only basename of a filename.
> +
> +@item set backtrace filename-display without-compilation-directory
> +Display a filename without the compilation directory part.
> +
> +@item show backtrace filename-display
> +Display the current way to display a filename.
>  @end table

This has several problems.  First of all, it is not a good idea to add
these entries to this particular @table, because the text preceding it
talks about a completely unrelated situation:

  If you need to examine the startup code, or limit the number of levels
  in a backtrace, you can change this behavior:

So I think this needs a separate preamble, 1 or 2 sentences explaining
the situation where this option is useful, and a separate @table.

Second, this:

> +@item set backtrace filename-display
> +@itemx set backtrace filename-display full
> +Display a full filename.  This is the default.

is too general: this option controls only the display of file names in
backtraces, right?  So the description should say "Display ... in
backtraces."

Third, how come "full" is the default? are we changing the present
behavior whereby only the basename is displayed in backtraces?  Or am
I missing something?

Fourth, I couldn't understand clearly what is the effect of
without-compilation-directory value.  I think we should explain it in
a more clear way.

Fifth, "Display the current way to display..." should be reworded to
avoid using "display" twice in a row.

Finally, this option should have a @cindex entry.

I can fix this text, if you want, once I understand the situation with
the default value of this option, and once I understand the semantics
of without-compilation-directory.

> +  add_setshow_enum_cmd ("filename-display", class_obscure,
> +			filename_display_kind_names,
> +			&filename_display_string, _("\
> +Set a way how to display filename."), _("\
> +Show a way how to display filename."), _("\

Again, this should say "in backtraces".

And please remove the "a way" part, it is not needed in both of these
sentences.  Just "Set how to display ..." is good enough.

Thanks.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 16:55                                     ` Eli Zaretskii
@ 2011-12-04 18:41                                       ` iam ahal
  2011-12-04 19:01                                         ` Pedro Alves
  0 siblings, 1 reply; 69+ messages in thread
From: iam ahal @ 2011-12-04 18:41 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: tromey, dje, gdb-patches, pmuldoon, brobecker, pedro, drow,
	jan.kratochvil

On Sun, Dec 4, 2011 at 8:53 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> I can fix this text, if you want, once I understand the situation with
> the default value of this option, and once I understand the semantics
> of without-compilation-directory.

Yep, I agree.
To speed up the process of the submitting of my feature, I think your
help in correcting documentation would be great.

~Eldar

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 18:41                                       ` iam ahal
@ 2011-12-04 19:01                                         ` Pedro Alves
  2011-12-04 19:56                                           ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: Pedro Alves @ 2011-12-04 19:01 UTC (permalink / raw)
  To: iam ahal
  Cc: Eli Zaretskii, tromey, dje, gdb-patches, pmuldoon, brobecker,
	drow, jan.kratochvil

On Sunday 04 December 2011 18:41:16, iam ahal wrote:
> > of without-compilation-directory.

At the risk of being bikesheddy, I suggest "no-compilation-directory" instead.
5 whole letters less.  :-)  Somehow it sounds more gdb-idiomatic to me.

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 19:01                                         ` Pedro Alves
@ 2011-12-04 19:56                                           ` Eli Zaretskii
  2011-12-04 21:00                                             ` Pedro Alves
  0 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-04 19:56 UTC (permalink / raw)
  To: Pedro Alves
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Sun, 4 Dec 2011 19:01:04 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>,
>  tromey@redhat.com,
>  dje@google.com,
>  gdb-patches@sourceware.org,
>  pmuldoon@redhat.com,
>  brobecker@adacore.com,
>  drow@false.org,
>  jan.kratochvil@redhat.com
> 
> On Sunday 04 December 2011 18:41:16, iam ahal wrote:
> > > of without-compilation-directory.
> 
> At the risk of being bikesheddy, I suggest "no-compilation-directory" instead.
> 5 whole letters less.  :-)  Somehow it sounds more gdb-idiomatic to me.

Fine with me, but it still falls short of explaining what exactly is
removed from the file name.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 19:56                                           ` Eli Zaretskii
@ 2011-12-04 21:00                                             ` Pedro Alves
  2011-12-05  3:54                                               ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: Pedro Alves @ 2011-12-04 21:00 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

On Sunday 04 December 2011 19:55:19, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > On Sunday 04 December 2011 18:41:16, iam ahal wrote:
> > > > of without-compilation-directory.
> > 
> > At the risk of being bikesheddy, I suggest "no-compilation-directory" instead.
> > 5 whole letters less.  :-)  Somehow it sounds more gdb-idiomatic to me.
> 
> Fine with me, but it still falls short of explaining what exactly is
> removed from the file name.

The working directory of the compilation command that produced the
frame's compilation unit.  E.g., with:

$ pwd
/foo/bar
$ gcc a/b.c

If the debug info supports a notion of compilation directory (DW_AT_comp_dir
in dwarf), the full name is /foo/bar/a/b.c and the compilation
directory is /foo/bar.  The no-compilation-directory option
would the show a/b.c .

I'd rather have a positive option, rather than a negative one (no-|without-),
but I'm failing to find a better name.  I thought of "relative",
but that's not entirely accurate -- it can be a full path too.  I can live
with no-compilation-directory.  Just saying I tried and failed.

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 21:00                                             ` Pedro Alves
@ 2011-12-05  3:54                                               ` Eli Zaretskii
  2011-12-05  5:17                                                 ` Eli Zaretskii
  2011-12-06 12:50                                                 ` Pedro Alves
  0 siblings, 2 replies; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-05  3:54 UTC (permalink / raw)
  To: Pedro Alves
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Sun, 4 Dec 2011 21:00:16 +0000
> Cc: hal9000ed2k@gmail.com,
>  tromey@redhat.com,
>  dje@google.com,
>  gdb-patches@sourceware.org,
>  pmuldoon@redhat.com,
>  brobecker@adacore.com,
>  drow@false.org,
>  jan.kratochvil@redhat.com
> 
> $ pwd
> /foo/bar
> $ gcc a/b.c
> 
> If the debug info supports a notion of compilation directory (DW_AT_comp_dir
> in dwarf), the full name is /foo/bar/a/b.c and the compilation
> directory is /foo/bar.  The no-compilation-directory option
> would the show a/b.c .
> 
> I'd rather have a positive option, rather than a negative one (no-|without-),
> but I'm failing to find a better name.  I thought of "relative",
> but that's not entirely accurate -- it can be a full path too.  I can live
> with no-compilation-directory.  Just saying I tried and failed.

How about `relative-to-compilation-directory'?  Or just `relative'
(since we use `full', not `full-absolute-file-name')?

And what about the question I asked regarding the default?  AFAIK, the
current behavior is equivalent to `basename', not to `full'.

Thanks.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-05  3:54                                               ` Eli Zaretskii
@ 2011-12-05  5:17                                                 ` Eli Zaretskii
  2011-12-06 13:03                                                   ` Pedro Alves
  2011-12-06 12:50                                                 ` Pedro Alves
  1 sibling, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-05  5:17 UTC (permalink / raw)
  To: pedro
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> Date: Mon, 05 Dec 2011 05:52:34 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: hal9000ed2k@gmail.com, tromey@redhat.com, dje@google.com, gdb-patches@sourceware.org, pmuldoon@redhat.com, brobecker@adacore.com, drow@false.org, jan.kratochvil@redhat.com
> Reply-to: Eli Zaretskii <eliz@gnu.org>
> 
> And what about the question I asked regarding the default?  AFAIK, the
> current behavior is equivalent to `basename', not to `full'.

I think I know the answer.  We show by default whatever the compiler
saw on its command line when it compiled the source file.  E.g., if
the command was

  gcc -c ... /foo/bar/baz.c

then GDB will show "/foo/bar/baz.c", but if the compilation command
was

  gcc -c ... baz.c

then GDB will show "baz.c".

Is that correct?  If so, calling this `full' is misleading, I think,
unless we really change GDB to always show a full absolute file name
there.  If we don't want to change, I suggest to call it `normal' or
maybe `default' (with explanation along the above lines).

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-05  3:54                                               ` Eli Zaretskii
  2011-12-05  5:17                                                 ` Eli Zaretskii
@ 2011-12-06 12:50                                                 ` Pedro Alves
  1 sibling, 0 replies; 69+ messages in thread
From: Pedro Alves @ 2011-12-06 12:50 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

On Monday 05 December 2011 03:52:34, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > $ pwd
> > /foo/bar
> > $ gcc a/b.c
> > 
> > If the debug info supports a notion of compilation directory (DW_AT_comp_dir
> > in dwarf), the full name is /foo/bar/a/b.c and the compilation
> > directory is /foo/bar.  The no-compilation-directory option
> > would the show a/b.c .
> > 
> > I'd rather have a positive option, rather than a negative one (no-|without-),
> > but I'm failing to find a better name.  I thought of "relative",
> > but that's not entirely accurate -- it can be a full path too.  I can live
> > with no-compilation-directory.  Just saying I tried and failed.
> 
> How about `relative-to-compilation-directory'?  Or just `relative'
> (since we use `full', not `full-absolute-file-name')?

Hmm, yeah, explaining "relative" in terms of
"relative to compilation directory" makes it okay, I suppose.

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-05  5:17                                                 ` Eli Zaretskii
@ 2011-12-06 13:03                                                   ` Pedro Alves
  2011-12-06 14:04                                                     ` Eli Zaretskii
  0 siblings, 1 reply; 69+ messages in thread
From: Pedro Alves @ 2011-12-06 13:03 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

On Monday 05 December 2011 05:17:19, Eli Zaretskii wrote:
> > Date: Mon, 05 Dec 2011 05:52:34 +0200
> > From: Eli Zaretskii <eliz@gnu.org>

> > And what about the question I asked regarding the default?  AFAIK, the
> > current behavior is equivalent to `basename', not to `full'.
> 
> I think I know the answer.  We show by default whatever the compiler
> saw on its command line when it compiled the source file.  E.g., if
> the command was
> 
>   gcc -c ... /foo/bar/baz.c
> 
> then GDB will show "/foo/bar/baz.c", but if the compilation command
> was
> 
>   gcc -c ... baz.c
> 
> then GDB will show "baz.c".

> 
> Is that correct?  If so, calling this `full' is misleading, I think,

If that is correct, than the default isn't "full", but
the proposed "no-compile-directory" ?  Or maybe your compiler didn't emit
the comp_dir attribute in the debug info.  I don't really know what
is the current default, and I'm now confused too.  :-)

> unless we really change GDB to always show a full absolute file name
> there.  If we don't want to change, I suggest to call it `normal' or
> maybe `default' (with explanation along the above lines).

I don't think normal or default are good names (with IMO default being
a really bad name), because that'll confuse things a lot if we ever 
flip the default.

-- 
Pedro Alves

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-06 13:03                                                   ` Pedro Alves
@ 2011-12-06 14:04                                                     ` Eli Zaretskii
  2011-12-06 18:00                                                       ` Doug Evans
  2011-12-06 20:45                                                       ` Tom Tromey
  0 siblings, 2 replies; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-06 14:04 UTC (permalink / raw)
  To: Pedro Alves
  Cc: hal9000ed2k, tromey, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Tue, 6 Dec 2011 12:49:47 +0000
> Cc: hal9000ed2k@gmail.com,
>  tromey@redhat.com,
>  dje@google.com,
>  gdb-patches@sourceware.org,
>  pmuldoon@redhat.com,
>  brobecker@adacore.com,
>  drow@false.org,
>  jan.kratochvil@redhat.com
> 
> > if the command was
> > 
> >   gcc -c ... /foo/bar/baz.c
> > 
> > then GDB will show "/foo/bar/baz.c", but if the compilation command
> > was
> > 
> >   gcc -c ... baz.c
> > 
> > then GDB will show "baz.c".
> 
> > 
> > Is that correct?  If so, calling this `full' is misleading, I think,
> 
> If that is correct, than the default isn't "full", but
> the proposed "no-compile-directory" ?

No, it's `full', because the compile directory was "/foo/bar".

> Or maybe your compiler didn't emit the comp_dir attribute in the
> debug info.

"My compiler" in this case identifies itself as

  gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

I'd be surprised if this version omits comp_dir, but if someone tells
me how to check that, I will.

> I don't really know what is the current default, and I'm now
> confused too.  :-)

Then I'm in good company ;-)

> > unless we really change GDB to always show a full absolute file name
> > there.  If we don't want to change, I suggest to call it `normal' or
> > maybe `default' (with explanation along the above lines).
> 
> I don't think normal or default are good names

Then maybe "as-recorded"?  Meaning that this is how the compiler
recorded the file name in the debug info?

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-06 14:04                                                     ` Eli Zaretskii
@ 2011-12-06 18:00                                                       ` Doug Evans
  2011-12-06 20:45                                                       ` Tom Tromey
  1 sibling, 0 replies; 69+ messages in thread
From: Doug Evans @ 2011-12-06 18:00 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Pedro Alves, hal9000ed2k, tromey, gdb-patches, pmuldoon,
	brobecker, drow, jan.kratochvil

On Tue, Dec 6, 2011 at 5:03 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Pedro Alves <pedro@codesourcery.com>
>> Date: Tue, 6 Dec 2011 12:49:47 +0000
>> Cc: hal9000ed2k@gmail.com,
>>  tromey@redhat.com,
>>  dje@google.com,
>>  gdb-patches@sourceware.org,
>>  pmuldoon@redhat.com,
>>  brobecker@adacore.com,
>>  drow@false.org,
>>  jan.kratochvil@redhat.com
>>
>> > if the command was
>> >
>> >   gcc -c ... /foo/bar/baz.c
>> >
>> > then GDB will show "/foo/bar/baz.c", but if the compilation command
>> > was
>> >
>> >   gcc -c ... baz.c
>> >
>> > then GDB will show "baz.c".
>>
>> >
>> > Is that correct?  If so, calling this `full' is misleading, I think,
>>
>> If that is correct, than the default isn't "full", but
>> the proposed "no-compile-directory" ?
>
> No, it's `full', because the compile directory was "/foo/bar".
>
>> Or maybe your compiler didn't emit the comp_dir attribute in the
>> debug info.
>
> "My compiler" in this case identifies itself as
>
>  gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
>
> I'd be surprised if this version omits comp_dir, but if someone tells
> me how to check that, I will.
>
>> I don't really know what is the current default, and I'm now
>> confused too.  :-)
>
> Then I'm in good company ;-)
>
>> > unless we really change GDB to always show a full absolute file name
>> > there.  If we don't want to change, I suggest to call it `normal' or
>> > maybe `default' (with explanation along the above lines).
>>
>> I don't think normal or default are good names
>
> Then maybe "as-recorded"?  Meaning that this is how the compiler
> recorded the file name in the debug info?

I like that.
Something along the lines of "set backtrace file-name as-recorded|full|base" ?

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 15:52                                   ` iam ahal
  2011-12-04 16:55                                     ` Eli Zaretskii
@ 2011-12-06 20:40                                     ` Tom Tromey
  2011-12-06 23:02                                     ` Jan Kratochvil
  2 siblings, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2011-12-06 20:40 UTC (permalink / raw)
  To: iam ahal
  Cc: Doug Evans, gdb-patches, eliz, pmuldoon, brobecker, pedro, drow,
	jan.kratochvil

>>>>> "iam" == iam ahal <hal9000ed2k@gmail.com> writes:

iam> Sorry for a late response, unfortunately, I've been busy at work.

No problem.  Thanks for following up.

iam> +static const char filename_display_without_comp_directory[] = "without-compilation-directory";

Just to be clear, the patch is contingent on the naming discussion that
is taking place.

iam> +get_filename_display_from_sal (struct symtab_and_line *sal)

How about const struct symtab_and_line *?

iam> +  else if (filename_display_string == filename_display_without_comp_directory
iam> +      && dirname && dlen && dlen <= strlen (filename)
iam> +      && !filename_ncmp (filename, dirname, dlen))

The indentation here looks wrong.
The "&&" should line up underneath "filename_display_string".

iam> +    {
iam> +      const char *start = filename + dlen;
iam> +      const char *result = start;
iam> +      while (IS_DIR_SEPARATOR (*result))

Blank line between declarations and code.

The rest looks reasonable to me.
Thanks again.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-06 14:04                                                     ` Eli Zaretskii
  2011-12-06 18:00                                                       ` Doug Evans
@ 2011-12-06 20:45                                                       ` Tom Tromey
  2011-12-07  8:00                                                         ` Eli Zaretskii
  1 sibling, 1 reply; 69+ messages in thread
From: Tom Tromey @ 2011-12-06 20:45 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Pedro Alves, hal9000ed2k, dje, gdb-patches, pmuldoon, brobecker,
	drow, jan.kratochvil

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli> Then maybe "as-recorded"?  Meaning that this is how the compiler
Eli> recorded the file name in the debug info?

Works for me.

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-04 15:52                                   ` iam ahal
  2011-12-04 16:55                                     ` Eli Zaretskii
  2011-12-06 20:40                                     ` Tom Tromey
@ 2011-12-06 23:02                                     ` Jan Kratochvil
  2 siblings, 0 replies; 69+ messages in thread
From: Jan Kratochvil @ 2011-12-06 23:02 UTC (permalink / raw)
  To: iam ahal
  Cc: Tom Tromey, Doug Evans, gdb-patches, eliz, pmuldoon, brobecker,
	pedro, drow

Hi Eldar,

I really miss a testcase here as I had no clue what the settings print in
fact.  Also I expect you have a compiler producing:
    <11>   DW_AT_name        : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c	
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb	
in some case but I do not see how to get such DWARF from Fedora 16 GCC.
Therefore to test all the DWARF cases one needs a gdb.dwarf2/ testcase for it.
I will write one if you do not want to.  One may easily break the behavior with
future changes otherwise.

The doc should also IMO contain some samples, what is "full filename".
I would assume it means /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c but
apparently it does not.

Test commands expects ./gdb-clean to be FSF GDB HEAD and ./gdb patched gdb.
for d in "" $PWD/;do rm -rf 35 35.c 35d 35l.so;mkdir 35d;echo 'extern void f (void); int main (void) { f (); return 0; }' >35.c;echo 'void f (void) {}' >35d/35l.c;gcc -o 35l.so -Wl,-soname,./35l.so -shared -fPIC -Wall -g ${d}35d/35l.c; gcc -o 35 35.c -Wall -g ./35l.so;./gdb-clean -ex 'set break pend on' -q -nx ./35 -ex 'b f' -ex r -ex 'bt' -ex c -ex q | grep ' f ';for i in basename full without-compilation-directory;do echo ---$i;./gdb -ex "set backtrace filename-display $i" -ex 'set break pend on' -q -nx ./35 -ex 'b f' -ex r -ex 'bt' -ex c -ex q | grep ' f ';done;readelf -wi 35l.so|grep -E 'DW_AT_(producer|name|comp_dir)';done

gcc 35d/35l.c ...
    <c>   DW_AT_producer    : (indirect string, offset: 0x0): GNU C 4.6.2 20111027 (Red Hat 4.6.2-1) -mtune=generic -march=x86-64 -g -fPIC	
    <11>   DW_AT_name        : (indirect string, offset: 0x71): 35d/35l.c	
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb	
- FSF GDB HEAD:
#0  f () at 35d/35l.c:1
- set backtrace filename-display basename
#0  f () at 35l.c:1
- set backtrace filename-display full
#0  f () at 35d/35l.c:1
- set backtrace filename-display without-compilation-directory
#0  f () at 35d/35l.c:1

gcc $PWD/35d/35l.c ...
    <c>   DW_AT_producer    : (indirect string, offset: 0x0): GNU C 4.6.2 20111027 (Red Hat 4.6.2-1) -mtune=generic -march=x86-64 -g -fPIC	
    <11>   DW_AT_name        : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c	
- FSF GDB HEAD
#0  f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
- set backtrace filename-display basename
#0  f () at 35l.c:1
- set backtrace filename-display full
#0  f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
- set backtrace filename-display without-compilation-directory
#0  f () at 35l.c:1

I miss there an option to print the output of symtab_to_fullname which was
requested by Red Hat desktop developers, therefore to print:
	#0  f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
even if it was compiled as 35d/35l.c and not $PWD/35d/35l.c.


Thanks,
Jan

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-06 20:45                                                       ` Tom Tromey
@ 2011-12-07  8:00                                                         ` Eli Zaretskii
  2012-03-10 20:15                                                           ` iam ahal
  0 siblings, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2011-12-07  8:00 UTC (permalink / raw)
  To: Tom Tromey
  Cc: pedro, hal9000ed2k, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> From: Tom Tromey <tromey@redhat.com>
> Cc: Pedro Alves <pedro@codesourcery.com>, hal9000ed2k@gmail.com,
>         dje@google.com, gdb-patches@sourceware.org, pmuldoon@redhat.com,
>         brobecker@adacore.com, drow@false.org, jan.kratochvil@redhat.com
> Date: Tue, 06 Dec 2011 13:40:16 -0700
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> Eli> Then maybe "as-recorded"?  Meaning that this is how the compiler
> Eli> recorded the file name in the debug info?
> 
> Works for me.

Thanks for the feedback.  However, I still would like to know whether
my guess regarding the current default, viz.:

  I think I know the answer.  We show by default whatever the compiler
  saw on its command line when it compiled the source file.  E.g., if
  the command was

    gcc -c ... /foo/bar/baz.c

  then GDB will show "/foo/bar/baz.c", but if the compilation command
  was

    gcc -c ... baz.c

  then GDB will show "baz.c".

is correct.  If this is correct, then we will need an additional
setting of the new option.  Or maybe I misunderstand, and the
consensus here is to _rename_ "full" to "as-recorded" and otherwise
leave the implementation intact?

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-12-07  8:00                                                         ` Eli Zaretskii
@ 2012-03-10 20:15                                                           ` iam ahal
  2012-03-11  1:22                                                             ` asmwarrior
                                                                               ` (4 more replies)
  0 siblings, 5 replies; 69+ messages in thread
From: iam ahal @ 2012-03-10 20:15 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Tom Tromey, pedro, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

First of all, I'm sorry for a late response (again). Fortunately, at
last, I've found free time at my weekend.
Thanks for the review since my last message.

To Eli Zaretskii, Tom Tromey, Pedro Alves, Doug Evans

I've tried carefully to fix documentation and a little piece of code.
Also, I've added NEWS entry.
Please, check this out.

To Jan Kratochvil

It would be great if you write.

To Tom Tromey

Copyright assignment has been done. As you wrote at 12.07.11 this
patch was almost done.
I think I get closer.

Thank in advance.

[-- Attachment #2: ChangeLog --]
[-- Type: application/octet-stream, Size: 796 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	Add a new variable that controls a way in which filenames in
	backtraces is displayed.
	* frame.c: Added including of a header file.
	(filename_display_full): New global variable.
	(filename_display_basename): New global variable.
	(filename_display_without_comp_directory): New global variable.
	(filename_display_kind_names): New global array.
	(show_filename_display_string): New function.
	(get_filename_display_from_sal): New function.
	(_initialize_frame): Added initialization of 'filename-display'
	variable.
	* frame.h (get_filename_display_from_sal): Added declaration.
	* stack.c (print_frame): Added new variable and calling of a new
	function and condition with this variable. Changed third argument of
	calling of a function.

[-- Attachment #3: ChangeLog-doc --]
[-- Type: application/octet-stream, Size: 166 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* gdb.texinfo (Backtrace): Added description of 'filename-display'
	variable in 'set/show backtrace' section.

[-- Attachment #4: gdb-filename-display.patch --]
[-- Type: text/x-patch, Size: 6346 bytes --]

diff -rup gdb-7.4-orig/gdb/doc/gdb.texinfo gdb-7.4/gdb/doc/gdb.texinfo
--- gdb-7.4-orig/gdb/doc/gdb.texinfo	2012-01-06 08:43:35.000000000 +0400
+++ gdb-7.4/gdb/doc/gdb.texinfo	2012-03-10 23:10:42.432243654 +0400
@@ -6191,6 +6191,26 @@ unlimited.
 Display the current limit on backtrace levels.
 @end table
 
+If backtraces isn't easy to read due to a long absolute filename path recorded and 
+you just want to see only a basename or a relative filename path, you can change this 
+behaviour:
+
+@table @code
+@item set backtrace filename-display
+@itemx set backtrace filename-display as-recorded
+@cindex backtrace filename-display
+Display a filename recorded at the compilation time.  This is the default.
+
+@item set backtrace filename-display basename
+Display only basename of a filename.
+
+@item set backtrace filename-display relative
+Display a filename without the compilation directory part.
+
+@item show backtrace filename-display
+Show the current way to display a filename in backtraces.
+@end table
+
 @node Selection
 @section Selecting a Frame
 
diff -rup gdb-7.4-orig/gdb/frame.c gdb-7.4/gdb/frame.c
--- gdb-7.4-orig/gdb/frame.c	2012-01-06 08:43:12.000000000 +0400
+++ gdb-7.4/gdb/frame.c	2012-03-10 23:10:36.060243841 +0400
@@ -44,6 +44,7 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "filenames.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -135,6 +136,18 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_as_recorded[] = "as-recorded";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_relative_directory[] = "relative";
+
+static const char *filename_display_kind_names[] = {
+  filename_display_as_recorded,
+  filename_display_basename,
+  filename_display_relative_directory,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -207,6 +220,16 @@ show_backtrace_limit (struct ui_file *fi
 		    value);
 }
 
+static const char *filename_display_string = filename_display_as_recorded;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -2118,6 +2141,42 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (const struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename == NULL)
+    {
+      return NULL;
+    }
+  else if (filename_display_string == filename_display_basename)
+    {
+      return lbasename (filename);
+    }
+  else if (filename_display_string == filename_display_relative_directory &&
+      dirname && dlen && dlen <= strlen (filename) &&
+      !filename_ncmp (filename, dirname, dlen))
+    {
+      const char *start = filename + dlen;
+      const char *result = start;
+
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
+	return result;
+      else
+	return result == start ? filename : result;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2477,6 +2536,21 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set how to display filename in backtraces."), _("\
+Show how to display filename in backtraces."), _("\
+filename-display can be:\n\
+  as-recorded       - display a filename recorded at the compilation time\n\
+  basename          - display only basename of a filename\n\
+  relative          - display a filename without the compilation directory part\n\
+By default, as-recorded filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.4-orig/gdb/frame.h gdb-7.4/gdb/frame.h
--- gdb-7.4-orig/gdb/frame.h	2012-01-06 08:43:12.000000000 +0400
+++ gdb-7.4/gdb/frame.h	2012-03-10 23:13:36.452238567 +0400
@@ -353,6 +353,12 @@ extern int get_frame_func_if_available (
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either 'as recorded' filename or basename or filename
+   without the compile directory part.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *get_filename_display_from_sal (const struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.4-orig/gdb/stack.c gdb-7.4/gdb/stack.c
--- gdb-7.4-orig/gdb/stack.c	2012-01-06 08:43:31.000000000 +0400
+++ gdb-7.4/gdb/stack.c	2012-03-10 22:17:18.628337327 +0400
@@ -1173,11 +1173,16 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

[-- Attachment #5: NEWS --]
[-- Type: application/octet-stream, Size: 172 bytes --]

* New options

set backtrace filename-display as-recorded|basename|relative
show backtrace filename-display
  Control a way in which a filename is displayed in backtraces.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-10 20:15                                                           ` iam ahal
@ 2012-03-11  1:22                                                             ` asmwarrior
  2012-03-12 13:10                                                               ` iam ahal
  2012-03-14 16:11                                                             ` Tom Tromey
                                                                               ` (3 subsequent siblings)
  4 siblings, 1 reply; 69+ messages in thread
From: asmwarrior @ 2012-03-11  1:22 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches

On 2012-3-11 4:14, iam ahal wrote:
> First of all, I'm sorry for a late response (again). Fortunately, at
> last, I've found free time at my weekend.
> Thanks for the review since my last message.
>
> To Eli Zaretskii, Tom Tromey, Pedro Alves, Doug Evans
>
> I've tried carefully to fix documentation and a little piece of code.
> Also, I've added NEWS entry.
> Please, check this out.
>

Could you consider adding an option to show the fullpath?
See:
http://sourceware.org/ml/gdb-patches/2012-03/msg00073.html

Thanks.

Yuanhui Zhang

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-11  1:22                                                             ` asmwarrior
@ 2012-03-12 13:10                                                               ` iam ahal
  0 siblings, 0 replies; 69+ messages in thread
From: iam ahal @ 2012-03-12 13:10 UTC (permalink / raw)
  To: asmwarrior, Tom Tromey, gdb-patches

Sure. But before making new changes, I just want to get the
maintainer's review of my patch which I've sent Saturday.

Thanks.

~Eldar

On Sun, Mar 11, 2012 at 5:22 AM, asmwarrior <asmwarrior@gmail.com> wrote:
> Could you consider adding an option to show the fullpath?
> See:
> http://sourceware.org/ml/gdb-patches/2012-03/msg00073.html
>
> Thanks.
>
> Yuanhui Zhang

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-10 20:15                                                           ` iam ahal
  2012-03-11  1:22                                                             ` asmwarrior
@ 2012-03-14 16:11                                                             ` Tom Tromey
  2012-03-14 16:27                                                             ` Jan Kratochvil
                                                                               ` (2 subsequent siblings)
  4 siblings, 0 replies; 69+ messages in thread
From: Tom Tromey @ 2012-03-14 16:11 UTC (permalink / raw)
  To: iam ahal
  Cc: Eli Zaretskii, pedro, dje, gdb-patches, pmuldoon, brobecker,
	drow, jan.kratochvil

>>>>> "Iam" == iam ahal <hal9000ed2k@gmail.com> writes:

Iam> First of all, I'm sorry for a late response (again).

No problem :)

Iam> Copyright assignment has been done.

Super.

I have just a few nits.

Iam> +If backtraces isn't easy to read due to a long absolute filename path recorded and 
Iam> +you just want to see only a basename or a relative filename path, you can change this 
Iam> +behaviour:

These lines are too long.
gdb uses the American English spelling, "behavior".
Eli will have to review the rest of the docs, these just jumped out at
me immediately.

Iam> +  else if (filename_display_string == filename_display_relative_directory &&
Iam> +      dirname && dlen && dlen <= strlen (filename) &&
Iam> +      !filename_ncmp (filename, dirname, dlen))

In the GNU style, lines are broken before operators, not after.
So, the "&&"s should be moved.

Iam> +      const char *filename_display = get_filename_display_from_sal (&sal);
Iam> +
Iam> +      if (filename_display == NULL)
Iam> +	  filename_display = sal.symtab->filename;

It seems to me that you can just drop the NULL check.
When can filename_display be NULL, except with sal.symtab->filename is
already NULL?

Tom

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-10 20:15                                                           ` iam ahal
  2012-03-11  1:22                                                             ` asmwarrior
  2012-03-14 16:11                                                             ` Tom Tromey
@ 2012-03-14 16:27                                                             ` Jan Kratochvil
  2012-03-14 17:40                                                             ` Eli Zaretskii
  2012-03-15 22:46                                                             ` Jan Kratochvil
  4 siblings, 0 replies; 69+ messages in thread
From: Jan Kratochvil @ 2012-03-14 16:27 UTC (permalink / raw)
  To: iam ahal
  Cc: Eli Zaretskii, Tom Tromey, pedro, dje, gdb-patches, pmuldoon,
	brobecker, drow

Hi,

as I see ongoing reviews and I still work on the testcase posting this part.

This is not ready for check-in as is, there will be needed mor eoptions for
filename-display, which will be visible from the testcase and which was
already discussed here in the list.


Thanks,
Jan


On Sat, 10 Mar 2012 21:14:43 +0100, iam ahal wrote:
> diff -rup gdb-7.4-orig/gdb/doc/gdb.texinfo gdb-7.4/gdb/doc/gdb.texinfo
> --- gdb-7.4-orig/gdb/doc/gdb.texinfo	2012-01-06 08:43:35.000000000 +0400
> +++ gdb-7.4/gdb/doc/gdb.texinfo	2012-03-10 23:10:42.432243654 +0400
> @@ -6191,6 +6191,26 @@ unlimited.
>  Display the current limit on backtrace levels.
>  @end table
>  
> +If backtraces isn't easy to read due to a long absolute filename path recorded and 
> +you just want to see only a basename or a relative filename path, you can change this 
> +behaviour:

Lines longer than 80 characters.

> +
> +@table @code
> +@item set backtrace filename-display
> +@itemx set backtrace filename-display as-recorded
> +@cindex backtrace filename-display
> +Display a filename recorded at the compilation time.  This is the default.
> +
> +@item set backtrace filename-display basename
> +Display only basename of a filename.
> +
> +@item set backtrace filename-display relative
> +Display a filename without the compilation directory part.
> +
> +@item show backtrace filename-display
> +Show the current way to display a filename in backtraces.
> +@end table
> +
>  @node Selection
>  @section Selecting a Frame
>  
> diff -rup gdb-7.4-orig/gdb/frame.c gdb-7.4/gdb/frame.c
> --- gdb-7.4-orig/gdb/frame.c	2012-01-06 08:43:12.000000000 +0400
> +++ gdb-7.4/gdb/frame.c	2012-03-10 23:10:36.060243841 +0400
> @@ -44,6 +44,7 @@
>  #include "block.h"
>  #include "inline-frame.h"
>  #include  "tracepoint.h"
> +#include "filenames.h"
>  
>  static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
>  static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
> @@ -135,6 +136,18 @@ struct frame_info
>     sufficient for now.  */
>  static struct frame_info *frame_stash = NULL;
>  
> +/* Possible values of 'set backtrace filename-display'.  */
> +static const char filename_display_as_recorded[] = "as-recorded";
> +static const char filename_display_basename[] = "basename";
> +static const char filename_display_relative_directory[] = "relative";
> +
> +static const char *filename_display_kind_names[] = {

more const:
   static const char *const filename_display_kind_names[] = {

[obv] Code cleanup: add_setshow_enum_cmd: Make 1440 bytes of data segment read-only
http://sourceware.org/ml/gdb-patches/2012-01/msg00973.html


> +  filename_display_as_recorded,
> +  filename_display_basename,
> +  filename_display_relative_directory,
> +  NULL
> +};
> +
>  /* Add the following FRAME to the frame stash.  */
>  
>  static void
> @@ -207,6 +220,16 @@ show_backtrace_limit (struct ui_file *fi
>  		    value);
>  }
>  
> +static const char *filename_display_string = filename_display_as_recorded;
> +
> +static void
> +show_filename_display_string (struct ui_file *file, int from_tty,
> +			      struct cmd_list_element *c, const char *value)
> +{
> +  fprintf_filtered (file,
> +		    _("A filename is displayed in backtrace as \"%s\".\n"),
> +		    value);
> +}
>  
>  static void
>  fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
> @@ -2118,6 +2141,42 @@ find_frame_sal (struct frame_info *frame
>    (*sal) = find_pc_line (pc, notcurrent);
>  }
>  
> +/* See commentary in frame.h.  */
> +
> +const char *
> +get_filename_display_from_sal (const struct symtab_and_line *sal)
> +{
> +  const char *filename = sal->symtab->filename;
> +  const char *dirname = sal->symtab->dirname;
> +  size_t dlen = dirname ? strlen (dirname) : 0;
> +
> +  if (filename == NULL)
> +    {
> +      return NULL;
> +    }

Excessive { }.

> +  else if (filename_display_string == filename_display_basename)
> +    {
> +      return lbasename (filename);
> +    }

Excessive { }.

> +  else if (filename_display_string == filename_display_relative_directory &&
> +      dirname && dlen && dlen <= strlen (filename) &&
> +      !filename_ncmp (filename, dirname, dlen))

Operators should be leading, not trailing on the line.  And matching
components must match their right column from the preceding line:

  else if (filename_display_string == filename_display_relative_directory
           && dirname && dlen && dlen <= strlen (filename)
	   && !filename_ncmp (filename, dirname, dlen))

> +    {
> +      const char *start = filename + dlen;
> +      const char *result = start;
> +
> +      while (IS_DIR_SEPARATOR (*result))
> +	result++;
> +
> +      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
> +	return result;
> +      else
> +	return result == start ? filename : result;
> +    }
> +
> +  return filename;
> +}
> +
>  /* Per "frame.h", return the ``address'' of the frame.  Code should
>     really be using get_frame_id().  */
>  CORE_ADDR
> @@ -2477,6 +2536,21 @@ Zero is unlimited."),
>  			   &set_backtrace_cmdlist,
>  			   &show_backtrace_cmdlist);
>  
> +  add_setshow_enum_cmd ("filename-display", class_obscure,
> +			filename_display_kind_names,
> +			&filename_display_string, _("\
> +Set how to display filename in backtraces."), _("\
> +Show how to display filename in backtraces."), _("\
> +filename-display can be:\n\
> +  as-recorded       - display a filename recorded at the compilation time\n\
> +  basename          - display only basename of a filename\n\
> +  relative          - display a filename without the compilation directory part\n\

Lines longer than 80 characters.

> +By default, as-recorded filename is displayed."),
> +			NULL,
> +			show_filename_display_string,
> +			&set_backtrace_cmdlist,
> +			&show_backtrace_cmdlist);
> +
>    /* Debug this files internals.  */
>    add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
>  Set frame debugging."), _("\
> diff -rup gdb-7.4-orig/gdb/frame.h gdb-7.4/gdb/frame.h
> --- gdb-7.4-orig/gdb/frame.h	2012-01-06 08:43:12.000000000 +0400
> +++ gdb-7.4/gdb/frame.h	2012-03-10 23:13:36.452238567 +0400
> @@ -353,6 +353,12 @@ extern int get_frame_func_if_available (
>  extern void find_frame_sal (struct frame_info *frame,
>  			    struct symtab_and_line *sal);
>  
> +/* Returns either 'as recorded' filename or basename or filename
> +   without the compile directory part.
> +   It depends on 'set backtrace filename-display' value.  */
> +
> +extern const char *get_filename_display_from_sal (const struct symtab_and_line *sal);

Lines longer than 80 characters.

> +
>  /* Set the current source and line to the location given by frame
>     FRAME, if possible.  When CENTER is true, adjust so the relevant
>     line is in the center of the next 'list'.  */
> diff -rup gdb-7.4-orig/gdb/stack.c gdb-7.4/gdb/stack.c
> --- gdb-7.4-orig/gdb/stack.c	2012-01-06 08:43:31.000000000 +0400
> +++ gdb-7.4/gdb/stack.c	2012-03-10 22:17:18.628337327 +0400
> @@ -1173,11 +1173,16 @@ print_frame (struct frame_info *frame, i
>    ui_out_text (uiout, ")");
>    if (sal.symtab && sal.symtab->filename)
>      {
> +      const char *filename_display = get_filename_display_from_sal (&sal);
> +
> +      if (filename_display == NULL)
> +	  filename_display = sal.symtab->filename;
> +
>        annotate_frame_source_begin ();
>        ui_out_wrap_hint (uiout, "   ");
>        ui_out_text (uiout, " at ");
>        annotate_frame_source_file ();
> -      ui_out_field_string (uiout, "file", sal.symtab->filename);
> +      ui_out_field_string (uiout, "file", filename_display);
>        if (ui_out_is_mi_like_p (uiout))
>  	{
>  	  const char *fullname = symtab_to_fullname (sal.symtab);


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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-10 20:15                                                           ` iam ahal
                                                                               ` (2 preceding siblings ...)
  2012-03-14 16:27                                                             ` Jan Kratochvil
@ 2012-03-14 17:40                                                             ` Eli Zaretskii
  2012-03-15 22:46                                                             ` Jan Kratochvil
  4 siblings, 0 replies; 69+ messages in thread
From: Eli Zaretskii @ 2012-03-14 17:40 UTC (permalink / raw)
  To: iam ahal
  Cc: tromey, pedro, dje, gdb-patches, pmuldoon, brobecker, drow,
	jan.kratochvil

> Date: Sat, 10 Mar 2012 23:14:43 +0300
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: Tom Tromey <tromey@redhat.com>, pedro@codesourcery.com, dje@google.com, 	gdb-patches@sourceware.org, pmuldoon@redhat.com, brobecker@adacore.com, 	drow@false.org, jan.kratochvil@redhat.com
> 
> I've tried carefully to fix documentation and a little piece of code.
> Also, I've added NEWS entry.

Thanks!

> +If backtraces isn't easy to read due to a long absolute filename path recorded and 

Just "filename record", please.  GNU Coding Standards frown on using
"path" for anything but PATH-style lists of directories.

> +you just want to see only a basename or a relative filename path, you can change this 
                                                               ^^^^
Same here: just "relative filename".

> +Display a filename recorded at the compilation time.  This is the default.
                                  ^^^
Please remove "the", it's not needed here.

Also, I would say "exactly as recorded at compile time".  I think this
is more clear.

> +@item set backtrace filename-display relative
> +Display a filename without the compilation directory part.

This is unclear.  What does it mean, exactly? that the filename is
displayed relative to the compilation directory?  Can you give me an
example?  I will then suggest an alternative wording to make your
intent more clear.

> +  add_setshow_enum_cmd ("filename-display", class_obscure,
> +			filename_display_kind_names,
> +			&filename_display_string, _("\
> +Set how to display filename in backtraces."), _("\
> +Show how to display filename in backtraces."), _("\

I think "filenames", in plural, is better here.

> * New options
> 
> set backtrace filename-display as-recorded|basename|relative
> show backtrace filename-display
>   Control a way in which a filename is displayed in backtraces.
            ^^^^^          ^^^^^^^^^^
"the way" and "filenames" (plural and without "a").

OK with those changes.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-10 20:15                                                           ` iam ahal
                                                                               ` (3 preceding siblings ...)
  2012-03-14 17:40                                                             ` Eli Zaretskii
@ 2012-03-15 22:46                                                             ` Jan Kratochvil
  2012-03-18 18:30                                                               ` iam ahal
  4 siblings, 1 reply; 69+ messages in thread
From: Jan Kratochvil @ 2012-03-15 22:46 UTC (permalink / raw)
  To: iam ahal
  Cc: Eli Zaretskii, Tom Tromey, pedro, dje, gdb-patches, pmuldoon,
	brobecker, drow

On Sat, 10 Mar 2012 21:14:43 +0100, iam ahal wrote:
> To Jan Kratochvil
> 
> It would be great if you write.

Here is a testcase (+"absolute" mode) but it still FAILs on:

FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_missing__file_absolute: relative
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_relative_file_absolute: relative *maybe undefined testcase*
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_basename: relative
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_basename: as-recorded
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_relative: relative
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_relative: as-recorded
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_same: absolute
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_same: relative
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_same: as-recorded
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_different: absolute
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_different: relative
FAIL: gdb.dwarf2/dw2-dir-file-name.exp: wdir_missing__ldir_absolute_file_absolute_different: as-recorded

So there is either some misunderstanding what it should print or there is
really a bug.  I will check it more tomorrow.

The testcase was much smaller originally, there should be probably a generator
for it; just with available languages for running GDB it should be probably
maintainer-pregenerated.  OTOH I do not plan to write a generator myself now.


Thanks,
Jan


--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -45,6 +45,7 @@
 #include "inline-frame.h"
 #include  "tracepoint.h"
 #include "filenames.h"
+#include "source.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -140,11 +141,13 @@ static struct frame_info *frame_stash = NULL;
 static const char filename_display_as_recorded[] = "as-recorded";
 static const char filename_display_basename[] = "basename";
 static const char filename_display_relative_directory[] = "relative";
+static const char filename_display_absolute[] = "absolute";
 
 static const char *filename_display_kind_names[] = {
   filename_display_as_recorded,
   filename_display_basename,
   filename_display_relative_directory,
+  filename_display_absolute,
   NULL
 };
 
@@ -2195,6 +2198,13 @@ get_filename_display_from_sal (const struct symtab_and_line *sal)
       else
 	return result == start ? filename : result;
     }
+  else if (filename_display_string == filename_display_absolute)
+    {
+      const char *retval = symtab_to_fullname (sal->symtab);
+
+      if (retval != NULL)
+	return retval;
+    }
 
   return filename;
 }
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.S
@@ -0,0 +1,2577 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#define ABBREV_NAME 1
+#define ABBREV_COMP_DIR_NAME 2
+
+	.section .debug_info
+
+.Lwdir_missing__ldir_missing__file_basename_begin:
+	.4byte	.Lwdir_missing__ldir_missing__file_basename_end - .Lwdir_missing__ldir_missing__file_basename_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_missing__file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_missing__file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_missing__file_basename_end		/* DW_AT_high_pc */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_missing__file_basename"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_missing__file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_missing__file_basename_end:
+
+.Lwdir_missing__ldir_missing__file_relative_begin:
+	.4byte	.Lwdir_missing__ldir_missing__file_relative_end - .Lwdir_missing__ldir_missing__file_relative_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_missing__file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_missing__file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_missing__file_relative_end		/* DW_AT_high_pc */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_missing__file_relative"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_missing__file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_missing__file_relative_end:
+
+.Lwdir_missing__ldir_missing__file_absolute_begin:
+	.4byte	.Lwdir_missing__ldir_missing__file_absolute_end - .Lwdir_missing__ldir_missing__file_absolute_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_missing__file_absolute_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_missing__file_absolute_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_missing__file_absolute_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_missing__file_absolute_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_missing__file_absolute"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_missing__file_absolute_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_missing__file_absolute_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_missing__file_absolute_end:
+
+.Lwdir_missing__ldir_relative_file_basename_begin:
+	.4byte	.Lwdir_missing__ldir_relative_file_basename_end - .Lwdir_missing__ldir_relative_file_basename_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_relative_file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_relative_file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_relative_file_basename_end		/* DW_AT_high_pc */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_relative_file_basename"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_relative_file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_relative_file_basename_end:
+
+.Lwdir_missing__ldir_relative_file_relative_begin:
+	.4byte	.Lwdir_missing__ldir_relative_file_relative_end - .Lwdir_missing__ldir_relative_file_relative_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_relative_file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_relative_file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_relative_file_relative_end		/* DW_AT_high_pc */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_relative_file_relative"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_relative_file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_relative_file_relative_end:
+
+.Lwdir_missing__ldir_relative_file_absolute_begin:
+	.4byte	.Lwdir_missing__ldir_relative_file_absolute_end - .Lwdir_missing__ldir_relative_file_absolute_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_relative_file_absolute_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_relative_file_absolute_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_relative_file_absolute_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_relative_file_absolute_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_relative_file_absolute"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_relative_file_absolute_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_relative_file_absolute_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_relative_file_absolute_end:
+
+.Lwdir_missing__ldir_absolute_file_basename_begin:
+	.4byte	.Lwdir_missing__ldir_absolute_file_basename_end - .Lwdir_missing__ldir_absolute_file_basename_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_absolute_file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_absolute_file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_absolute_file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_absolute_file_basename_end		/* DW_AT_high_pc */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_absolute_file_basename"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_absolute_file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_absolute_file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_absolute_file_basename_end:
+
+.Lwdir_missing__ldir_absolute_file_relative_begin:
+	.4byte	.Lwdir_missing__ldir_absolute_file_relative_end - .Lwdir_missing__ldir_absolute_file_relative_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_absolute_file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_absolute_file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_absolute_file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_absolute_file_relative_end		/* DW_AT_high_pc */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_absolute_file_relative"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_absolute_file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_absolute_file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_absolute_file_relative_end:
+
+.Lwdir_missing__ldir_absolute_file_absolute_same_begin:
+	.4byte	.Lwdir_missing__ldir_absolute_file_absolute_same_end - .Lwdir_missing__ldir_absolute_file_absolute_same_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_absolute_file_absolute_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_absolute_file_absolute_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_absolute_file_absolute_same"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_absolute_file_absolute_same_end:
+
+.Lwdir_missing__ldir_absolute_file_absolute_different_begin:
+	.4byte	.Lwdir_missing__ldir_absolute_file_absolute_different_end - .Lwdir_missing__ldir_absolute_file_absolute_different_start	/* Length of Compilation Unit */
+.Lwdir_missing__ldir_absolute_file_absolute_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_NAME			/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_missing__ldir_absolute_file_absolute_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_missing__ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_missing__ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_missing__ldir_absolute_file_absolute_different"	/* DW_AT_name */
+	.4byte		wdir_missing__ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_missing__ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_missing__ldir_absolute_file_absolute_different_end:
+
+.Lwdir_relative_ldir_missing__file_basename_begin:
+	.4byte	.Lwdir_relative_ldir_missing__file_basename_end - .Lwdir_relative_ldir_missing__file_basename_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_missing__file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_missing__file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_missing__file_basename_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_missing__file_basename"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_missing__file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_missing__file_basename_end:
+
+.Lwdir_relative_ldir_missing__file_relative_begin:
+	.4byte	.Lwdir_relative_ldir_missing__file_relative_end - .Lwdir_relative_ldir_missing__file_relative_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_missing__file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_missing__file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_missing__file_relative_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_missing__file_relative"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_missing__file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_missing__file_relative_end:
+
+.Lwdir_relative_ldir_missing__file_absolute_begin:
+	.4byte	.Lwdir_relative_ldir_missing__file_absolute_end - .Lwdir_relative_ldir_missing__file_absolute_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_missing__file_absolute_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_missing__file_absolute_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_missing__file_absolute_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_missing__file_absolute_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_missing__file_absolute"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_missing__file_absolute_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_missing__file_absolute_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_missing__file_absolute_end:
+
+.Lwdir_relative_ldir_relative_file_basename_begin:
+	.4byte	.Lwdir_relative_ldir_relative_file_basename_end - .Lwdir_relative_ldir_relative_file_basename_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_relative_file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_relative_file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_relative_file_basename_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_relative_file_basename"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_relative_file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_relative_file_basename_end:
+
+.Lwdir_relative_ldir_relative_file_relative_begin:
+	.4byte	.Lwdir_relative_ldir_relative_file_relative_end - .Lwdir_relative_ldir_relative_file_relative_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_relative_file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_relative_file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_relative_file_relative_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_relative_file_relative"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_relative_file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_relative_file_relative_end:
+
+.Lwdir_relative_ldir_relative_file_absolute_begin:
+	.4byte	.Lwdir_relative_ldir_relative_file_absolute_end - .Lwdir_relative_ldir_relative_file_absolute_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_relative_file_absolute_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_relative_file_absolute_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_relative_file_absolute_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_relative_file_absolute_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_relative_file_absolute"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_relative_file_absolute_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_relative_file_absolute_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_relative_file_absolute_end:
+
+.Lwdir_relative_ldir_absolute_file_basename_begin:
+	.4byte	.Lwdir_relative_ldir_absolute_file_basename_end - .Lwdir_relative_ldir_absolute_file_basename_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_absolute_file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_absolute_file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_absolute_file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_absolute_file_basename_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_absolute_file_basename"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_absolute_file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_absolute_file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_absolute_file_basename_end:
+
+.Lwdir_relative_ldir_absolute_file_relative_begin:
+	.4byte	.Lwdir_relative_ldir_absolute_file_relative_end - .Lwdir_relative_ldir_absolute_file_relative_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_absolute_file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_absolute_file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_absolute_file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_absolute_file_relative_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_absolute_file_relative"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_absolute_file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_absolute_file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_absolute_file_relative_end:
+
+.Lwdir_relative_ldir_absolute_file_absolute_same_begin:
+	.4byte	.Lwdir_relative_ldir_absolute_file_absolute_same_end - .Lwdir_relative_ldir_absolute_file_absolute_same_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_absolute_file_absolute_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_absolute_file_absolute_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_absolute_file_absolute_same"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_absolute_file_absolute_same_end:
+
+.Lwdir_relative_ldir_absolute_file_absolute_different_begin:
+	.4byte	.Lwdir_relative_ldir_absolute_file_absolute_different_end - .Lwdir_relative_ldir_absolute_file_absolute_different_start	/* Length of Compilation Unit */
+.Lwdir_relative_ldir_absolute_file_absolute_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_relative_ldir_absolute_file_absolute_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_relative_ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_relative_ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+	.ascii	WDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_relative_ldir_absolute_file_absolute_different"	/* DW_AT_name */
+	.4byte		wdir_relative_ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_relative_ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_relative_ldir_absolute_file_absolute_different_end:
+
+.Lwdir_absolute_ldir_missing__file_basename_begin:
+	.4byte	.Lwdir_absolute_ldir_missing__file_basename_end - .Lwdir_absolute_ldir_missing__file_basename_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_missing__file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_missing__file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_missing__file_basename_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_missing__file_basename"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_missing__file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_missing__file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_missing__file_basename_end:
+
+.Lwdir_absolute_ldir_missing__file_relative_begin:
+	.4byte	.Lwdir_absolute_ldir_missing__file_relative_end - .Lwdir_absolute_ldir_missing__file_relative_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_missing__file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_missing__file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_missing__file_relative_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_missing__file_relative"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_missing__file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_missing__file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_missing__file_relative_end:
+
+.Lwdir_absolute_ldir_missing__file_absolute_same_begin:
+	.4byte	.Lwdir_absolute_ldir_missing__file_absolute_same_end - .Lwdir_absolute_ldir_missing__file_absolute_same_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_missing__file_absolute_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_missing__file_absolute_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_missing__file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_missing__file_absolute_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_missing__file_absolute_same"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_missing__file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_missing__file_absolute_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_missing__file_absolute_same_end:
+
+.Lwdir_absolute_ldir_missing__file_absolute_different_begin:
+	.4byte	.Lwdir_absolute_ldir_missing__file_absolute_different_end - .Lwdir_absolute_ldir_missing__file_absolute_different_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_missing__file_absolute_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_missing__file_absolute_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_missing__file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_missing__file_absolute_different_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_missing__file_absolute_different"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_missing__file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_missing__file_absolute_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_missing__file_absolute_different_end:
+
+.Lwdir_absolute_ldir_relative_file_basename_begin:
+	.4byte	.Lwdir_absolute_ldir_relative_file_basename_end - .Lwdir_absolute_ldir_relative_file_basename_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_relative_file_basename_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_relative_file_basename_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_relative_file_basename_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_relative_file_basename"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_relative_file_basename_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_relative_file_basename_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_relative_file_basename_end:
+
+.Lwdir_absolute_ldir_relative_file_relative_begin:
+	.4byte	.Lwdir_absolute_ldir_relative_file_relative_end - .Lwdir_absolute_ldir_relative_file_relative_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_relative_file_relative_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_relative_file_relative_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_relative_file_relative_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_relative_file_relative"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_relative_file_relative_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_relative_file_relative_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_relative_file_relative_end:
+
+.Lwdir_absolute_ldir_relative_file_absolute_same_begin:
+	.4byte	.Lwdir_absolute_ldir_relative_file_absolute_same_end - .Lwdir_absolute_ldir_relative_file_absolute_same_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_relative_file_absolute_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_relative_file_absolute_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_relative_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_relative_file_absolute_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_relative_file_absolute_same"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_relative_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_relative_file_absolute_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_relative_file_absolute_same_end:
+
+.Lwdir_absolute_ldir_relative_file_absolute_different_begin:
+	.4byte	.Lwdir_absolute_ldir_relative_file_absolute_different_end - .Lwdir_absolute_ldir_relative_file_absolute_different_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_relative_file_absolute_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_relative_file_absolute_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_relative_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_relative_file_absolute_different_end		/* DW_AT_high_pc */
+	.ascii	XDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_relative_file_absolute_different"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_relative_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_relative_file_absolute_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_relative_file_absolute_different_end:
+
+.Lwdir_absolute_ldir_absolute_file_basename_same_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_basename_same_end - .Lwdir_absolute_ldir_absolute_file_basename_same_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_basename_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_basename_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_basename_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_basename_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_basename_same"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_basename_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_basename_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_basename_same_end:
+
+.Lwdir_absolute_ldir_absolute_file_basename_different_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_basename_different_end - .Lwdir_absolute_ldir_absolute_file_basename_different_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_basename_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_basename_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_basename_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_basename_different_end		/* DW_AT_high_pc */
+	.ascii	XDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FILE "\0"			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_basename_different"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_basename_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_basename_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_basename_different_end:
+
+.Lwdir_absolute_ldir_absolute_file_relative_same_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_relative_same_end - .Lwdir_absolute_ldir_absolute_file_relative_same_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_relative_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_relative_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_relative_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_relative_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_relative_same"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_relative_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_relative_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_relative_same_end:
+
+.Lwdir_absolute_ldir_absolute_file_relative_different_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_relative_different_end - .Lwdir_absolute_ldir_absolute_file_relative_different_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_relative_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_relative_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_relative_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_relative_different_end		/* DW_AT_high_pc */
+	.ascii	XDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	FDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_relative_different"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_relative_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_relative_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_relative_different_end:
+
+.Lwdir_absolute_ldir_absolute_file_absolute_same_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_absolute_same_end - .Lwdir_absolute_ldir_absolute_file_absolute_same_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_absolute_same_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_absolute_same_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+	.ascii	BDIR "/" WDIR "\0"		/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_absolute_same"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_same_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_same_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_absolute_same_end:
+
+.Lwdir_absolute_ldir_absolute_file_absolute_different_begin:
+	.4byte	.Lwdir_absolute_ldir_absolute_file_absolute_different_end - .Lwdir_absolute_ldir_absolute_file_absolute_different_start	/* Length of Compilation Unit */
+.Lwdir_absolute_ldir_absolute_file_absolute_different_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+
+	.uleb128 ABBREV_COMP_DIR_NAME		/* Abbrev: DW_TAG_compile_unit */
+	.ascii	"GNU C\0"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_wdir_absolute_ldir_absolute_file_absolute_different_begin	/* DW_AT_stmt_list */
+	.4byte	wdir_absolute_ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte	wdir_absolute_ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+	.ascii	XDIR "\0"			/* DW_AT_comp_dir */
+	.ascii	BDIR "/" FILE "\0"		/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		"wdir_absolute_ldir_absolute_file_absolute_different"	/* DW_AT_name */
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_different_start	/* DW_AT_low_pc */
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_different_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.Lwdir_absolute_ldir_absolute_file_absolute_different_end:
+
+/* Abbrev table */
+	.section .debug_abbrev
+.Labbrev1_begin:
+
+	.uleb128	ABBREV_NAME		/* Abbrev code */
+	.uleb128	0x11			/* DW_TAG_compile_unit */
+	.byte		1			/* has_children */
+	.uleb128	0x25			/* DW_AT_producer */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x13			/* DW_AT_language */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x10			/* DW_AT_stmt_list */
+	.uleb128	0x6			/* DW_FORM_data4 */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	ABBREV_COMP_DIR_NAME	/* Abbrev code */
+	.uleb128	0x11			/* DW_TAG_compile_unit */
+	.byte		1			/* has_children */
+	.uleb128	0x25			/* DW_AT_producer */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x13			/* DW_AT_language */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x10			/* DW_AT_stmt_list */
+	.uleb128	0x6			/* DW_FORM_data4 */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x1b			/* DW_AT_comp_dir */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	3			/* Abbrev code */
+	.uleb128	0x2e			/* DW_TAG_subprogram */
+	.byte		0			/* has_children */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+/* Line table */
+	.section .debug_line
+
+
+.Lline_wdir_missing__ldir_missing__file_basename_begin:
+	.4byte		.Lline_wdir_missing__ldir_missing__file_basename_end - .Lline_wdir_missing__ldir_missing__file_basename_start	/* Initial length */
+.Lline_wdir_missing__ldir_missing__file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_missing__file_basename_lines - .Lline_wdir_missing__ldir_missing__file_basename_hdr	/* header_length */
+.Lline_wdir_missing__ldir_missing__file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_missing__file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_missing__file_basename_end:
+
+
+.Lline_wdir_missing__ldir_missing__file_relative_begin:
+	.4byte		.Lline_wdir_missing__ldir_missing__file_relative_end - .Lline_wdir_missing__ldir_missing__file_relative_start	/* Initial length */
+.Lline_wdir_missing__ldir_missing__file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_missing__file_relative_lines - .Lline_wdir_missing__ldir_missing__file_relative_hdr	/* header_length */
+.Lline_wdir_missing__ldir_missing__file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_missing__file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_missing__file_relative_end:
+
+
+.Lline_wdir_missing__ldir_missing__file_absolute_begin:
+	.4byte		.Lline_wdir_missing__ldir_missing__file_absolute_end - .Lline_wdir_missing__ldir_missing__file_absolute_start	/* Initial length */
+.Lline_wdir_missing__ldir_missing__file_absolute_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_missing__file_absolute_lines - .Lline_wdir_missing__ldir_missing__file_absolute_hdr	/* header_length */
+.Lline_wdir_missing__ldir_missing__file_absolute_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_missing__file_absolute_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_absolute_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_missing__file_absolute_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_missing__file_absolute_end:
+
+
+.Lline_wdir_missing__ldir_relative_file_basename_begin:
+	.4byte		.Lline_wdir_missing__ldir_relative_file_basename_end - .Lline_wdir_missing__ldir_relative_file_basename_start	/* Initial length */
+.Lline_wdir_missing__ldir_relative_file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_relative_file_basename_lines - .Lline_wdir_missing__ldir_relative_file_basename_hdr	/* header_length */
+.Lline_wdir_missing__ldir_relative_file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_relative_file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_relative_file_basename_end:
+
+
+.Lline_wdir_missing__ldir_relative_file_relative_begin:
+	.4byte		.Lline_wdir_missing__ldir_relative_file_relative_end - .Lline_wdir_missing__ldir_relative_file_relative_start	/* Initial length */
+.Lline_wdir_missing__ldir_relative_file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_relative_file_relative_lines - .Lline_wdir_missing__ldir_relative_file_relative_hdr	/* header_length */
+.Lline_wdir_missing__ldir_relative_file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_relative_file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_relative_file_relative_end:
+
+
+.Lline_wdir_missing__ldir_relative_file_absolute_begin:
+	.4byte		.Lline_wdir_missing__ldir_relative_file_absolute_end - .Lline_wdir_missing__ldir_relative_file_absolute_start	/* Initial length */
+.Lline_wdir_missing__ldir_relative_file_absolute_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_relative_file_absolute_lines - .Lline_wdir_missing__ldir_relative_file_absolute_hdr	/* header_length */
+.Lline_wdir_missing__ldir_relative_file_absolute_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_relative_file_absolute_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_absolute_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_relative_file_absolute_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_relative_file_absolute_end:
+
+
+.Lline_wdir_missing__ldir_absolute_file_basename_begin:
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_basename_end - .Lline_wdir_missing__ldir_absolute_file_basename_start	/* Initial length */
+.Lline_wdir_missing__ldir_absolute_file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_basename_lines - .Lline_wdir_missing__ldir_absolute_file_basename_hdr	/* header_length */
+.Lline_wdir_missing__ldir_absolute_file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_absolute_file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_absolute_file_basename_end:
+
+
+.Lline_wdir_missing__ldir_absolute_file_relative_begin:
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_relative_end - .Lline_wdir_missing__ldir_absolute_file_relative_start	/* Initial length */
+.Lline_wdir_missing__ldir_absolute_file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_relative_lines - .Lline_wdir_missing__ldir_absolute_file_relative_hdr	/* header_length */
+.Lline_wdir_missing__ldir_absolute_file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_absolute_file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_absolute_file_relative_end:
+
+
+.Lline_wdir_missing__ldir_absolute_file_absolute_same_begin:
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_absolute_same_end - .Lline_wdir_missing__ldir_absolute_file_absolute_same_start	/* Initial length */
+.Lline_wdir_missing__ldir_absolute_file_absolute_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_absolute_same_lines - .Lline_wdir_missing__ldir_absolute_file_absolute_same_hdr	/* header_length */
+.Lline_wdir_missing__ldir_absolute_file_absolute_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_absolute_file_absolute_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_absolute_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_absolute_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_absolute_file_absolute_same_end:
+
+
+.Lline_wdir_missing__ldir_absolute_file_absolute_different_begin:
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_absolute_different_end - .Lline_wdir_missing__ldir_absolute_file_absolute_different_start	/* Initial length */
+.Lline_wdir_missing__ldir_absolute_file_absolute_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_missing__ldir_absolute_file_absolute_different_lines - .Lline_wdir_missing__ldir_absolute_file_absolute_different_hdr	/* header_length */
+.Lline_wdir_missing__ldir_absolute_file_absolute_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	XDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_missing__ldir_absolute_file_absolute_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_absolute_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_missing__ldir_absolute_file_absolute_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_missing__ldir_absolute_file_absolute_different_end:
+
+
+.Lline_wdir_relative_ldir_missing__file_basename_begin:
+	.4byte		.Lline_wdir_relative_ldir_missing__file_basename_end - .Lline_wdir_relative_ldir_missing__file_basename_start	/* Initial length */
+.Lline_wdir_relative_ldir_missing__file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_missing__file_basename_lines - .Lline_wdir_relative_ldir_missing__file_basename_hdr	/* header_length */
+.Lline_wdir_relative_ldir_missing__file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_missing__file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_missing__file_basename_end:
+
+
+.Lline_wdir_relative_ldir_missing__file_relative_begin:
+	.4byte		.Lline_wdir_relative_ldir_missing__file_relative_end - .Lline_wdir_relative_ldir_missing__file_relative_start	/* Initial length */
+.Lline_wdir_relative_ldir_missing__file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_missing__file_relative_lines - .Lline_wdir_relative_ldir_missing__file_relative_hdr	/* header_length */
+.Lline_wdir_relative_ldir_missing__file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_missing__file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_missing__file_relative_end:
+
+
+.Lline_wdir_relative_ldir_missing__file_absolute_begin:
+	.4byte		.Lline_wdir_relative_ldir_missing__file_absolute_end - .Lline_wdir_relative_ldir_missing__file_absolute_start	/* Initial length */
+.Lline_wdir_relative_ldir_missing__file_absolute_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_missing__file_absolute_lines - .Lline_wdir_relative_ldir_missing__file_absolute_hdr	/* header_length */
+.Lline_wdir_relative_ldir_missing__file_absolute_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_missing__file_absolute_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_absolute_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_missing__file_absolute_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_missing__file_absolute_end:
+
+
+.Lline_wdir_relative_ldir_relative_file_basename_begin:
+	.4byte		.Lline_wdir_relative_ldir_relative_file_basename_end - .Lline_wdir_relative_ldir_relative_file_basename_start	/* Initial length */
+.Lline_wdir_relative_ldir_relative_file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_relative_file_basename_lines - .Lline_wdir_relative_ldir_relative_file_basename_hdr	/* header_length */
+.Lline_wdir_relative_ldir_relative_file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_relative_file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_relative_file_basename_end:
+
+
+.Lline_wdir_relative_ldir_relative_file_relative_begin:
+	.4byte		.Lline_wdir_relative_ldir_relative_file_relative_end - .Lline_wdir_relative_ldir_relative_file_relative_start	/* Initial length */
+.Lline_wdir_relative_ldir_relative_file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_relative_file_relative_lines - .Lline_wdir_relative_ldir_relative_file_relative_hdr	/* header_length */
+.Lline_wdir_relative_ldir_relative_file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_relative_file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_relative_file_relative_end:
+
+
+.Lline_wdir_relative_ldir_relative_file_absolute_begin:
+	.4byte		.Lline_wdir_relative_ldir_relative_file_absolute_end - .Lline_wdir_relative_ldir_relative_file_absolute_start	/* Initial length */
+.Lline_wdir_relative_ldir_relative_file_absolute_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_relative_file_absolute_lines - .Lline_wdir_relative_ldir_relative_file_absolute_hdr	/* header_length */
+.Lline_wdir_relative_ldir_relative_file_absolute_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_relative_file_absolute_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_absolute_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_relative_file_absolute_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_relative_file_absolute_end:
+
+
+.Lline_wdir_relative_ldir_absolute_file_basename_begin:
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_basename_end - .Lline_wdir_relative_ldir_absolute_file_basename_start	/* Initial length */
+.Lline_wdir_relative_ldir_absolute_file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_basename_lines - .Lline_wdir_relative_ldir_absolute_file_basename_hdr	/* header_length */
+.Lline_wdir_relative_ldir_absolute_file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_absolute_file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_absolute_file_basename_end:
+
+
+.Lline_wdir_relative_ldir_absolute_file_relative_begin:
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_relative_end - .Lline_wdir_relative_ldir_absolute_file_relative_start	/* Initial length */
+.Lline_wdir_relative_ldir_absolute_file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_relative_lines - .Lline_wdir_relative_ldir_absolute_file_relative_hdr	/* header_length */
+.Lline_wdir_relative_ldir_absolute_file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_absolute_file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_absolute_file_relative_end:
+
+
+.Lline_wdir_relative_ldir_absolute_file_absolute_same_begin:
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_absolute_same_end - .Lline_wdir_relative_ldir_absolute_file_absolute_same_start	/* Initial length */
+.Lline_wdir_relative_ldir_absolute_file_absolute_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_absolute_same_lines - .Lline_wdir_relative_ldir_absolute_file_absolute_same_hdr	/* header_length */
+.Lline_wdir_relative_ldir_absolute_file_absolute_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_absolute_file_absolute_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_absolute_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_absolute_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_absolute_file_absolute_same_end:
+
+
+.Lline_wdir_relative_ldir_absolute_file_absolute_different_begin:
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_absolute_different_end - .Lline_wdir_relative_ldir_absolute_file_absolute_different_start	/* Initial length */
+.Lline_wdir_relative_ldir_absolute_file_absolute_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_relative_ldir_absolute_file_absolute_different_lines - .Lline_wdir_relative_ldir_absolute_file_absolute_different_hdr	/* header_length */
+.Lline_wdir_relative_ldir_absolute_file_absolute_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	XDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_relative_ldir_absolute_file_absolute_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_absolute_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_relative_ldir_absolute_file_absolute_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_relative_ldir_absolute_file_absolute_different_end:
+
+
+.Lline_wdir_absolute_ldir_missing__file_basename_begin:
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_basename_end - .Lline_wdir_absolute_ldir_missing__file_basename_start	/* Initial length */
+.Lline_wdir_absolute_ldir_missing__file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_basename_lines - .Lline_wdir_absolute_ldir_missing__file_basename_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_missing__file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_missing__file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_missing__file_basename_end:
+
+
+.Lline_wdir_absolute_ldir_missing__file_relative_begin:
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_relative_end - .Lline_wdir_absolute_ldir_missing__file_relative_start	/* Initial length */
+.Lline_wdir_absolute_ldir_missing__file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_relative_lines - .Lline_wdir_absolute_ldir_missing__file_relative_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_missing__file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_missing__file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_missing__file_relative_end:
+
+
+.Lline_wdir_absolute_ldir_missing__file_absolute_same_begin:
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_absolute_same_end - .Lline_wdir_absolute_ldir_missing__file_absolute_same_start	/* Initial length */
+.Lline_wdir_absolute_ldir_missing__file_absolute_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_absolute_same_lines - .Lline_wdir_absolute_ldir_missing__file_absolute_same_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_missing__file_absolute_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_missing__file_absolute_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_absolute_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_absolute_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_missing__file_absolute_same_end:
+
+
+.Lline_wdir_absolute_ldir_missing__file_absolute_different_begin:
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_absolute_different_end - .Lline_wdir_absolute_ldir_missing__file_absolute_different_start	/* Initial length */
+.Lline_wdir_absolute_ldir_missing__file_absolute_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_missing__file_absolute_different_lines - .Lline_wdir_absolute_ldir_missing__file_absolute_different_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_missing__file_absolute_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	0
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_missing__file_absolute_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_absolute_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_missing__file_absolute_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_missing__file_absolute_different_end:
+
+
+.Lline_wdir_absolute_ldir_relative_file_basename_begin:
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_basename_end - .Lline_wdir_absolute_ldir_relative_file_basename_start	/* Initial length */
+.Lline_wdir_absolute_ldir_relative_file_basename_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_basename_lines - .Lline_wdir_absolute_ldir_relative_file_basename_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_relative_file_basename_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_relative_file_basename_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_basename_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_basename_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_relative_file_basename_end:
+
+
+.Lline_wdir_absolute_ldir_relative_file_relative_begin:
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_relative_end - .Lline_wdir_absolute_ldir_relative_file_relative_start	/* Initial length */
+.Lline_wdir_absolute_ldir_relative_file_relative_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_relative_lines - .Lline_wdir_absolute_ldir_relative_file_relative_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_relative_file_relative_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_relative_file_relative_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_relative_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_relative_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_relative_file_relative_end:
+
+
+.Lline_wdir_absolute_ldir_relative_file_absolute_same_begin:
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_absolute_same_end - .Lline_wdir_absolute_ldir_relative_file_absolute_same_start	/* Initial length */
+.Lline_wdir_absolute_ldir_relative_file_absolute_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_absolute_same_lines - .Lline_wdir_absolute_ldir_relative_file_absolute_same_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_relative_file_absolute_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_relative_file_absolute_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_absolute_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_absolute_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_relative_file_absolute_same_end:
+
+
+.Lline_wdir_absolute_ldir_relative_file_absolute_different_begin:
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_absolute_different_end - .Lline_wdir_absolute_ldir_relative_file_absolute_different_start	/* Initial length */
+.Lline_wdir_absolute_ldir_relative_file_absolute_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_relative_file_absolute_different_lines - .Lline_wdir_absolute_ldir_relative_file_absolute_different_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_relative_file_absolute_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_relative_file_absolute_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_absolute_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_relative_file_absolute_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_relative_file_absolute_different_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_basename_same_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_basename_same_end - .Lline_wdir_absolute_ldir_absolute_file_basename_same_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_basename_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_basename_same_lines - .Lline_wdir_absolute_ldir_absolute_file_basename_same_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_basename_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_basename_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_basename_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_basename_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_basename_same_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_basename_different_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_basename_different_end - .Lline_wdir_absolute_ldir_absolute_file_basename_different_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_basename_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_basename_different_lines - .Lline_wdir_absolute_ldir_absolute_file_basename_different_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_basename_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_basename_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_basename_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_basename_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_basename_different_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_relative_same_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_relative_same_end - .Lline_wdir_absolute_ldir_absolute_file_relative_same_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_relative_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_relative_same_lines - .Lline_wdir_absolute_ldir_absolute_file_relative_same_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_relative_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_relative_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_relative_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_relative_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_relative_same_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_relative_different_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_relative_different_end - .Lline_wdir_absolute_ldir_absolute_file_relative_different_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_relative_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_relative_different_lines - .Lline_wdir_absolute_ldir_absolute_file_relative_different_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_relative_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	FDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_relative_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_relative_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_relative_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_relative_different_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_absolute_same_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_absolute_same_end - .Lline_wdir_absolute_ldir_absolute_file_absolute_same_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_absolute_same_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_absolute_same_lines - .Lline_wdir_absolute_ldir_absolute_file_absolute_same_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_absolute_same_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	BDIR "/" LDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_absolute_same_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_same_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_same_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_absolute_same_end:
+
+
+.Lline_wdir_absolute_ldir_absolute_file_absolute_different_begin:
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_absolute_different_end - .Lline_wdir_absolute_ldir_absolute_file_absolute_different_start	/* Initial length */
+.Lline_wdir_absolute_ldir_absolute_file_absolute_different_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_wdir_absolute_ldir_absolute_file_absolute_different_lines - .Lline_wdir_absolute_ldir_absolute_file_absolute_different_hdr	/* header_length */
+.Lline_wdir_absolute_ldir_absolute_file_absolute_different_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+	.ascii	XDIR "\0"
+	.byte		0
+
+	/* File names */
+	.ascii	BDIR "/" FILE "\0"
+	.uleb128	1
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_wdir_absolute_ldir_absolute_file_absolute_different_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_different_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		wdir_absolute_ldir_absolute_file_absolute_different_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_wdir_absolute_ldir_absolute_file_absolute_different_end:
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
@@ -0,0 +1,87 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+volatile int v;
+
+static void
+marker (void)
+{
+  v++;
+}
+
+/* *R* marks possibly invalid compiler output as the first path component is
+   not absolute.  Still DWARF-4 does not forbid such DWARF; GCC does not
+   produce it.  */
+
+#define FUNCBLOCK						\
+FUNC (wdir_missing__ldir_missing__file_basename)	   /*R*/\
+FUNC (wdir_missing__ldir_missing__file_relative)	   /*R*/\
+FUNC (wdir_missing__ldir_missing__file_absolute)		\
+FUNC (wdir_missing__ldir_relative_file_basename)	   /*R*/\
+FUNC (wdir_missing__ldir_relative_file_relative)	   /*R*/\
+FUNC (wdir_missing__ldir_relative_file_absolute)	   /*R*/\
+FUNC (wdir_missing__ldir_absolute_file_basename)		\
+FUNC (wdir_missing__ldir_absolute_file_relative)		\
+FUNC (wdir_missing__ldir_absolute_file_absolute_same)		\
+FUNC (wdir_missing__ldir_absolute_file_absolute_different)	\
+FUNC (wdir_relative_ldir_missing__file_basename)	   /*R*/\
+FUNC (wdir_relative_ldir_missing__file_relative)	   /*R*/\
+FUNC (wdir_relative_ldir_missing__file_absolute)	   /*R*/\
+FUNC (wdir_relative_ldir_relative_file_basename)	   /*R*/\
+FUNC (wdir_relative_ldir_relative_file_relative)	   /*R*/\
+FUNC (wdir_relative_ldir_relative_file_absolute)	   /*R*/\
+FUNC (wdir_relative_ldir_absolute_file_basename)	   /*R*/\
+FUNC (wdir_relative_ldir_absolute_file_relative)	   /*R*/\
+FUNC (wdir_relative_ldir_absolute_file_absolute_same)	   /*R*/\
+FUNC (wdir_relative_ldir_absolute_file_absolute_different) /*R*/\
+FUNC (wdir_absolute_ldir_missing__file_basename)		\
+FUNC (wdir_absolute_ldir_missing__file_relative)		\
+FUNC (wdir_absolute_ldir_missing__file_absolute_same)		\
+FUNC (wdir_absolute_ldir_missing__file_absolute_different)	\
+FUNC (wdir_absolute_ldir_relative_file_basename)		\
+FUNC (wdir_absolute_ldir_relative_file_relative)		\
+FUNC (wdir_absolute_ldir_relative_file_absolute_same)		\
+FUNC (wdir_absolute_ldir_relative_file_absolute_different)	\
+FUNC (wdir_absolute_ldir_absolute_file_basename_same)		\
+FUNC (wdir_absolute_ldir_absolute_file_basename_different)	\
+FUNC (wdir_absolute_ldir_absolute_file_relative_same)		\
+FUNC (wdir_absolute_ldir_absolute_file_relative_different)	\
+FUNC (wdir_absolute_ldir_absolute_file_absolute_same)		\
+FUNC (wdir_absolute_ldir_absolute_file_absolute_different)
+
+#define FUNC(name)					\
+  asm (#name "_start: .globl " #name "_start\n");	\
+  static void						\
+  name (void)						\
+  {							\
+    v++;						\
+  }							\
+  asm (#name "_end: .globl " #name "_end\n");
+FUNCBLOCK
+#undef FUNC
+
+int
+main (void)
+{
+
+#define FUNC(name)					\
+  name ();
+FUNCBLOCK
+#undef FUNC
+
+  return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -0,0 +1,125 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0  
+}
+
+set testfile "dw2-dir-file-name"
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+set srcfile ${testfile}.c
+set srcabsdir ${objdir}/${subdir}/${testfile}.d
+set srctmpfile tmp-${testfile}.c
+
+# $srcdir may be relative.
+if {[file pathtype $srcabsdir] != "absolute"} {
+    unsuppoted "objdir pathtype is not absolute"
+    return -1
+}
+
+set opts {}
+lappend opts "additional_flags=-DBDIR=\"${srcabsdir}\""
+lappend opts "additional_flags=-DXDIR=\"${srcabsdir}/xdir\""
+lappend opts "additional_flags=-DWDIR=\"wdir\""
+lappend opts "additional_flags=-DLDIR=\"ldir\""
+lappend opts "additional_flags=-DFDIR=\"fdir\""
+lappend opts "additional_flags=-DFILE=\"${srctmpfile}\""
+if [prepare_for_testing ${testfile}.exp ${executable} "${srcfile} ${testfile}.S" $opts] {
+    return -1
+}
+
+remote_exec host "sh -c \"rm -f ${srcabsdir}{/rdir,}{/xdir,}{/wdir,}{/ldir,}{/fdir,}/${srctmpfile}\""
+remote_exec host "sh -c \"rmdir ${srcabsdir}{/rdir,}{/xdir,}{/wdir,}{/ldir,}{/fdir,}\""
+remote_exec host "sh -c \"mkdir ${srcabsdir}{,/rdir}{,/xdir}{,/wdir}{,/ldir}{,/fdir}\""
+remote_exec host "sh -c \"for d in ${srcabsdir}{,/rdir}{,/xdir}{,/wdir}{,/ldir}{,/fdir};do cp ${srcdir}/${subdir}/${srcfile} \\\$d/${srctmpfile}; done\""
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_test "cd ${srcabsdir}/rdir" "Working directory [string_to_regexp ${srcabsdir}]/rdir\\."
+
+proc test { func workdir filename } { with_test_prefix "$func" {
+    # Clear the GDB cache.
+    gdb_test_no_output "set directories" ""
+
+    if {$workdir == ""} {
+        set absolute "$filename"
+    } else {
+        set absolute "$workdir/$filename"
+    }
+    if {[string index $absolute 0] != "/"} {
+	error "not absolute"
+    }
+
+    gdb_breakpoint $func
+    gdb_continue_to_breakpoint $func "$func \\(\\) at .*"
+
+    gdb_test_no_output "set backtrace filename-display absolute"
+    verbose -log "expect: ${absolute}"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
+
+    gdb_test_no_output "set backtrace filename-display basename"
+    verbose -log "expect: [file tail $filename]"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
+
+# FIXME: FAILs
+    gdb_test_no_output "set backtrace filename-display relative"
+    verbose -log "expect: $filename"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative"
+
+# FIXME: FAILs
+    gdb_test_no_output "set backtrace filename-display as-recorded"
+    verbose -log "expect: $filename"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "as-recorded"
+}}
+
+set bdir "${srcabsdir}"
+set file "${srctmpfile}"
+test "wdir_missing__ldir_missing__file_basename" "$bdir/rdir" "$file"
+test "wdir_missing__ldir_missing__file_relative" "$bdir/rdir" "fdir/$file"
+test "wdir_missing__ldir_missing__file_absolute" "" "$bdir/$file"
+test "wdir_missing__ldir_relative_file_basename" "$bdir/rdir" "ldir/$file"
+test "wdir_missing__ldir_relative_file_relative" "$bdir/rdir" "ldir/fdir/$file"
+test "wdir_missing__ldir_relative_file_absolute" "" "$bdir/$file"
+test "wdir_missing__ldir_absolute_file_basename" "$bdir" "ldir/$file"
+test "wdir_missing__ldir_absolute_file_relative" "$bdir" "ldir/fdir/$file"
+test "wdir_missing__ldir_absolute_file_absolute_same" "" "$bdir/ldir/$file"
+test "wdir_missing__ldir_absolute_file_absolute_different" "" "$bdir/ldir/$file"
+test "wdir_relative_ldir_missing__file_basename" "$bdir/rdir/wdir" "$file"
+test "wdir_relative_ldir_missing__file_relative" "$bdir/rdir/wdir" "fdir/$file"
+test "wdir_relative_ldir_missing__file_absolute" "" "$bdir/$file"
+test "wdir_relative_ldir_relative_file_basename" "$bdir/rdir/wdir" "ldir/$file"
+test "wdir_relative_ldir_relative_file_relative" "$bdir/rdir/wdir" "ldir/fdir/$file"
+test "wdir_relative_ldir_relative_file_absolute" "" "$bdir/$file"
+test "wdir_relative_ldir_absolute_file_basename" "" "$bdir/ldir/$file"
+test "wdir_relative_ldir_absolute_file_relative" "" "$bdir/ldir/fdir/$file"
+test "wdir_relative_ldir_absolute_file_absolute_same" "" "$bdir/$file"
+test "wdir_relative_ldir_absolute_file_absolute_different" "" "$bdir/$file"
+test "wdir_absolute_ldir_missing__file_basename" "$bdir/wdir" "$file"
+test "wdir_absolute_ldir_missing__file_relative" "$bdir/wdir" "fdir/$file"
+test "wdir_absolute_ldir_missing__file_absolute_same" "" "$bdir/$file"
+test "wdir_absolute_ldir_missing__file_absolute_different" "" "$bdir/$file"
+test "wdir_absolute_ldir_relative_file_basename" "$bdir/wdir" "ldir/$file"
+test "wdir_absolute_ldir_relative_file_relative" "$bdir/wdir" "ldir/fdir/$file"
+test "wdir_absolute_ldir_relative_file_absolute_same" "" "$bdir/$file"
+test "wdir_absolute_ldir_relative_file_absolute_different" "" "$bdir/$file"
+test "wdir_absolute_ldir_absolute_file_basename_same" "" "$bdir/ldir/$file"
+test "wdir_absolute_ldir_absolute_file_relative_different" "" "$bdir/ldir/fdir/$file"
+test "wdir_absolute_ldir_absolute_file_absolute_same" "" "$bdir/$file"
+test "wdir_absolute_ldir_absolute_file_absolute_different" "" "$bdir/$file"

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-15 22:46                                                             ` Jan Kratochvil
@ 2012-03-18 18:30                                                               ` iam ahal
  2012-03-18 18:35                                                                 ` Jan Kratochvil
  2012-03-18 20:46                                                                 ` Eli Zaretskii
  0 siblings, 2 replies; 69+ messages in thread
From: iam ahal @ 2012-03-18 18:30 UTC (permalink / raw)
  To: Tom Tromey
  Cc: Eli Zaretskii, Jan Kratochvil, palves, dje, gdb-patches,
	pmuldoon, brobecker, drow, asmwarrior

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

I've fixed patch and news carefully by your notes.

To Jan Kratochvil, Yuanhui Zhang:

I've included absolute filename option to my patch.
	
Eli Zaretskii:

Here is an example of working with "relative filename" option:

$ gcc -Wall -g ~/Downloads/contrib/prog.c
$ ./gdb-7.4/gdb/gdb ./a.out

(gdb) backtrace
#0  main () at /home/unknown/Downloads/contrib/prog.c:3
(gdb) set backtrace filename-display relative
(gdb) backtrace
#0  main () at prog.c:3

As I remember the difference between "basename" and "relative" option
was explained some time ago in this thread.

~Eldar

[-- Attachment #2: ChangeLog --]
[-- Type: application/octet-stream, Size: 796 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	Add a new variable that controls a way in which filenames in
	backtraces is displayed.
	* frame.c: Added including of a header file.
	(filename_display_full): New global variable.
	(filename_display_basename): New global variable.
	(filename_display_without_comp_directory): New global variable.
	(filename_display_kind_names): New global array.
	(show_filename_display_string): New function.
	(get_filename_display_from_sal): New function.
	(_initialize_frame): Added initialization of 'filename-display'
	variable.
	* frame.h (get_filename_display_from_sal): Added declaration.
	* stack.c (print_frame): Added new variable and calling of a new
	function and condition with this variable. Changed third argument of
	calling of a function.

[-- Attachment #3: ChangeLog-doc --]
[-- Type: application/octet-stream, Size: 166 bytes --]

2011-10-30  Eldar Gaynetdinov <hal9000ed2k@gmail.com>

	* gdb.texinfo (Backtrace): Added description of 'filename-display'
	variable in 'set/show backtrace' section.

[-- Attachment #4: gdb-filename-display.patch --]
[-- Type: text/x-patch, Size: 6730 bytes --]

diff -rup gdb-7.4-orig/gdb/doc/gdb.texinfo gdb-7.4/gdb/doc/gdb.texinfo
--- gdb-7.4-orig/gdb/doc/gdb.texinfo	2012-01-06 08:43:35.000000000 +0400
+++ gdb-7.4/gdb/doc/gdb.texinfo	2012-03-18 22:00:06.259580346 +0400
@@ -6191,6 +6191,29 @@ unlimited.
 Display the current limit on backtrace levels.
 @end table
 
+If backtraces isn't easy to read due to a long absolute filename record and
+you just want to see only a basename or a relative filename,
+you can change this behavior:
+
+@table @code
+@item set backtrace filename-display
+@itemx set backtrace filename-display as-recorded
+@cindex backtrace filename-display
+Display a filename exactly as recorded at compile time.  This is the default.
+
+@item set backtrace filename-display basename
+Display only basename of a filename.
+
+@item set backtrace filename-display relative
+Display a filename without the compilation directory part.
+
+@item set backtrace filename-display absolute
+Display an absolute filename.
+
+@item show backtrace filename-display
+Show the current way to display a filename in backtraces.
+@end table
+
 @node Selection
 @section Selecting a Frame
 
diff -rup gdb-7.4-orig/gdb/frame.c gdb-7.4/gdb/frame.c
--- gdb-7.4-orig/gdb/frame.c	2012-01-06 08:43:12.000000000 +0400
+++ gdb-7.4/gdb/frame.c	2012-03-18 22:00:06.259580346 +0400
@@ -43,7 +43,9 @@
 #include "gdbthread.h"
 #include "block.h"
 #include "inline-frame.h"
-#include  "tracepoint.h"
+#include "tracepoint.h"
+#include "filenames.h"
+#include "source.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -135,6 +137,20 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_as_recorded[] = "as-recorded";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_relative_directory[] = "relative";
+static const char filename_display_absolute[] = "absolute";
+
+static const char *const filename_display_kind_names[] = {
+  filename_display_as_recorded,
+  filename_display_basename,
+  filename_display_relative_directory,
+  filename_display_absolute,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -207,6 +223,16 @@ show_backtrace_limit (struct ui_file *fi
 		    value);
 }
 
+static const char *filename_display_string = filename_display_as_recorded;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -2118,6 +2144,45 @@ find_frame_sal (struct frame_info *frame
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (const struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename == NULL)
+      return NULL;
+  else if (filename_display_string == filename_display_basename)
+      return lbasename (filename);
+  else if (filename_display_string == filename_display_relative_directory
+	   && dirname && dlen && dlen <= strlen (filename)
+	   && !filename_ncmp (filename, dirname, dlen))
+    {
+      const char *start = filename + dlen;
+      const char *result = start;
+
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
+	return result;
+      else
+	return result == start ? filename : result;
+    }
+  else if (filename_display_string == filename_display_absolute)
+    {
+      const char *retval = symtab_to_fullname (sal->symtab);
+
+      if (retval != NULL)
+	return retval;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2477,6 +2542,22 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set how to display filenames in backtraces."), _("\
+Show how to display filenames in backtraces."), _("\
+filename-display can be:\n\
+  as-recorded    - display a filename exactly as recorded at compile time\n\
+  basename       - display only basename of a filename\n\
+  relative       - display a filename without the compilation directory part\n\
+  absolute       - display an absolute filename\n\
+By default, as-recorded filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
diff -rup gdb-7.4-orig/gdb/frame.h gdb-7.4/gdb/frame.h
--- gdb-7.4-orig/gdb/frame.h	2012-01-06 08:43:12.000000000 +0400
+++ gdb-7.4/gdb/frame.h	2012-03-18 22:00:06.259580346 +0400
@@ -353,6 +353,13 @@ extern int get_frame_func_if_available (
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either exactly as recorded filename or basename or filename
+   without the compile directory part or absolute filename.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *
+get_filename_display_from_sal (const struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff -rup gdb-7.4-orig/gdb/stack.c gdb-7.4/gdb/stack.c
--- gdb-7.4-orig/gdb/stack.c	2012-01-06 08:43:31.000000000 +0400
+++ gdb-7.4/gdb/stack.c	2012-03-18 22:01:04.115579942 +0400
@@ -1173,11 +1173,13 @@ print_frame (struct frame_info *frame, i
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);

[-- Attachment #5: NEWS --]
[-- Type: application/octet-stream, Size: 173 bytes --]

* New options

set backtrace filename-display as-recorded|basename|relative
show backtrace filename-display
  Control the way in which filenames is displayed in backtraces.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-18 18:30                                                               ` iam ahal
@ 2012-03-18 18:35                                                                 ` Jan Kratochvil
  2012-04-06 14:22                                                                   ` Jan Kratochvil
  2012-03-18 20:46                                                                 ` Eli Zaretskii
  1 sibling, 1 reply; 69+ messages in thread
From: Jan Kratochvil @ 2012-03-18 18:35 UTC (permalink / raw)
  To: iam ahal
  Cc: Tom Tromey, Eli Zaretskii, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

On Sun, 18 Mar 2012 19:30:17 +0100, iam ahal wrote:
> I've included absolute filename option to my patch.

Could you check FAILs of that testcase by me?  There are probably some GDB
bugs but I did not get back to it yet.


Thanks,
Jan

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-18 18:30                                                               ` iam ahal
  2012-03-18 18:35                                                                 ` Jan Kratochvil
@ 2012-03-18 20:46                                                                 ` Eli Zaretskii
  2012-03-25 19:27                                                                   ` iam ahal
  1 sibling, 1 reply; 69+ messages in thread
From: Eli Zaretskii @ 2012-03-18 20:46 UTC (permalink / raw)
  To: iam ahal
  Cc: tromey, jan.kratochvil, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

> Date: Sun, 18 Mar 2012 21:30:17 +0300
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Jan Kratochvil <jan.kratochvil@redhat.com>, palves@redhat.com, 
> 	dje@google.com, gdb-patches@sourceware.org, pmuldoon@redhat.com, 
> 	brobecker@adacore.com, drow@false.org, asmwarrior <asmwarrior@gmail.com>
> 
> Here is an example of working with "relative filename" option:
> 
> $ gcc -Wall -g ~/Downloads/contrib/prog.c
> $ ./gdb-7.4/gdb/gdb ./a.out
> 
> (gdb) backtrace
> #0  main () at /home/unknown/Downloads/contrib/prog.c:3
> (gdb) set backtrace filename-display relative
> (gdb) backtrace
> #0  main () at prog.c:3
> 
> As I remember the difference between "basename" and "relative" option
> was explained some time ago in this thread.

Well, the difference between them is what I need.  Could you please
point to the message where that was explained?

> +If backtraces isn't easy to read due to a long absolute filename record and
                 ^^^^^
"aren't"

Thanks.

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-18 20:46                                                                 ` Eli Zaretskii
@ 2012-03-25 19:27                                                                   ` iam ahal
  2012-03-25 19:31                                                                     ` Jan Kratochvil
  2012-03-25 21:23                                                                     ` Eli Zaretskii
  0 siblings, 2 replies; 69+ messages in thread
From: iam ahal @ 2012-03-25 19:27 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: tromey, jan.kratochvil, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

To Eli Zaretskii:

The difference between "basename" and "relative" is:

"basename" option just cuts directory part from 'DW_AT_name'.
"relative" option cuts 'DW_AT_comp_dir' part from 'DW_AT_name' If and
only if 'DW_AT_name' contains 'DW_AT_comp_dir' part at the beginning.

Quite frankly, I don't know how exactly make records like this:

    <11>   DW_AT_name        : (indirect string, offset: 0x1e):
/home/username/contrib/test/prog.c
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0):
/home/username/contrib/

Jan Kratochvil:

Where I can see 'dw2-dir-file-name.exp'? I didn't find this file.

~Eldar

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-25 19:27                                                                   ` iam ahal
@ 2012-03-25 19:31                                                                     ` Jan Kratochvil
  2012-03-25 21:23                                                                     ` Eli Zaretskii
  1 sibling, 0 replies; 69+ messages in thread
From: Jan Kratochvil @ 2012-03-25 19:31 UTC (permalink / raw)
  To: iam ahal
  Cc: Eli Zaretskii, tromey, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

On Sun, 25 Mar 2012 21:26:50 +0200, iam ahal wrote:
> Quite frankly, I don't know how exactly make records like this:

I also do not.  Any known versions of GCC do not produce such
DW_AT_name+DW_AT_comp_dir.  Why you have then created a patch for this
specific DW_AT_name+DW_AT_comp_dir case?


>     <11>   DW_AT_name        : (indirect string, offset: 0x1e): /home/username/contrib/test/prog.c
>     <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0): /home/username/contrib/
> 
> Jan Kratochvil:
> 
> Where I can see 'dw2-dir-file-name.exp'? I didn't find this file.

I have posted it in the testcase patch:
	http://sourceware.org/ml/gdb-patches/2012-03/msg00583.html


Thanks,
Jan

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-25 19:27                                                                   ` iam ahal
  2012-03-25 19:31                                                                     ` Jan Kratochvil
@ 2012-03-25 21:23                                                                     ` Eli Zaretskii
  1 sibling, 0 replies; 69+ messages in thread
From: Eli Zaretskii @ 2012-03-25 21:23 UTC (permalink / raw)
  To: iam ahal
  Cc: tromey, jan.kratochvil, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

> Date: Sun, 25 Mar 2012 23:26:50 +0400
> From: iam ahal <hal9000ed2k@gmail.com>
> Cc: tromey@redhat.com, jan.kratochvil@redhat.com, palves@redhat.com, 
> 	dje@google.com, gdb-patches@sourceware.org, pmuldoon@redhat.com, 
> 	brobecker@adacore.com, drow@false.org, asmwarrior@gmail.com
> 
> The difference between "basename" and "relative" is:
> 
> "basename" option just cuts directory part from 'DW_AT_name'.
> "relative" option cuts 'DW_AT_comp_dir' part from 'DW_AT_name' If and
> only if 'DW_AT_name' contains 'DW_AT_comp_dir' part at the beginning.
> 
> Quite frankly, I don't know how exactly make records like this:
> 
>     <11>   DW_AT_name        : (indirect string, offset: 0x1e):
> /home/username/contrib/test/prog.c
>     <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0):
> /home/username/contrib/

Thanks.  So I understand that my guess was correct, and "relative" is
relative to the compilation directory.  That is, in the example above,
"basename" will give you prog.c, while "relative" will give
"test/prog.c".  Is that correct?

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2012-03-18 18:35                                                                 ` Jan Kratochvil
@ 2012-04-06 14:22                                                                   ` Jan Kratochvil
  0 siblings, 0 replies; 69+ messages in thread
From: Jan Kratochvil @ 2012-04-06 14:22 UTC (permalink / raw)
  To: iam ahal
  Cc: Tom Tromey, Eli Zaretskii, palves, dje, gdb-patches, pmuldoon,
	brobecker, drow, asmwarrior

On Sun, 18 Mar 2012 19:34:54 +0100, Jan Kratochvil wrote:
> On Sun, 18 Mar 2012 19:30:17 +0100, iam ahal wrote:
> > I've included absolute filename option to my patch.
> 
> Could you check FAILs of that testcase by me?  There are probably some GDB
> bugs but I did not get back to it yet.

I have changed the patch functionality a bit primarily due to revert of the
patch as described in:
	Re: [commit] Handle files without DW_AT_comp_dir
	http://sourceware.org/ml/gdb-patches/2012-04/msg00105.html

Does it provide the functionality you need with this patch?  If not, could you
provide your binary file and expected output?

No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.


Thanks,
Jan


gdb/
2012-04-06  Eldar Gaynetdinov <hal9000ed2k@gmail.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Add a new variable that controls a way in which filenames in
	backtraces is displayed.
	* NEWS (set backtrace filename-display): New entry.
	* dwarf2read.c (find_file_and_directory): Remove *COMP_DIR guessing
	from *NAME.
	* frame.c: Include filenames.h and source.h.
	(filename_display_basename, filename_display_relative)
	(filename_display_absolute, filename_display_kind_names)
	(filename_display_string, show_filename_display_string)
	(get_filename_display_from_sal): New.
	(_initialize_frame): Added initialization of 'filename-display'
	variable.
	* frame.h (get_filename_display_from_sal): Added declaration.
	* stack.c (print_frame): Added new variable and calling of a new
	function and condition with this variable. Changed third argument of
	calling of a function.

gdb/doc/
2012-04-06  Eldar Gaynetdinov <hal9000ed2k@gmail.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

        * gdb.texinfo (Backtrace): Added description of 'filename-display'
        variable in 'set/show backtrace' section.

gdb/testsuite/
2012-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.dwarf2/dw2-dir-file-name.exp: New file.
	* gdb.dwarf2/dw2-dir-file-name.c: New file.

--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -114,6 +114,10 @@ show breakpoint condition-evaluation
   This option can improve debugger efficiency depending on the speed of the
   target.
 
+set backtrace filename-display basename|relative|absolute
+show backtrace filename-display
+  Control the way in which filenames is displayed in backtraces.
+
 * New remote packets
 
 z0/z1 conditional breakpoints extension
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6301,6 +6301,27 @@ unlimited.
 Display the current limit on backtrace levels.
 @end table
 
+If backtraces isn't easy to read due to a long absolute filename record and
+you just want to see only a basename or a relative filename,
+you can change this behavior:
+
+@table @code
+@item set backtrace filename-display
+@itemx set backtrace filename-display relative
+@cindex backtrace filename-display
+Display a filename without the compilation directory part.  This is the
+default.
+
+@item set backtrace filename-display basename
+Display only basename of a filename.
+
+@item set backtrace filename-display absolute
+Display an absolute filename.
+
+@item show backtrace filename-display
+Show the current way to display a filename in backtraces.
+@end table
+
 @node Selection
 @section Selecting a Frame
 
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5589,12 +5589,12 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu,
   attr = dwarf2_attr (die, DW_AT_comp_dir, cu);
   if (attr)
     *comp_dir = DW_STRING (attr);
-  else if (*name != NULL && IS_ABSOLUTE_PATH (*name))
+  else
     {
-      *comp_dir = ldirname (*name);
-      if (*comp_dir != NULL)
-	make_cleanup (xfree, *comp_dir);
+      /* Do not try to deduce DW_AT_comp_dir from absolute DW_AT_name, this
+	 does not have to be the compilation directory.  */
     }
+
   if (*comp_dir != NULL)
     {
       /* Irix 6.2 native cc prepends <machine>.: to the compilation
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -43,7 +43,9 @@
 #include "gdbthread.h"
 #include "block.h"
 #include "inline-frame.h"
-#include  "tracepoint.h"
+#include "tracepoint.h"
+#include "filenames.h"
+#include "source.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -135,6 +137,18 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_basename[] = "basename";
+static const char filename_display_relative[] = "relative";
+static const char filename_display_absolute[] = "absolute";
+
+static const char *const filename_display_kind_names[] = {
+  filename_display_basename,
+  filename_display_relative,
+  filename_display_absolute,
+  NULL
+};
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -207,6 +221,16 @@ show_backtrace_limit (struct ui_file *file, int from_tty,
 		    value);
 }
 
+static const char *filename_display_string = filename_display_relative;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -2140,6 +2164,28 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (const struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+
+  if (filename == NULL)
+      return NULL;
+  else if (filename_display_string == filename_display_basename)
+      return lbasename (filename);
+  else if (filename_display_string == filename_display_absolute)
+    {
+      const char *retval = symtab_to_fullname (sal->symtab);
+
+      if (retval != NULL)
+	return retval;
+    }
+
+  return filename;
+}
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2499,6 +2545,21 @@ Zero is unlimited."),
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set how to display filenames in backtraces."), _("\
+Show how to display filenames in backtraces."), _("\
+filename-display can be:\n\
+  basename       - display only basename of a filename\n\
+  relative       - display a filename without the compilation directory part\n\
+  absolute       - display an absolute filename\n\
+By default, as-recorded filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -353,6 +353,12 @@ extern int get_frame_func_if_available (struct frame_info *fi, CORE_ADDR *);
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns filename without the compile directory part, basename or absolute
+   filename.  It depends on 'set backtrace filename-display' value.  */
+
+extern const char *
+  get_filename_display_from_sal (const struct symtab_and_line *sal);
+
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1179,11 +1179,13 @@ print_frame (struct frame_info *frame, int print_level,
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
 	{
 	  const char *fullname = symtab_to_fullname (sal.symtab);
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
@@ -0,0 +1,87 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+volatile int v;
+
+static void
+marker (void)
+{
+  v++;
+}
+
+/* *R* marks possibly invalid compiler output as the first path component is
+   not absolute.  Still DWARF-4 does not forbid such DWARF; GCC does not
+   produce it.  */
+
+#define FUNCBLOCK						\
+FUNC (compdir_missing__ldir_missing__file_basename)	   /*R*/\
+FUNC (compdir_missing__ldir_missing__file_relative)	   /*R*/\
+FUNC (compdir_missing__ldir_missing__file_absolute)		\
+FUNC (compdir_missing__ldir_relative_file_basename)	   /*R*/\
+FUNC (compdir_missing__ldir_relative_file_relative)	   /*R*/\
+FUNC (compdir_missing__ldir_relative_file_absolute)	   /*R*/\
+FUNC (compdir_missing__ldir_absolute_file_basename)		\
+FUNC (compdir_missing__ldir_absolute_file_relative)		\
+FUNC (compdir_missing__ldir_absolute_file_absolute_same)	\
+FUNC (compdir_missing__ldir_absolute_file_absolute_different)	\
+FUNC (compdir_relative_ldir_missing__file_basename)	   /*R*/\
+FUNC (compdir_relative_ldir_missing__file_relative)	   /*R*/\
+FUNC (compdir_relative_ldir_missing__file_absolute)	   /*R*/\
+FUNC (compdir_relative_ldir_relative_file_basename)	   /*R*/\
+FUNC (compdir_relative_ldir_relative_file_relative)	   /*R*/\
+FUNC (compdir_relative_ldir_relative_file_absolute)	   /*R*/\
+FUNC (compdir_relative_ldir_absolute_file_basename)	   /*R*/\
+FUNC (compdir_relative_ldir_absolute_file_relative)	   /*R*/\
+FUNC (compdir_relative_ldir_absolute_file_absolute_same)   /*R*/\
+FUNC (compdir_relative_ldir_absolute_file_absolute_different) /*R*/\
+FUNC (compdir_absolute_ldir_missing__file_basename)		\
+FUNC (compdir_absolute_ldir_missing__file_relative)		\
+FUNC (compdir_absolute_ldir_missing__file_absolute_same)	\
+FUNC (compdir_absolute_ldir_missing__file_absolute_different)	\
+FUNC (compdir_absolute_ldir_relative_file_basename)		\
+FUNC (compdir_absolute_ldir_relative_file_relative)		\
+FUNC (compdir_absolute_ldir_relative_file_absolute_same)	\
+FUNC (compdir_absolute_ldir_relative_file_absolute_different)	\
+FUNC (compdir_absolute_ldir_absolute_file_basename_same)	\
+FUNC (compdir_absolute_ldir_absolute_file_basename_different)	\
+FUNC (compdir_absolute_ldir_absolute_file_relative_same)	\
+FUNC (compdir_absolute_ldir_absolute_file_relative_different)	\
+FUNC (compdir_absolute_ldir_absolute_file_absolute_same)	\
+FUNC (compdir_absolute_ldir_absolute_file_absolute_different)
+
+#define FUNC(name)					\
+  asm (#name "_start: .globl " #name "_start\n");	\
+  static void						\
+  name (void)						\
+  {							\
+    v++;						\
+  }							\
+  asm (#name "_end: .globl " #name "_end\n");
+FUNCBLOCK
+#undef FUNC
+
+int
+main (void)
+{
+
+#define FUNC(name)					\
+  name ();
+FUNCBLOCK
+#undef FUNC
+
+  return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -0,0 +1,403 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0  
+}
+
+set testfile "dw2-dir-file-name"
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+set srcfile ${testfile}.c
+set asmsrcfile ${objdir}/${subdir}/${testfile}asm.S
+set asmobjfile ${objdir}/${subdir}/${testfile}asm.o
+set srcabsdir ${objdir}/${subdir}/${testfile}.d
+set srctmpfile tmp-${testfile}.c
+
+# $srcdir may be relative.
+if {[file pathtype $srcabsdir] != "absolute"} {
+    untested "objdir pathtype is not absolute"
+    return -1
+}
+
+set f [open $asmsrcfile "w"]
+puts $f "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */"
+
+proc out_cu { name cu_dir cu_name line_dir line_name } {
+    global f
+
+    puts -nonewline $f "\
+.L${name}_begin:
+	.4byte	.L${name}_end - .L${name}_start	/* Length of Compilation Unit */
+.L${name}_start:
+	.2byte	2				/* DWARF Version */
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
+	.byte	4				/* Pointer size */
+"
+    if { $cu_dir != "" } {
+	puts $f "  .uleb128 ABBREV_COMP_DIR_NAME /* Abbrev: DW_TAG_compile_unit */"
+    } else {
+	puts $f "  .uleb128 ABBREV_NAME /* Abbrev: DW_TAG_compile_unit */"
+    }
+    puts -nonewline $f "\
+	.ascii	\"GNU C\\0\"			/* DW_AT_producer */
+	.byte	2				/* DW_AT_language (DW_LANG_C) */
+	.4byte	.Lline_${name}_begin		/* DW_AT_stmt_list */
+	.4byte	${name}_start			/* DW_AT_low_pc */
+	.4byte	${name}_end			/* DW_AT_high_pc */
+"
+    if { $cu_dir != "" } {
+	puts $f "  .ascii $cu_dir /* DW_AT_comp_dir */"
+    }
+    puts -nonewline $f "\
+	.ascii	$cu_name			/* DW_AT_name */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
+	.asciz		\"${name}\"		/* DW_AT_name */
+	.4byte		${name}_start		/* DW_AT_low_pc */
+	.4byte		${name}_end		/* DW_AT_high_pc */
+
+	.byte		0			/* End of children of CU */
+.L${name}_end:
+"
+}
+
+proc out_line { name cu_dir cu_name line_dir line_name } {
+    global f
+
+    puts -nonewline $f "\
+.Lline_${name}_begin:
+	.4byte		.Lline_${name}_end - .Lline_${name}_start	/* Initial length */
+.Lline_${name}_start:
+	.2byte		2			/* Version */
+	.4byte		.Lline_${name}_lines - .Lline_${name}_hdr	/* header_length */
+.Lline_${name}_hdr:
+	.byte		1			/* Minimum insn length */
+	.byte		1			/* default_is_stmt */
+	.byte		1			/* line_base */
+	.byte		1			/* line_range */
+	.byte		4			/* opcode_base */
+
+	/* Standard lengths */
+	.byte		0
+	.byte		1
+	.byte		1
+
+	/* Include directories */
+"
+    if { $line_dir != "" } {
+	puts $f "  .ascii $line_dir"
+    }
+    puts -nonewline $f "\
+	.byte		0
+
+	/* File names */
+	.ascii	$line_name
+"
+    if { $line_dir != "" } {
+	puts $f "  .uleb128 1"
+    } else {
+	puts $f "  .uleb128 0"
+    }
+    puts -nonewline $f "\
+	.uleb128	0
+	.uleb128	0
+
+	.byte		0
+
+.Lline_${name}_lines:
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	998	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		${name}_start
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 1000 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	5
+	.byte		2
+	.4byte		${name}_end
+	.byte		1	/* DW_LNS_copy */
+	.byte		0	/* DW_LNE_end_of_sequence */
+	.uleb128	1
+	.byte		1
+.Lline_${name}_end:
+"
+}
+
+# IFSOME can be optionally _same or _different if >= 2 absolute directories are
+# provided.  Then in the _different case the overriden directories have invalid
+# XDIR value.
+
+proc out_unit { func compdir ldir file ifsame } {
+    set name "compdir_${compdir}_ldir_${ldir}_file_${file}${ifsame}"
+
+    if { $compdir == "missing_" } {
+	set cu_dir {}
+    } elseif { $compdir == "relative" } {
+	set cu_dir {COMPDIR "\0"}
+    } elseif { $compdir == "absolute" } {
+	set cu_dir {BDIR "/" COMPDIR "\0"}
+    } else {
+	error "compdir $compdir"
+    }
+
+    if { $ldir == "missing_" } {
+	set line_dir {}
+    } elseif { $ldir == "relative" } {
+	set line_dir {LDIR "\0"}
+    } elseif { $ldir == "absolute" } {
+	set line_dir {BDIR "/" LDIR "\0"}
+    } else {
+	error "ldir $ldir"
+    }
+
+    if { $file == "basename" } {
+	set cu_name {FILE "\0"}
+    } elseif { $file == "relative" } {
+	set cu_name {FDIR "/" FILE "\0"}
+    } elseif { $file == "absolute" } {
+	set cu_name {BDIR "/" FILE "\0"}
+    } else {
+	error "file $file"
+    }
+    set line_name $cu_name
+
+    if { "$ifsame" == "_different" } {
+	if { $file == "absolute" } {
+	    if { $ldir == "absolute" } {
+		set line_dir {XDIR "\0"}
+	    }
+	    if { $compdir == "absolute" } {
+		set cu_dir {XDIR "\0"}
+	    }
+	} elseif { $ldir == "absolute" } {
+	    if { $compdir == "absolute" } {
+		set cu_dir {XDIR "\0"}
+	    }
+	} else {
+	    error "not enough absolutes"
+	}
+    }
+
+    $func $name $cu_dir $cu_name $line_dir $line_name
+}
+
+proc out_diff { func compdir ldir file } {
+    set abscount 0
+    if { $compdir == "absolute" } {
+	incr abscount
+    }
+    if { $ldir == "absolute" } {
+	incr abscount
+    }
+    if { $file == "absolute" } {
+	incr abscount
+    }
+    if { $abscount <= 1 } {
+	out_unit $func $compdir $ldir $file ""
+    } else {
+	out_unit $func $compdir $ldir $file "_same"
+	out_unit $func $compdir $ldir $file "_different"
+    }
+}
+
+proc out_file { func compdir ldir } {
+    out_diff $func $compdir $ldir "basename"
+    out_diff $func $compdir $ldir "relative"
+    out_diff $func $compdir $ldir "absolute"
+}
+
+proc out_ldir { func compdir } {
+    out_file $func $compdir "missing_"
+    out_file $func $compdir "relative"
+    out_file $func $compdir "absolute"
+}
+
+proc out_compdir { func } {
+    out_ldir $func "missing_"
+    out_ldir $func "relative"
+    out_ldir $func "absolute"
+}
+
+puts -nonewline $f "\
+#define ABBREV_NAME 1
+#define ABBREV_COMP_DIR_NAME 2
+  .section .debug_info
+"
+out_compdir out_cu
+
+puts $f "  .section .debug_line"
+out_compdir out_line
+
+puts -nonewline $f "\
+	.section .debug_abbrev
+.Labbrev1_begin:
+
+	.uleb128	ABBREV_NAME		/* Abbrev code */
+	.uleb128	0x11			/* DW_TAG_compile_unit */
+	.byte		1			/* has_children */
+	.uleb128	0x25			/* DW_AT_producer */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x13			/* DW_AT_language */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x10			/* DW_AT_stmt_list */
+	.uleb128	0x6			/* DW_FORM_data4 */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	ABBREV_COMP_DIR_NAME	/* Abbrev code */
+	.uleb128	0x11			/* DW_TAG_compile_unit */
+	.byte		1			/* has_children */
+	.uleb128	0x25			/* DW_AT_producer */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x13			/* DW_AT_language */
+	.uleb128	0xb			/* DW_FORM_data1 */
+	.uleb128	0x10			/* DW_AT_stmt_list */
+	.uleb128	0x6			/* DW_FORM_data4 */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x1b			/* DW_AT_comp_dir */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.uleb128	3			/* Abbrev code */
+	.uleb128	0x2e			/* DW_TAG_subprogram */
+	.byte		0			/* has_children */
+	.uleb128	0x3			/* DW_AT_name */
+	.uleb128	0x8			/* DW_FORM_string */
+	.uleb128	0x11			/* DW_AT_low_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.uleb128	0x12			/* DW_AT_high_pc */
+	.uleb128	0x1			/* DW_FORM_addr */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+"
+
+close $f
+
+set opts {}
+# Base directory.
+lappend opts "additional_flags=-DBDIR=\"${srcabsdir}\""
+# Incorrect directory which should never be visible from GDB.
+lappend opts "additional_flags=-DXDIR=\"${srcabsdir}/xdir\""
+# CU's DW_AT_comp_dir.
+lappend opts "additional_flags=-DCOMPDIR=\"compdir\""
+# .debug_line's directory.
+lappend opts "additional_flags=-DLDIR=\"ldir\""
+# CU's DW_AT_name and .debug_line's filename relative directory, if needed.
+lappend opts "additional_flags=-DFDIR=\"fdir\""
+# CU's DW_AT_name and .debug_line's filename.
+lappend opts "additional_flags=-DFILE=\"${srctmpfile}\""
+
+if { [gdb_compile "${asmsrcfile} ${srcdir}/${subdir}/$srcfile" "${binfile}" executable $opts] != "" } {
+    untested "Cannot compile ${asmsrcfile} or $srcfile"
+    return -1
+}
+
+remote_exec host "sh -c \"rm -f ${srcabsdir}{/rdir,}{/xdir,}{/compdir,}{/ldir,}{/fdir,}/${srctmpfile}\""
+remote_exec host "sh -c \"rmdir ${srcabsdir}{/rdir,}{/xdir,}{/compdir,}{/ldir,}{/fdir,}\""
+remote_exec host "sh -c \"mkdir ${srcabsdir}{,/rdir}{,/xdir}{,/compdir}{,/ldir}{,/fdir}\""
+remote_exec host "sh -c \"for d in ${srcabsdir}{,/rdir}{,/xdir}{,/compdir}{,/ldir}{,/fdir};do cp ${srcdir}/${subdir}/${srcfile} \\\$d/${srctmpfile}; done\""
+
+clean_restart ${executable}
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_test "cd ${srcabsdir}/rdir" "Working directory [string_to_regexp ${srcabsdir}]/rdir\\."
+
+proc test { func compdir filename } { with_test_prefix "$func" {
+    # Clear the GDB cache.
+    gdb_test_no_output "set directories" ""
+
+    if {$compdir == ""} {
+        set absolute "$filename"
+    } else {
+        set absolute "$compdir/$filename"
+    }
+    if {[string index $absolute 0] != "/"} {
+	error "not absolute"
+    }
+
+    gdb_breakpoint $func
+    gdb_continue_to_breakpoint $func "$func \\(\\) at .*"
+
+    gdb_test_no_output "set backtrace filename-display absolute"
+    verbose -log "expect: ${absolute}"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
+
+    gdb_test_no_output "set backtrace filename-display basename"
+    verbose -log "expect: [file tail $filename]"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
+
+    gdb_test_no_output "set backtrace filename-display relative"
+    verbose -log "expect: $filename"
+    gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative"
+}}
+
+set bdir "${srcabsdir}"
+set file "${srctmpfile}"
+test "compdir_missing__ldir_missing__file_basename" "$bdir/rdir" "$file"
+test "compdir_missing__ldir_missing__file_relative" "$bdir/rdir" "fdir/$file"
+test "compdir_missing__ldir_missing__file_absolute" "" "$bdir/$file"
+test "compdir_missing__ldir_relative_file_basename" "$bdir/rdir" "ldir/$file"
+test "compdir_missing__ldir_relative_file_relative" "$bdir/rdir" "ldir/fdir/$file"
+test "compdir_missing__ldir_relative_file_absolute" "" "$bdir/$file"
+test "compdir_missing__ldir_absolute_file_basename" "" "$bdir/ldir/$file"
+test "compdir_missing__ldir_absolute_file_relative" "" "$bdir/ldir/fdir/$file"
+test "compdir_missing__ldir_absolute_file_absolute_same" "" "$bdir/$file"
+test "compdir_missing__ldir_absolute_file_absolute_different" "" "$bdir/$file"
+test "compdir_relative_ldir_missing__file_basename" "$bdir/rdir/compdir" "$file"
+test "compdir_relative_ldir_missing__file_relative" "$bdir/rdir/compdir" "fdir/$file"
+test "compdir_relative_ldir_missing__file_absolute" "" "$bdir/$file"
+test "compdir_relative_ldir_relative_file_basename" "$bdir/rdir/compdir" "ldir/$file"
+test "compdir_relative_ldir_relative_file_relative" "$bdir/rdir/compdir" "ldir/fdir/$file"
+test "compdir_relative_ldir_relative_file_absolute" "" "$bdir/$file"
+test "compdir_relative_ldir_absolute_file_basename" "" "$bdir/ldir/$file"
+test "compdir_relative_ldir_absolute_file_relative" "" "$bdir/ldir/fdir/$file"
+test "compdir_relative_ldir_absolute_file_absolute_same" "" "$bdir/$file"
+test "compdir_relative_ldir_absolute_file_absolute_different" "" "$bdir/$file"
+test "compdir_absolute_ldir_missing__file_basename" "$bdir/compdir" "$file"
+test "compdir_absolute_ldir_missing__file_relative" "$bdir/compdir" "fdir/$file"
+test "compdir_absolute_ldir_missing__file_absolute_same" "" "$bdir/$file"
+test "compdir_absolute_ldir_missing__file_absolute_different" "" "$bdir/$file"
+test "compdir_absolute_ldir_relative_file_basename" "$bdir/compdir" "ldir/$file"
+test "compdir_absolute_ldir_relative_file_relative" "$bdir/compdir" "ldir/fdir/$file"
+test "compdir_absolute_ldir_relative_file_absolute_same" "" "$bdir/$file"
+test "compdir_absolute_ldir_relative_file_absolute_different" "" "$bdir/$file"
+test "compdir_absolute_ldir_absolute_file_basename_same" "" "$bdir/ldir/$file"
+test "compdir_absolute_ldir_absolute_file_relative_different" "" "$bdir/ldir/fdir/$file"
+test "compdir_absolute_ldir_absolute_file_absolute_same" "" "$bdir/$file"
+test "compdir_absolute_ldir_absolute_file_absolute_different" "" "$bdir/$file"

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

* Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
  2011-06-26 20:00 [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename) iam ahal
  2011-06-26 20:49 ` Phil Muldoon
@ 2012-04-09 15:39 ` Jan Kratochvil
  1 sibling, 0 replies; 69+ messages in thread
From: Jan Kratochvil @ 2012-04-09 15:39 UTC (permalink / raw)
  To: iam ahal; +Cc: gdb-patches

On Sun, 26 Jun 2011 22:00:28 +0200, iam ahal wrote:
> Some build systems (e.g. mozilla firefox) provides build of source code with
> only full path to files (i.e. pass to gcc full path to file).
[...]
> /media/25b7639d-9a70-42ca-aaa7-28f4d1f417fd/firefox-dev/mozilla-central/browser/app/nsBrowserApp.cpp:204

Where did you get this builds?  I tried these without success:

http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-debug/1333957777/firefox-14.0a1.en-US.linux-x86_64.tar.bz2
 - it has no debug info at all

http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-debug/1333957777/firefox-14.0a1.en-US.linux-x86_64.crashreporter-symbols.zip
 - it has only the .sym files for Apport, no DWARF, no stabs


Thanks,
Jan

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

end of thread, other threads:[~2012-04-09 15:39 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-26 20:00 [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename) iam ahal
2011-06-26 20:49 ` Phil Muldoon
2011-06-27 16:00   ` Joel Brobecker
2011-06-27 16:18     ` Phil Muldoon
2011-06-28 20:08     ` Tom Tromey
2011-06-28 22:36       ` Phil Muldoon
2011-07-03 18:12         ` iam ahal
2011-07-03 21:13           ` Eli Zaretskii
2011-07-04 11:26             ` iam ahal
2011-07-04 12:05               ` Eli Zaretskii
2011-07-04 21:47                 ` Joel Brobecker
2011-07-05  4:35                   ` Eli Zaretskii
2011-07-19 14:43                     ` Pedro Alves
2011-07-05  8:38                   ` iam ahal
2011-07-19 14:19                   ` Pedro Alves
2011-07-17 19:24                 ` iam ahal
2011-07-19 13:28                   ` iam ahal
2011-07-19 17:04                     ` Eli Zaretskii
2011-07-24 21:12                       ` iam ahal
2011-07-26 14:17                         ` iam ahal
2011-07-28 15:34                         ` Tom Tromey
2011-07-28 15:57                           ` Tom Tromey
2011-07-28 16:36                             ` Joel Brobecker
2011-07-28 17:39                               ` Tom Tromey
2011-07-28 17:51                           ` Tom Tromey
2011-07-29 12:01                             ` Joel Brobecker
2011-07-29 12:36                             ` Eli Zaretskii
2011-08-02 19:41                           ` iam ahal
2011-08-03 17:45                             ` Tom Tromey
2011-10-30 19:52                               ` iam ahal
2011-11-02 19:06                                 ` Tom Tromey
2011-11-02 22:53                                 ` Doug Evans
2011-12-04 15:52                                   ` iam ahal
2011-12-04 16:55                                     ` Eli Zaretskii
2011-12-04 18:41                                       ` iam ahal
2011-12-04 19:01                                         ` Pedro Alves
2011-12-04 19:56                                           ` Eli Zaretskii
2011-12-04 21:00                                             ` Pedro Alves
2011-12-05  3:54                                               ` Eli Zaretskii
2011-12-05  5:17                                                 ` Eli Zaretskii
2011-12-06 13:03                                                   ` Pedro Alves
2011-12-06 14:04                                                     ` Eli Zaretskii
2011-12-06 18:00                                                       ` Doug Evans
2011-12-06 20:45                                                       ` Tom Tromey
2011-12-07  8:00                                                         ` Eli Zaretskii
2012-03-10 20:15                                                           ` iam ahal
2012-03-11  1:22                                                             ` asmwarrior
2012-03-12 13:10                                                               ` iam ahal
2012-03-14 16:11                                                             ` Tom Tromey
2012-03-14 16:27                                                             ` Jan Kratochvil
2012-03-14 17:40                                                             ` Eli Zaretskii
2012-03-15 22:46                                                             ` Jan Kratochvil
2012-03-18 18:30                                                               ` iam ahal
2012-03-18 18:35                                                                 ` Jan Kratochvil
2012-04-06 14:22                                                                   ` Jan Kratochvil
2012-03-18 20:46                                                                 ` Eli Zaretskii
2012-03-25 19:27                                                                   ` iam ahal
2012-03-25 19:31                                                                     ` Jan Kratochvil
2012-03-25 21:23                                                                     ` Eli Zaretskii
2011-12-06 12:50                                                 ` Pedro Alves
2011-12-06 20:40                                     ` Tom Tromey
2011-12-06 23:02                                     ` Jan Kratochvil
2011-07-29 13:35                         ` Jan Kratochvil
2011-08-01 18:04                           ` Tom Tromey
2011-06-29 10:09       ` Andrew Burgess
2011-06-29 16:06       ` Joel Brobecker
2011-07-03 18:15     ` Daniel Jacobowitz
2011-06-28 20:08   ` Tom Tromey
2012-04-09 15:39 ` Jan Kratochvil

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