This is the mail archive of the gdb-patches@sourceware.org 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: [RFA 3/5] Prec: x86 segment register support: target


Thanks Michael and Daniel.

I make a patch to add base of segments registers to x86-32:
(gdb) info reg
eax            0xffffd514	-10988
ecx            0x1eda96c5	517641925
edx            0x1	1
ebx            0xf7fb1ff4	-134537228
esp            0xffffd488	0xffffd488
ebp            0xffffd488	0xffffd488
esi            0x8048510	134513936
edi            0x80483d0	134513616
eip            0x8048487	0x8048487 <main+3>
eflags         0x246	[ PF ZF IF ]
cs             0x23	35
ss             0x2b	43
ds             0x2b	43
es             0x2b	43
fs             0x0	0
gs             0x63	99
cs_base        0x0	0
ss_base        0x0	0
ds_base        0x0	0
es_base        0x0	0
fs_base        0x0	0
gs_base        0xf7e528d0	-135976752

I try it in x86-32 pc and 32bit code in x86-64.  It works OK.

Please help me review it.

Best regards,
Hui

2010-03-22  Hui Zhu  <teawater@gmail.com>

	* features/i386/32bit-linux.xml (org.gnu.gdb.i386.linux): Add
	cs_base, ss_base, ds_base, es_base, fs_base and gs_base.
	* i386-tdep.h (i386_segment_base_regnum): New enum.
	* amd64-linux-nat.c (GDT_ENTRY_TLS_MIN,
	GDT_ENTRY_TLS_MAX): New marco.
	(ps_get_thread_area): New extern.
	(amd64_linux_fetch_inferior_registers): Add
	code to get 32 bits segment registers base.
	* i386-linux-nat.c (GDT_ENTRY_TLS_ENTRIES,
	GDT_ENTRY_TLS_MIN,
	GDT_ENTRY_TLS_MAX): New marco.
	(ps_get_thread_area): New extern.
	(i386_linux_fetch_inferior_registers): Add
	code to get segment registers base.

On Wed, Mar 17, 2010 at 04:04, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Tue, Mar 16, 2010 at 11:12:49AM -0700, Michael Snyder wrote:
>> However, isn't target.c the wrong place for this function?
>> Wouldn't it belong better in the gdbarch? ?It is architecture-
>> specific, if I understand correctly.
>>
>> That is, this will be the same between i386-ptrace and i386-remote,
>> but different between i386-remote and (say) mips-remote.
>
> IMO, these should simply be added as new registers. ?Since the name
> $gs is already taken, why not add a $gs_base register?
>
> H.J. Lu has recently converted the i386 target to use target
> descriptions; it should be easy to add new registers now.
> They could go in 32bit-linux.xml or in some other file that could be
> shared among OS's. ?H.J. may have some more ideas.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>

Attachment: add-segment-base.txt
Description: Text document


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