From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1474 invoked by alias); 16 May 2009 16:51:10 -0000 Received: (qmail 1454 invoked by uid 22791); 16 May 2009 16:51:08 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout2.012.net.il (HELO mtaout2.012.net.il) (84.95.2.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 May 2009 16:51:02 +0000 Received: from conversion-daemon.i_mtaout2.012.net.il by i_mtaout2.012.net.il (HyperSendmail v2004.12) id <0KJQ00M00X4INC00@i_mtaout2.012.net.il> for gdb-patches@sourceware.org; Sat, 16 May 2009 19:50:58 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.73.80]) by i_mtaout2.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KJQ00236XGYXSU0@i_mtaout2.012.net.il> for gdb-patches@sourceware.org; Sat, 16 May 2009 19:50:58 +0300 (IDT) Date: Sat, 16 May 2009 16:51:00 -0000 From: Eli Zaretskii Subject: [RFA] Fix printing frame arguments for COFF debug info To: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83d4a9q9e5.fsf@gnu.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00340.txt.bz2 Currently, debugging DJGPP programs with COFF debug info fails to print frame arguments: GNU gdb (GDB) 6.8.50.20090410 Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i586-pc-msdosdjgpp --target=djgpp". For bug reporting instructions, please see: ... (gdb) start Temporary breakpoint 1 at 0x1748: file tchset.c, line 6. Starting program: d:/usr/djgpp/gnu/gdb-68.410/gdb/./tchset45c.exe Temporary breakpoint 1, main (argc=, argv=) at tchset.c:6 6 const char *cset = locale_charset (); (gdb) frame #0 main (argc=, argv=) at tchset.c:6 6 const char *cset = locale_charset (); GDB 6.1 does not have this problem, and neither does the current CVS when DWARF-2 or stabs are used. This started to happen because of this change: 2008-05-06 Joel Brobecker * valprint.c (val_print): Add new language parameter and use it instead of using the current_language. Update calls to val_print throughout. (common_val_print): Add new langauge parameter and pass it to val_print. * stack.c (print_frame_args): Update call to common_val_print using the appropriate language. After this change, print_frame_args uses the following logic to compute the language with which to print frame arguments: /* Use the appropriate language to display our symbol, unless the user forced the language to a specific language. */ if (language_mode == language_mode_auto) language = language_def (SYMBOL_LANGUAGE (sym)); else language = current_language; However, it does not check the value returned by language_def. What if that value is itself language_auto? If that happens, val_print will throw an error, because language_auto does not know how to print values -- it's just a placeholder for some other, "real" language. And it just so happens that coffread.c:process_coff_symbol does this: SYMBOL_LANGUAGE (sym) = language_auto; The first step towards solving this is to fix coffread.c, as in the patch I suggest below. OK to commit it? Even if this patch is accepted, I'm not sure that's all we need to do. At least minsyms.c:prim_record_minimal_symbol_and_info also sets the symbol's language to language_auto. Should we make sure neither common_val_print nor val_print ever get language_auto as the language? That is, should we fall back to current_language in that case? 2009-05-16 Eli Zaretskii * coffread.c (process_coff_symbol): Set the symbol's language to the language of current_subfile. --- coffread.c~0 2009-01-03 09:57:51.000000000 +0200 +++ coffread.c 2009-05-16 19:24:27.843781500 +0300 @@ -1482,7 +1482,7 @@ process_coff_symbol (struct coff_symbol memset (sym, 0, sizeof (struct symbol)); name = cs->c_name; name = EXTERNAL_NAME (name, objfile->obfd); - SYMBOL_LANGUAGE (sym) = language_auto; + SYMBOL_LANGUAGE (sym) = current_subfile->language; SYMBOL_SET_NAMES (sym, name, strlen (name), objfile); /* default assumptions */