public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* language setting issue
@ 2010-07-14 18:52 sami wagiaalla
  2010-07-14 18:57 ` Roland McGrath
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sami wagiaalla @ 2010-07-14 18:52 UTC (permalink / raw)
  To: Project Archer

For the most part doing this:

if (current_language->la_language == language_cplus)

works fine, but there is a scenario invoked by cp-relocate.exp which 
looks something like this:

./gdb ./testsuite/gdb.cp/cp-relocate.o -ex 'print func<1>(int)' -ex 'q'

In this scenario if we check current_language->la_language it will be 
set to language_c. The problem is that current_language is set by 
checking the extension of the file of the symbol main which in this case 
does not exist.

To solve this we could just pick an arbitrary objfile and check the 
language. This works of we can assume that all files have the same 
language. Otherwise we would have to set the language a per block bases.

Thoughts ?

Sami

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

* Re: language setting issue
  2010-07-14 18:52 language setting issue sami wagiaalla
@ 2010-07-14 18:57 ` Roland McGrath
  2010-07-14 19:10 ` Jan Kratochvil
  2010-07-14 21:15 ` Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2010-07-14 18:57 UTC (permalink / raw)
  To: sami wagiaalla; +Cc: Project Archer

IMHO, any checks for language should be specific to the CU.  You can link
many languages together.  But I don't know what the method for choosing
what to call "the current CU" should be.


Thanks,
Roland

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

* Re: language setting issue
  2010-07-14 18:52 language setting issue sami wagiaalla
  2010-07-14 18:57 ` Roland McGrath
@ 2010-07-14 19:10 ` Jan Kratochvil
  2010-07-14 21:15 ` Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2010-07-14 19:10 UTC (permalink / raw)
  To: sami wagiaalla; +Cc: Project Archer

On Wed, 14 Jul 2010 20:51:53 +0200, sami wagiaalla wrote:
> ./gdb ./testsuite/gdb.cp/cp-relocate.o -ex 'print func<1>(int)' -ex 'q'
> 
> In this scenario if we check current_language->la_language it will
> be set to language_c.

> The problem is that current_language is set by checking the extension of the
> file of the symbol main which in this case does not exist.

It is such only before starting the inferior.  Normally select_frame() always
sets current_language according to the frame chosen right now.

Also in some cases language is passed along structures (such as struct
breakpoint) and functions.


> To solve this we could just pick an arbitrary objfile and check the
> language. This works of we can assume that all files have the same
> language. Otherwise we would have to set the language a per block
> bases.

IMO this problem is only for object files which is mostly just a problem for
hackers.  And for gdb testsuite.  But I agree some better autodetection would
be nice.  But only for the case of single objfile (and possibly single CU) to
make the code simple IMO as it gets never used otherwise anyway.


Regards,
Jan

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

* Re: language setting issue
  2010-07-14 18:52 language setting issue sami wagiaalla
  2010-07-14 18:57 ` Roland McGrath
  2010-07-14 19:10 ` Jan Kratochvil
@ 2010-07-14 21:15 ` Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2010-07-14 21:15 UTC (permalink / raw)
  To: sami wagiaalla; +Cc: Project Archer

Sami> ./gdb ./testsuite/gdb.cp/cp-relocate.o -ex 'print func<1>(int)' -ex 'q'

I think it is fine to require a 'set lang c++' in a case like this.
"func<1>" is not valid C.

I am curiousq to know what other user-visible changes you are planning to
make.

Tom

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

end of thread, other threads:[~2010-07-14 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-14 18:52 language setting issue sami wagiaalla
2010-07-14 18:57 ` Roland McGrath
2010-07-14 19:10 ` Jan Kratochvil
2010-07-14 21:15 ` Tom Tromey

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