This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Regression for gdb.objc/basicclass.exp [Re: [PATCH v2 3/5] use language of the main symbol]


Hi Tom,

I am aware GDB does not support ObjC too much AFAIK.

Another issues is that on any recent OS the ObjC testcases are being skipped
due to GCC warnings (going to post some patch for it).

This regression happens on CentOS-5:

 Running gdb/testsuite/gdb.objc/basicclass.exp ...
 PASS: gdb.objc/basicclass.exp: successfully compiled objc with posix threads test case
-PASS: gdb.objc/basicclass.exp: deduced language is Objective-C, before full symbols
-PASS: gdb.objc/basicclass.exp: deduced language is Objective-C, after full symbols
+FAIL: gdb.objc/basicclass.exp: source language not correct for Objective-C (psymtabs only)
 PASS: gdb.objc/basicclass.exp: set breakpoint pending
 PASS: gdb.objc/basicclass.exp: breakpoint method
 PASS: gdb.objc/basicclass.exp: breakpoint method with colon
 PASS: gdb.objc/basicclass.exp: breakpoint class method with colon
-PASS: gdb.objc/basicclass.exp: continue until method breakpoint
-PASS: gdb.objc/basicclass.exp: resetting breakpoints when rerunning
-PASS: gdb.objc/basicclass.exp: continue until method breakpoint
-PASS: gdb.objc/basicclass.exp: print an ivar of self
-PASS: gdb.objc/basicclass.exp: print self
-PASS: gdb.objc/basicclass.exp: print contents of self
+FAIL: gdb.objc/basicclass.exp: continue until method breakpoint (the program is no longer running)
+FAIL: gdb.objc/basicclass.exp: resetting breakpoints when rerunning
+FAIL: gdb.objc/basicclass.exp: continue until method breakpoint (the program exited)
+FAIL: gdb.objc/basicclass.exp: print an ivar of self
+FAIL: gdb.objc/basicclass.exp: print self
+FAIL: gdb.objc/basicclass.exp: print contents of self
 PASS: gdb.objc/basicclass.exp: breakpoint in category method
-PASS: gdb.objc/basicclass.exp: continue until category method
-PASS: gdb.objc/basicclass.exp: Call an Objective-C method with no arguments
-PASS: gdb.objc/basicclass.exp: Call an Objective-C method with one argument
-PASS: gdb.objc/basicclass.exp: Use of the print-object command
-PASS: gdb.objc/basicclass.exp: Use of the po (print-object) command
+FAIL: gdb.objc/basicclass.exp: continue until category method (the program is no longer running)
+FAIL: gdb.objc/basicclass.exp: Call an Objective-C method with no arguments
+FAIL: gdb.objc/basicclass.exp: Call an Objective-C method with one argument
+FAIL: gdb.objc/basicclass.exp: Use of the print-object command
+FAIL: gdb.objc/basicclass.exp: Use of the po (print-object) command


2851c5f32ef2fafa14f453c605d9d7d1b1b0ebc6 is the first bad commit
commit 2851c5f32ef2fafa14f453c605d9d7d1b1b0ebc6
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Aug 7 20:03:51 2013 +0000

    use language of the main symbol
[...]
    Built and regtested (both ways) on x86-64 Fedora 18.
    
    	* symfile.c (set_initial_language): Look up "main" symbol
    	and use its language.
    	* symtab.c (find_main_filename): Remove.
    	* symtab.h (find_main_filename): Remove.
    
    	* gdb.base/maint.exp: Allow zero symtabs to be expanded.


I have not checked more why it fails.


Jan


On Wed, 07 Aug 2013 21:44:53 +0200, Tom Tromey wrote:
> With "dwz -m", "main" appears in both the PU and the importing CU when
> running anon-struct.exp.  However, the PU does not have a file name.
> So, find_main_filename returns the empty string, making
> deduce_language_from_filename return language_unknown.
> 
> This patch fixes this problem by changing gdb to use the ordinary
> symbol-lookup functions to find "main"'s symbol.  Then, it examines the
> symbol's language.
> 
> I think this is cleaner than the current approach.  For one thing it
> avoids trying to guess the language based on the source file name,
> instead deferring to the presumably more reliable debuginfo.
> 
> Another possible fix would have been to change how the file name is
> found via the "qf" methods.  However, I think the approach given is
> preferable for the reason outlined above.
> 
> This required a minor test suite change, as now a symtab is expanded
> during the search for "main".
> 
> Built and regtested (both ways) on x86-64 Fedora 18.
> 
> 	* symfile.c (set_initial_language): Look up "main" symbol
> 	and use its language.
> 	* symtab.c (find_main_filename): Remove.
> 	* symtab.h (find_main_filename): Remove.
> 
> 	* gdb.base/maint.exp: Allow zero symtabs to be expanded.
> ---
>  gdb/symfile.c                    |  8 ++++----
>  gdb/symtab.c                     | 23 -----------------------
>  gdb/symtab.h                     |  2 --
>  gdb/testsuite/gdb.base/maint.exp |  7 ++++---
>  4 files changed, 8 insertions(+), 32 deletions(-)
> 
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 3328648..3dd5509 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -1612,11 +1612,11 @@ set_initial_language (void)
>      lang = language_of_main;
>    else
>      {
> -      const char *filename;
> +      char *name = main_name ();
> +      struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL);
>  
> -      filename = find_main_filename ();
> -      if (filename != NULL)
> -	lang = deduce_language_from_filename (filename);
> +      if (sym != NULL)
> +	lang = SYMBOL_LANGUAGE (sym);
>      }
>  
>    if (lang == language_unknown)
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 8076fe5..3bcec23 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -1949,29 +1949,6 @@ basic_lookup_transparent_type (const char *name)
>    return (struct type *) 0;
>  }
>  
> -/* Find the name of the file containing main().  */
> -/* FIXME:  What about languages without main() or specially linked
> -   executables that have no main() ?   */
> -
> -const char *
> -find_main_filename (void)
> -{
> -  struct objfile *objfile;
> -  char *name = main_name ();
> -
> -  ALL_OBJFILES (objfile)
> -  {
> -    const char *result;
> -
> -    if (!objfile->sf)
> -      continue;
> -    result = objfile->sf->qf->find_symbol_file (objfile, name);
> -    if (result)
> -      return result;
> -  }
> -  return (NULL);
> -}
> -
>  /* Search BLOCK for symbol NAME in DOMAIN.
>  
>     Note that if NAME is the demangled form of a C++ symbol, we will fail
> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index 6d81507..ccf4a4f 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h
> @@ -1252,8 +1252,6 @@ extern VEC (char_ptr) *make_source_files_completion_list (const char *,
>  
>  int matching_obj_sections (struct obj_section *, struct obj_section *);
>  
> -extern const char *find_main_filename (void);
> -
>  extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
>  
>  extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
> index 7057ac7..3093aae 100644
> --- a/gdb/testsuite/gdb.base/maint.exp
> +++ b/gdb/testsuite/gdb.base/maint.exp
> @@ -72,9 +72,10 @@ gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
>  gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
>  gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
>      "mt expand-symtabs" {
> -	-re "#primary symtabs: (1|2) \\(\[+\](1|2)\\),.*$gdb_prompt $" {
> -	    # This should expand one or at most two primary symtabs.
> -	    # "Normally" it will expand just the one for break.c, but if the
> +	-re "#primary symtabs: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
> +	    # This should expand at most two primary symtabs.
> +	    # "Normally" it will not expand any, because the symtab
> +	    # holding "main" will already have been expanded, but if the
>  	    # file is compiled with -fdebug-types-section then a second primary
>  	    # symtab for break.c will be created for any types.
>  	    pass "mt expand-symtabs"
> -- 
> 1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]