Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: asmwarrior <asmwarrior@gmail.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: 'Joel Brobecker' <brobecker@adacore.com>,
	 'Eli Zaretskii' <eliz@gnu.org>,
	gdb-patches@sourceware.org
Subject: Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)
Date: Sat, 08 Dec 2012 14:17:00 -0000	[thread overview]
Message-ID: <50C34C75.3050803@gmail.com> (raw)
In-Reply-To: <50c218e5.2850b40a.0281.ffffbef4SMTPIN_ADDED_BROKEN@mx.google.com>

On 2012-12-8 0:27, Pierre Muller wrote:
>
>> -----Message d'origine-----
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de asmwarrior
>> Envoyé : vendredi 7 décembre 2012 17:17
>> À : Pierre Muller
>> Cc : 'Joel Brobecker'; 'Eli Zaretskii'; gdb-patches@sourceware.org
>> Objet : Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling
>> __stdcall functions in the inferior)
>>
>> On 2012-12-7 23:40, Pierre Muller wrote:
>>>     Hi Yuanhui,
>>> thanks for trying to debug this...
>>>
>>>     First, concerning the optimized out problems,
>>> it would be easier if you would recompile
>>> GDB without optimization:
>>>
>>> make clean all CFLAGS="-gdwarf-2 -O0"
>>>
>>> After that, you should get optimized out variables...
>> I will did this if I have more time.
>>
>>
>>>     I also installed CodeBlocks to test if I can reproduce your crash,
>>> but I never got any ...
>> The codeblocks.exe was built myself, which has debug information in it.
>   I tried to recompile the sources, but
> compilation fails on not found wxWorks headers...
> Despite the fact that I compiled wxWorks 2.9.4 without problems.
Note: Codeblocks currently can build against wxWidgets 2.8.12 library. I think it was not stable to build against wxWidgets 2.9.x.

>>>     Could it be that some weird DLL's have unnamed
>>> sections?
>>>     Could you try to insert
>>>       if (sections[i] && section[i].name)
>>> before
>>>>        if (strcmp (sections[i].section_name, section_name) == 0)
>>>>          return i;
>>> to confirm that the problem originates here?
>>>
>> I add a line:
>> static int
>> get_pe_section_index (const char *section_name,
>> 		      struct read_pe_section_data *sections,
>> 		      int nb_sections)
>> {
>>     int i;
>>     for (i = 0; i < nb_sections; i++)
>>       if (section_name && (&sections[i]) && sections[i].section_name)
>>       if (strcmp (sections[i].section_name, section_name) == 0)
>>         return i;
>>     return PE_SECTION_INDEX_INVALID;
>> }
>>
>>
>> But still the same crash in strcmp().
>    Could you try to check that section_name ansd sections array are valid...
> It will probably require that you recompile GDB :(
Hi, today, I build gdb with "-O0 -g", here is the variables I see when it crashed.

Program received signal SIGSEGV, Segmentation fault.
0x77c47784 in strcmp () from C:\WINDOWS\system32\msvcrt.dll
(gdb) bt
#0  0x77c47784 in strcmp () from C:\WINDOWS\system32\msvcrt.dll
#1  0x00562eb9 in get_pe_section_index (section_name=0x5548638 ".data",
     sections=0x4b33b38, nb_sections=5) at ../../gdb/gdb/coff-pe-read.c:113
#2  0x00562f08 in get_section_vmas (abfd=0x4caede8, sectp=0x55496e8,
     context=0x285f5ec) at ../../gdb/gdb/coff-pe-read.c:134
#3  0x0064e7ee in bfd_map_over_sections (abfd=0x4caede8,
     operation=0x562ed5 <get_section_vmas>, user_storage=0x285f5ec)
     at ../../gdb/bfd/section.c:1329
#4  0x00563d2c in read_pe_exported_syms (objfile=0x5615090)
     at ../../gdb/gdb/coff-pe-read.c:525
#5  0x00560887 in coff_symtab_read (symtab_offset=0, nsyms=0,
     objfile=0x5615090) at ../../gdb/gdb/coffread.c:1127
#6  0x0055f660 in coff_symfile_read (objfile=0x5615090, symfile_flags=8)
     at ../../gdb/gdb/coffread.c:610
#7  0x004f1cc4 in read_symbols (objfile=0x5615090, add_flags=8)
     at ../../gdb/gdb/symfile.c:885
#8  0x004f203b in syms_from_objfile (objfile=0x5615090, addrs=0x2e04398,
     offsets=0x0, num_offsets=0, add_flags=8) at ../../gdb/gdb/symfile.c:1020
#9  0x004f2206 in symbol_file_add_with_addrs_or_offsets (abfd=0x4caede8,
     add_flags=8, addrs=0x2e04398, offsets=0x0, num_offsets=0, flags=2,
     parent=0x0) at ../../gdb/gdb/symfile.c:1123
#10 0x004f23bf in symbol_file_add_from_bfd (abfd=0x4caede8, add_flags=8,
     addrs=0x2e04398, flags=2, parent=0x0) at ../../gdb/gdb/symfile.c:1213
#11 0x0060ef33 in solib_read_symbols (so=0x4bdb6b0, flags=8)
     at ../../gdb/gdb/solib.c:608
#12 0x0060f50d in solib_add (pattern=0x0, from_tty=0,
     target=0x9ec6c0 <current_target>, readsyms=1) at ../../gdb/gdb/solib.c:919
#13 0x0050146f in post_create_inferior (target=0x9ec6c0 <current_target>,
     from_tty=0) at ../../gdb/gdb/infcmd.c:477
#14 0x0050175b in run_command_1 (args=0x0, from_tty=1, tbreak_at_main=0)
     at ../../gdb/gdb/infcmd.c:631
#15 0x005017b0 in run_command (args=0x0, from_tty=1)
     at ../../gdb/gdb/infcmd.c:645
#16 0x00447794 in do_cfunc (c=0x2d65ed0, args=0x0, from_tty=1)
     at ../../gdb/gdb/cli/cli-decode.c:114
#17 0x0044a0ce in cmd_func (cmd=0x2d65ed0, args=0x0, from_tty=1)
     at ../../gdb/gdb/cli/cli-decode.c:1859
#18 0x005f6ebf in execute_command (p=0x294321 "", from_tty=1)
     at ../../gdb/gdb/top.c:491
#19 0x00524cda in command_handler (command=0x294320 "")
     at ../../gdb/gdb/event-top.c:429
#20 0x0052524e in command_line_handler (rl=0x2e29fe0 "r")
     at ../../gdb/gdb/event-top.c:630
#21 0x00630133 in rl_callback_read_char ()
     at ../../gdb/readline/callback.c:220
#22 0x0052481f in rl_callback_read_char_wrapper (client_data=0x0)
     at ../../gdb/gdb/event-top.c:163
#23 0x00524c04 in stdin_event_handler (error=0, client_data=0x0)
     at ../../gdb/gdb/event-top.c:369
#24 0x00523df9 in handle_file_event (data=...)
     at ../../gdb/gdb/event-loop.c:827
#25 0x0052353d in process_event () at ../../gdb/gdb/event-loop.c:401
#26 0x00523602 in gdb_do_one_event () at ../../gdb/gdb/event-loop.c:465
#27 0x00523654 in start_event_loop () at ../../gdb/gdb/event-loop.c:490
#28 0x00524848 in cli_command_loop () at ../../gdb/gdb/event-top.c:176
#29 0x0051cdcf in current_interp_command_loop ()
     at ../../gdb/gdb/interps.c:332
#30 0x0051d6e9 in captured_command_loop (data=0x0) at ../../gdb/gdb/main.c:256
#31 0x0051be8c in catch_errors (func=0x51d6d4 <captured_command_loop>,
     func_args=0x0, errstring=0x7af593 <__PRETTY_FUNCTION__.13689+121> "",
     mask=6) at ../../gdb/gdb/exceptions.c:546
#32 0x0051e8c7 in captured_main (data=0x285fee0) at ../../gdb/gdb/main.c:1032
#33 0x0051be8c in catch_errors (func=0x51d923 <captured_main>,
     func_args=0x285fee0,
     errstring=0x7af593 <__PRETTY_FUNCTION__.13689+121> "", mask=6)
     at ../../gdb/gdb/exceptions.c:546
#34 0x0051e8fd in gdb_main (args=0x285fee0) at ../../gdb/gdb/main.c:1041
#35 0x00401737 in main (argc=1, argv=0x293ea0) at ../../gdb/gdb/gdb.c:34
(gdb) frame 1
#1  0x00562eb9 in get_pe_section_index (section_name=0x5548638 ".data",
     sections=0x4b33b38, nb_sections=5) at ../../gdb/gdb/coff-pe-read.c:113
113         if (strcmp (sections[i].section_name, section_name) == 0)
(gdb) p section_name
$1 = 0x5548638 ".data"
(gdb) p i
$2 = 2
(gdb) p sections[i].section_name
$3 = 0xabababab <Address 0xabababab out of bounds>
(gdb) print *sections@nb_sections
$4 = {{vma_offset = 2089811968, rva_start = 4096, rva_end = 515802,
     ms_type = mst_text, section_name = 0x7cd4a0 <coff_sym_fns+64> ".text"}, {
     vma_offset = 2868903936, rva_start = 2880154539, rva_end = 2880154539,
     ms_type = mst_unknown, section_name = 0x0}, {vma_offset = 393221,
     rva_start = 35784515, rva_end = 1920168494, ms_type = 2880110691,
     section_name = 0xabababab <Address 0xabababab out of bounds>}, {
     vma_offset = 0, rva_start = 536576, rva_end = 716408, ms_type = mst_data,
     section_name = 0x4b33b68 ".rsrc"}, {vma_offset = 0, rva_start = 716800,
     rva_end = 728800, ms_type = mst_data, section_name = 0x4b33be0 ".reloc"}}



Look, the value "0xabababab", I'm not sure why gdb report: out of bounds, where does this value come from?


Yuanhui Zhang


  parent reply	other threads:[~2012-12-08 14:17 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83a9vs89r9.fsf@gnu.org>
     [not found] ` <201210120953.q9C9rqfu020865@glazunov.sibelius.xs4all.nl>
     [not found]   ` <834nm07z0s.fsf@gnu.org>
     [not found]     ` <5077FEB9.4030304@redhat.com>
     [not found]       ` <83y5jb7rfe.fsf@gnu.org>
2012-10-15 13:36         ` [RFC] " Pierre Muller
2012-10-24 19:45           ` Joel Brobecker
2012-10-25 12:21             ` Pierre Muller
2012-11-05 17:11               ` Joel Brobecker
2012-11-06 14:31                 ` [RFC-v2] " Pierre Muller
     [not found]                 ` <50991f5f.8382440a.1100.ffff82abSMTPIN_ADDED@mx.google.com>
2012-11-07 19:44                   ` Pedro Alves
2012-11-08  9:54                     ` [RFC-v3] " Pierre Muller
2012-11-22 17:30                       ` Joel Brobecker
2012-11-22 17:51                         ` Pedro Alves
2012-11-25 22:50                         ` [RFC-v4] " Pierre Muller
2012-11-26 17:22                           ` Joel Brobecker
2012-11-26 18:36                             ` Tom Tromey
2012-11-26 20:58                               ` Joel Brobecker
     [not found]                         ` <15690.5992342674$1353883881@news.gmane.org>
2012-11-26  4:04                           ` asmwarrior
2012-11-26 10:14                             ` Pierre Muller
     [not found]                             ` <50b340fb.0aec440a.1c48.5818SMTPIN_ADDED_BROKEN@mx.google.com>
2012-11-26 11:39                               ` Pedro Alves
2012-11-26 16:54                           ` Tom Tromey
2012-11-27 14:59                             ` [RFC-v5] " Pierre Muller
2012-12-07  7:10                               ` Joel Brobecker
2012-12-07 15:23                                 ` asmwarrior
2012-12-07 15:41                                   ` Pierre Muller
     [not found]                                   ` <29545.4593528577$1354894901@news.gmane.org>
2012-12-07 16:15                                     ` asmwarrior
2012-12-07 16:27                                       ` Pierre Muller
     [not found]                                       ` <50c21914.a750420a.2ec3.ffffe4ffSMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-07 17:10                                         ` Pedro Alves
2012-12-07 17:49                                           ` Pedro Alves
2012-12-13 10:57                                             ` Pierre Muller
2012-12-13 11:07                                               ` Pedro Alves
2012-12-13 11:49                                                 ` Pedro Alves
     [not found]                                                 ` <00a201cdd931$b0ee13f0$12ca3bd0$@muller@ics-cnrs.unistra.fr>
2012-12-13 14:32                                                   ` Pedro Alves
2012-12-13 15:17                                                     ` Pierre Muller
2012-12-13 14:33                                                   ` Pedro Alves
2012-12-13 14:56                                                     ` Pierre Muller
2012-12-13 15:03                                                       ` Pedro Alves
2012-12-13 16:43                                                         ` Pedro Alves
2012-12-13 16:54                                                           ` Pierre Muller
2012-12-13 16:56                                                             ` Pedro Alves
2012-12-13 17:09                                                               ` Pierre Muller
2012-12-13 15:08                                                       ` Pierre Muller
2012-12-13 16:04                                                         ` Pedro Alves
     [not found]                                       ` <50c218e5.2850b40a.0281.ffffbef4SMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-08 14:17                                         ` asmwarrior [this message]
2012-12-08 15:07                                           ` asmwarrior
2012-12-08 18:01                                           ` Pierre Muller
     [not found]                                           ` <50c38058.03d0d80a.31dd.4e28SMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-09  2:45                                             ` asmwarrior
2012-12-09 12:45                                               ` Pierre Muller
     [not found]                                               ` <50c487f8.a813b40a.57d7.ffffdc7fSMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-09 13:19                                                 ` asmwarrior
2012-12-13 10:48                                 ` Pierre Muller
     [not found]                                 ` <37373.4003318988$1355395714@news.gmane.org>
2012-12-13 16:16                                   ` Tom Tromey
2012-12-13 16:21                                     ` Pierre Muller
     [not found]                                     ` <12936.6976012991$1355415704@news.gmane.org>
2012-12-13 20:05                                       ` Tom Tromey
     [not found]                             ` <42721.1671988063$1354028360@news.gmane.org>
2012-11-28  2:44                               ` asmwarrior
2012-11-29  3:40                                 ` asmwarrior
2012-12-12  0:59                               ` asmwarrior
     [not found]                         ` <50b2a0d1.c849420a.3a3a.3538SMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-07 16:38                           ` [RFC-v4] " Pedro Alves
2012-12-07 17:03                             ` Pierre Muller
2012-12-07 17:50                               ` Pedro Alves
     [not found]                     ` <000301cdbd96$f5cd9f10$e168dd30$%muller@ics-cnrs.unistra.fr>
2012-11-17 10:01                       ` [RFC-v3] " Eli Zaretskii
     [not found]         ` <006001cdaada$00c81f00$02585d00$%muller@ics-cnrs.unistra.fr>
2012-10-15 17:23           ` [RFC] " Eli Zaretskii
2012-11-03 10:36             ` Eli Zaretskii
2012-11-06 13:55               ` Pierre Muller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50C34C75.3050803@gmail.com \
    --to=asmwarrior@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox