This is the mail archive of the gdb-prs@sources.redhat.com 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]

Re: gdb/780: Problem to debug a DLL


The following reply was made to PR gdb/780; it has been noted by GNATS.

From: Pascal Obry <p.obry@wanadoo.fr>
To: nobody@sources.redhat.com, obry@gnat.com, gdb-gnats@sources.redhat.com, gdb-prs@sources.redhat.com
Cc:  
Subject: Re: gdb/780: Problem to debug a DLL
Date: Mon, 11 Nov 2002 16:33:09 +0100

 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&20audit-trail'database=gdb'pr=780
 
 Note that the following patch does fix two problems with debugging DLL. Here
 main does not have debug symbols code.dll is the DLL to debug:
 
    $ gdb -nw main.exe
    (gdb) dll-symbols code.dll
    (gdb) break indll
    (gdb) run
 
    => Current GDB crash in the break command saying that it cannot access
       memory at address xxxx.
 
    => With the fix below, GDB say:
       "Warning: Cannot analyse frame without a running program."
       and set properly the breakpoint.
 
 and
 
    $ gdb -nw code.dll
    (gdb) break indll
    (gdb) exec-file main.exe
    (gdb) run
 
    => Current GDB does not stop to the break point.
 
    => With the fix below, GDB does stop at the breakpoint.
 
 2002-11-11  Pascal Obry  <obry@gnat.com>
 
 	* i386-tdep.c (i386_skip_prologue): Check that the memory at pc
         address can be read before trying to skip the routine prologue. This
         is needed to properly debug DLL. In many cases it is needed to break
         into the DLL before the program is launched (e.g. the main does not
         have debug information so it is not possible to break on the main) and
         in those cases it is not possible to skip the prologue. 
 
 <<
 Index: i386-tdep.c
 ===================================================================
 RCS file: /nile.c/cvs/Dev/gdb/gdb-5/gdb/i386-tdep.c,v
 retrieving revision 1.1.1.1.2.1.2.5
 retrieving revision 1.1.1.1.2.1.2.6
 diff -c -r1.1.1.1.2.1.2.5 -r1.1.1.1.2.1.2.6
 *** i386-tdep.c 29 Jul 2002 11:05:22 -0000      1.1.1.1.2.1.2.5
 --- i386-tdep.c 11 Nov 2002 15:13:39 -0000      1.1.1.1.2.1.2.6
 ***************
 *** 696,701 ****
 --- 696,713 ----
     };
     CORE_ADDR pos;
 
 +   /* First check that the current memory region has been already loaded. If
 +      not just return current pc. This is needed to be able to break on a
 +      DLL symbol after using dll-symbols when the program is not yet started
 +      (so not yet loaded in memory) */
 +   char bytebuf;
 +
 +   if (!target_has_execution && target_read_memory (pc, &bytebuf, 1) != 0)
 +     {
 +       warning ("Cannot analyse frame without a running program.");
 +       return (pc);
 +     }
 +
     if (i386_get_frame_setup (pc) < 0)
       return (pc);
 >>
 
 Pascal.
 
 -- 
 
 --|------------------------------------------------------
 --| Pascal Obry                           Team-Ada Member
 --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
 --|------------------------------------------------------
 --|         http://perso.wanadoo.fr/pascal.obry
 --| "The best way to travel is by means of imagination"
 --|
 --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
 


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