* [RFA/Windows] Change type of handler field of current_seh in windows-tdep.c
@ 2010-04-19 8:39 Pierre Muller
2010-04-19 18:15 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2010-04-19 8:39 UTC (permalink / raw)
To: gdb-patches
In the newly added convenience variable $_tlb for
Windows OS executables, you can see the Structured Exception Handling
list.
This is current_seh field:
(top-gdb) start
Temporary breakpoint 3 at 0x40105c: file ../../src/gdb/gdb.c, line 26.
Starting program: /usr/local/src/gdbcvs/build-norm/gdb/gdb.exe
[New Thread 5532.0xbfc]
[New Thread 5532.0x824]
Temporary breakpoint 3, main (argc=1, argv=0x1de26a8)
at ../../src/gdb/gdb.c:26
26 {
(top-gdb) p *$_tlb.current_seh
$1 = {next_seh = 0x15dffe0, handler = 0x61018970}
(top-gdb) p *$_tlb.current_seh.next_seh
$2 = {next_seh = 0xffffffff, handler = 0x7c839ad8}
(top-gdb)
After this patch, the handler field also displays the
function corresponding to that pointer.
(top-gdb) p *$_tlb.current_seh
$2 = {next_seh = 0x15dffe0,
handler = 0x61018970 <_cygtls::handle_exceptions(_EXCEPTION_RECORD*,
_exceptio
n_list*, _CONTEXT*, void*)>}
(top-gdb) p *$_tlb.current_seh .next_seh
$3 = {next_seh = 0xffffffff, handler = 0x7c839ad8 <ValidateLocale+688>}
This make it much more readable, no?
OK to install?
Pierre Muller
2010-04-19 Pierre Muller <muller@ics.u-strasbg.fr>
* windows-tdep.c (windows_get_tlb_type): Change current_seh.handler
type to void function.
Index: windows-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 windows-tdep.c
--- windows-tdep.c 16 Apr 2010 07:49:35 -0000 1.6
+++ windows-tdep.c 19 Apr 2010 07:57:53 -0000
@@ -102,6 +102,7 @@ windows_get_tlb_type (struct gdbarch *gd
struct type *peb_type, *peb_ptr_type, *list_type, *list_ptr_type;
struct type *module_list_ptr_type;
struct type *tib_type, *seh_type, *tib_ptr_type, *seh_ptr_type;
+ struct type *seh_handler_type, *seh_handler_ptr_type;
dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
1, "DWORD_PTR");
@@ -125,6 +126,13 @@ windows_get_tlb_type (struct gdbarch *gd
/* Structured Exception Handler */
+ seh_handler_type = arch_type (gdbarch, TYPE_CODE_FUNC, 0, NULL);
+ TYPE_TARGET_TYPE (seh_handler_type) = builtin_type
(gdbarch)->builtin_void;
+
+ seh_handler_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
+ TYPE_LENGTH (void_ptr_type), NULL);
+ TYPE_TARGET_TYPE (seh_handler_ptr_type) = seh_handler_type;
+
seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
TYPE_NAME (seh_type) = xstrdup ("seh");
@@ -133,7 +141,7 @@ windows_get_tlb_type (struct gdbarch *gd
TYPE_TARGET_TYPE (seh_ptr_type) = seh_type;
append_composite_type_field (seh_type, "next_seh", seh_ptr_type);
- append_composite_type_field (seh_type, "handler", void_ptr_type);
+ append_composite_type_field (seh_type, "handler", seh_handler_ptr_type);
/* struct _PEB_LDR_DATA */
peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA/Windows] Change type of handler field of current_seh in windows-tdep.c
2010-04-19 8:39 [RFA/Windows] Change type of handler field of current_seh in windows-tdep.c Pierre Muller
@ 2010-04-19 18:15 ` Pedro Alves
2010-04-19 23:14 ` [RFA/Windows-v2] " Pierre Muller
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-04-19 18:15 UTC (permalink / raw)
To: gdb-patches; +Cc: Pierre Muller
On Monday 19 April 2010 09:39:41, Pierre Muller wrote:
> (top-gdb) p *$_tlb.current_seh
> $1 = {next_seh = 0x15dffe0, handler = 0x61018970}
> (top-gdb) p *$_tlb.current_seh.next_seh
> $2 = {next_seh = 0xffffffff, handler = 0x7c839ad8}
> (top-gdb)
>
>
> After this patch, the handler field also displays the
> function corresponding to that pointer.
>
>
> (top-gdb) p *$_tlb.current_seh
> $2 = {next_seh = 0x15dffe0,
> handler = 0x61018970 <_cygtls::handle_exceptions(_EXCEPTION_RECORD*,
> _exceptio
> n_list*, _CONTEXT*, void*)>}
> (top-gdb) p *$_tlb.current_seh .next_seh
> $3 = {next_seh = 0xffffffff, handler = 0x7c839ad8 <ValidateLocale+688>}
>
> This make it much more readable, no?
Yeah. Why not just use builtin_func_ptr though?
> + struct type *seh_handler_type, *seh_handler_ptr_type;
>
> dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
> 1, "DWORD_PTR");
> @@ -125,6 +126,13 @@ windows_get_tlb_type (struct gdbarch *gd
>
> /* Structured Exception Handler */
>
> + seh_handler_type = arch_type (gdbarch, TYPE_CODE_FUNC, 0, NULL);
> + TYPE_TARGET_TYPE (seh_handler_type) = builtin_type
> (gdbarch)->builtin_void;
> +
> + seh_handler_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
> + TYPE_LENGTH (void_ptr_type), NULL);
> + TYPE_TARGET_TYPE (seh_handler_ptr_type) = seh_handler_type;
> +
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFA/Windows-v2] Change type of handler field of current_seh in windows-tdep.c
2010-04-19 18:15 ` Pedro Alves
@ 2010-04-19 23:14 ` Pierre Muller
2010-04-19 23:36 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2010-04-19 23:14 UTC (permalink / raw)
To: 'Pedro Alves', gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Monday, April 19, 2010 8:15 PM
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [RFA/Windows] Change type of handler field of current_seh
> in windows-tdep.c
>
> On Monday 19 April 2010 09:39:41, Pierre Muller wrote:
>
> > (top-gdb) p *$_tlb.current_seh
> > $1 = {next_seh = 0x15dffe0, handler = 0x61018970}
> > (top-gdb) p *$_tlb.current_seh.next_seh
> > $2 = {next_seh = 0xffffffff, handler = 0x7c839ad8}
> > (top-gdb)
> >
> >
> > After this patch, the handler field also displays the
> > function corresponding to that pointer.
> >
> >
> > (top-gdb) p *$_tlb.current_seh
> > $2 = {next_seh = 0x15dffe0,
> > handler = 0x61018970
> <_cygtls::handle_exceptions(_EXCEPTION_RECORD*,
> > _exceptio
> > n_list*, _CONTEXT*, void*)>}
> > (top-gdb) p *$_tlb.current_seh .next_seh
> > $3 = {next_seh = 0xffffffff, handler = 0x7c839ad8
> <ValidateLocale+688>}
> >
> > This make it much more readable, no?
>
> Yeah. Why not just use builtin_func_ptr though?
This is much better... of course.
The only reason is that I never used that builtin type,
and didn't know about it!
This make the patch much simpler, with the same
result.
Thanks, Pedro
Pierre
2010-04-19 Pierre Muller <muller@ics.u-strasbg.fr>
* windows-tdep.c (windows_get_tlb_type): Change current_seh.handler
type to void function.
Index: windows-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 windows-tdep.c
--- windows-tdep.c 16 Apr 2010 07:49:35 -0000 1.6
+++ windows-tdep.c 19 Apr 2010 23:11:44 -0000
@@ -133,7 +133,8 @@ windows_get_tlb_type (struct gdbarch *gd
TYPE_TARGET_TYPE (seh_ptr_type) = seh_type;
append_composite_type_field (seh_type, "next_seh", seh_ptr_type);
- append_composite_type_field (seh_type, "handler", void_ptr_type);
+ append_composite_type_field (seh_type, "handler",
+ builtin_type (gdbarch)->builtin_func_ptr);
/* struct _PEB_LDR_DATA */
peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA/Windows-v2] Change type of handler field of current_seh in windows-tdep.c
2010-04-19 23:14 ` [RFA/Windows-v2] " Pierre Muller
@ 2010-04-19 23:36 ` Pedro Alves
2010-04-19 23:55 ` Pierre Muller
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-04-19 23:36 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
On Tuesday 20 April 2010 00:14:50, Pierre Muller wrote:
> 2010-04-19 Pierre Muller <muller@ics.u-strasbg.fr>
>
> * windows-tdep.c (windows_get_tlb_type): Change current_seh.handler
> type to void function.
>
Okay.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [RFA/Windows-v2] Change type of handler field of current_seh in windows-tdep.c
2010-04-19 23:36 ` Pedro Alves
@ 2010-04-19 23:55 ` Pierre Muller
0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2010-04-19 23:55 UTC (permalink / raw)
To: 'Pedro Alves'; +Cc: gdb-patches
-----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Tuesday, April 20, 2010 1:36 AM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA/Windows-v2] Change type of handler field of
> current_seh in windows-tdep.c
>
> On Tuesday 20 April 2010 00:14:50, Pierre Muller wrote:
> > 2010-04-19 Pierre Muller <muller@ics.u-strasbg.fr>
> >
> > * windows-tdep.c (windows_get_tlb_type): Change
> current_seh.handler
> > type to void function.
> >
>
> Okay.
Thanks,
patch committed.
Pierre
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-04-19 23:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19 8:39 [RFA/Windows] Change type of handler field of current_seh in windows-tdep.c Pierre Muller
2010-04-19 18:15 ` Pedro Alves
2010-04-19 23:14 ` [RFA/Windows-v2] " Pierre Muller
2010-04-19 23:36 ` Pedro Alves
2010-04-19 23:55 ` Pierre Muller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox