* [PATCH] Fix CRISv32 compilation
@ 2013-08-30 13:13 Ricard Wanderlof
2013-09-02 17:29 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Ricard Wanderlof @ 2013-08-30 13:13 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]
The following patch fixes gdbserver compilation for CRISv32. I've done
a quick test that the resulting gdbserver can be used to do at least
rudimentary debugging.
Patch included inline for review and as attachement for use.
Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
2013-08-30 Ricard Wanderlof <ricardw@axis.com>
gdbserver
* linux-crisv32-low.c: Fix compilation errors.
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index efe50a7..2849d02 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -369,8 +369,6 @@ cris_arch_setup (void)
current_process ()->tdesc = tdesc_crisv32;
}
-typedef unsigned long elf_gregset_t[cris_num_regs];
-
static struct regset_info cris_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
@@ -426,7 +424,7 @@ struct linux_target_ops the_low_target = {
void
initialize_low_arch (void)
{
- init_register_crisv32 ();
+ init_registers_crisv32 ();
initialize_regsets_info (&cris_regsets_info);
}
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch file.patch --]
[-- Type: text/x-diff; name="cris-head-compilation.patch", Size: 742 bytes --]
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index efe50a7..2849d02 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -369,8 +369,6 @@ cris_arch_setup (void)
current_process ()->tdesc = tdesc_crisv32;
}
-typedef unsigned long elf_gregset_t[cris_num_regs];
-
static struct regset_info cris_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
@@ -426,7 +424,7 @@ struct linux_target_ops the_low_target = {
void
initialize_low_arch (void)
{
- init_register_crisv32 ();
+ init_registers_crisv32 ();
initialize_regsets_info (&cris_regsets_info);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix CRISv32 compilation
2013-08-30 13:13 [PATCH] Fix CRISv32 compilation Ricard Wanderlof
@ 2013-09-02 17:29 ` Pedro Alves
[not found] ` <alpine.DEB.2.00.1309030857010.10770@lnxricardw.se.axis.com>
2013-09-06 8:09 ` Ricard Wanderlof
0 siblings, 2 replies; 6+ messages in thread
From: Pedro Alves @ 2013-09-02 17:29 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: gdb-patches
On 08/30/2013 02:12 PM, Ricard Wanderlof wrote:
>
> 2013-08-30 Ricard Wanderlof <ricardw@axis.com>
>
> gdbserver
>
> * linux-crisv32-low.c: Fix compilation errors.
Write:
* linux-crisv32-low.c (elf_gregset_t): Delete typedef.
(initialize_low_arch): Call init_registers_crisv32 rather than
init_register_crisv32.
OK with that change.
(I can't see how the typedef was breaking the build though)
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix CRISv32 compilation
[not found] ` <alpine.DEB.2.00.1309030857010.10770@lnxricardw.se.axis.com>
@ 2013-09-03 12:03 ` Pedro Alves
2013-09-03 14:23 ` Ricard Wanderlof
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2013-09-03 12:03 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: gdb-patches
On 09/03/2013 08:45 AM, Ricard Wanderlof wrote:
>
> On Mon, 2 Sep 2013, Pedro Alves wrote:
>
>> On 08/30/2013 02:12 PM, Ricard Wanderlof wrote:
>>>
>>> 2013-08-30 Ricard Wanderlof <ricardw@axis.com>
>>>
>>> gdbserver
>>>
>>> * linux-crisv32-low.c: Fix compilation errors.
>>
>> Write:
>>
>> * linux-crisv32-low.c (elf_gregset_t): Delete typedef.
>> (initialize_low_arch): Call init_registers_crisv32 rather than
>> init_register_crisv32.
>>
>> OK with that change.
>
> Ok with me. Thanks for the update. Should I resubmit the patch ?
If there were no changes since the previous post, we just check
it in (and usually reply back saying so). If the patch was approved
with changes, we commit, and reply back saying "this is what I
checked in", showing the final version. Ultimately, what this means
is we always post final version of the patch to the mailing list,
exactly as it went in.
>> (I can't see how the typedef was breaking the build though)
>
> With the typedef left in, I get
...
> when building gdbserver using the target compiler.
Thanks, that's the sort of info that's helpful to have the
in the patch rationale (which ideally ends up in the
commit log).
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix CRISv32 compilation
2013-09-03 12:03 ` Pedro Alves
@ 2013-09-03 14:23 ` Ricard Wanderlof
0 siblings, 0 replies; 6+ messages in thread
From: Ricard Wanderlof @ 2013-09-03 14:23 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Tue, 3 Sep 2013, Pedro Alves wrote:
>> Ok with me. Thanks for the update. Should I resubmit the patch ?
>
> If there were no changes since the previous post, we just check
> it in (and usually reply back saying so). If the patch was approved
> with changes, we commit, and reply back saying "this is what I
> checked in", showing the final version. Ultimately, what this means
> is we always post final version of the patch to the mailing list,
> exactly as it went in.
Ok, then I won't submit an updated patch, as it was ok with the suggested
change to the ChangeLog.
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix CRISv32 compilation
2013-09-02 17:29 ` Pedro Alves
[not found] ` <alpine.DEB.2.00.1309030857010.10770@lnxricardw.se.axis.com>
@ 2013-09-06 8:09 ` Ricard Wanderlof
1 sibling, 0 replies; 6+ messages in thread
From: Ricard Wanderlof @ 2013-09-06 8:09 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Mon, 2 Sep 2013, Pedro Alves wrote:
> On 08/30/2013 02:12 PM, Ricard Wanderlof wrote:
>>
>> 2013-08-30 Ricard Wanderlof <ricardw@axis.com>
>>
>> gdbserver
>>
>> * linux-crisv32-low.c: Fix compilation errors.
>
> Write:
>
> * linux-crisv32-low.c (elf_gregset_t): Delete typedef.
> (initialize_low_arch): Call init_registers_crisv32 rather than
> init_register_crisv32.
>
> OK with that change.
>
> (I can't see how the typedef was breaking the build though)
Comitted now.
/Ricard
Fix compilation for target gdbserver on CRISv32 platform.
One misspelled function call, and one superfluous typedef. The latter
causes an error of the following type when building:
linux-crisv32-low.c:372: error: conflicting types for 'elf_gregset_t'
/.../target/include/asm/elf.h:36:
error: previous declaration of 'elf_gregset_t' was here
2013-09-06 Ricard Wanderlof <ricardw@axis.com>
* linux-crisv32-low.c (elf_gregset_t): Delete typedef.
(initialize_low_arch): Call init_registers_crisv32 rather than
init_register_crisv32.
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index efe50a7..2849d02 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -369,8 +369,6 @@ cris_arch_setup (void)
current_process ()->tdesc = tdesc_crisv32;
}
-typedef unsigned long elf_gregset_t[cris_num_regs];
-
static struct regset_info cris_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
@@ -426,7 +424,7 @@ struct linux_target_ops the_low_target = {
void
initialize_low_arch (void)
{
- init_register_crisv32 ();
+ init_registers_crisv32 ();
initialize_regsets_info (&cris_regsets_info);
}
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Fix CRISv32 compilation
@ 2013-08-30 13:30 Ricard Wanderlof
0 siblings, 0 replies; 6+ messages in thread
From: Ricard Wanderlof @ 2013-08-30 13:30 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2734 bytes --]
This patch adds support for threaded debugging on the CRISv32
architecture. It's been floating around for several years now in our local
repository so it's way overdue pushing upstream.
Patch included inline for review and as attachement for use.
Suggested-by: Edgar Iglisias <edgar.iglesias@gmail.com>
Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
2013-08-30 Ricard Wanderlof <ricardw@axis.com>
* cris-tdep.c: Fix typedef for elf_greg_t.
(cris_gdbarch_init): Add call to
set_gdbarch_fetch_tls_load_module_address.
gdbserver
* linux-crisv32-low.c (ps_get_thread_area): New function.
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 03041e4..dce2724 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3820,7 +3820,7 @@ cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info)
}
/* Copied from <asm/elf.h>. */
-typedef unsigned long elf_greg_t;
+typedef uint32_t elf_greg_t;
/* Same as user_regs_struct struct in <asm/user.h>. */
#define CRISV10_ELF_NGREG 35
@@ -4137,6 +4137,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_single_step_through_delay
(gdbarch, crisv32_single_step_through_delay);
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
+
break;
default:
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 2849d02..84cb7ff 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -27,6 +27,10 @@ extern const struct target_desc *tdesc_crisv32;
/* CRISv32 */
#define cris_num_regs 49
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+
/* Note: Ignoring USP (having the stack pointer in two locations causes trouble
without any significant gain). */
@@ -339,6 +343,20 @@ cris_stopped_data_address (void)
return eda;
}
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+ return PS_ERR;
+
+ /* IDX is the bias from the thread pointer to the beginning of the
+ thread descriptor. It has to be subtracted due to implementation
+ quirks in libthread_db. */
+ *base = (void *) ((char *)*base - idx);
+ return PS_OK;
+}
+
static void
cris_fill_gregset (struct regcache *regcache, void *buf)
{
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch file.patch --]
[-- Type: text/x-diff; name="cris-head-thread.patch", Size: 1934 bytes --]
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 03041e4..dce2724 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3820,7 +3820,7 @@ cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info)
}
/* Copied from <asm/elf.h>. */
-typedef unsigned long elf_greg_t;
+typedef uint32_t elf_greg_t;
/* Same as user_regs_struct struct in <asm/user.h>. */
#define CRISV10_ELF_NGREG 35
@@ -4137,6 +4137,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_single_step_through_delay
(gdbarch, crisv32_single_step_through_delay);
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
+
break;
default:
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 2849d02..84cb7ff 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -27,6 +27,10 @@ extern const struct target_desc *tdesc_crisv32;
/* CRISv32 */
#define cris_num_regs 49
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+
/* Note: Ignoring USP (having the stack pointer in two locations causes trouble
without any significant gain). */
@@ -339,6 +343,20 @@ cris_stopped_data_address (void)
return eda;
}
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+ return PS_ERR;
+
+ /* IDX is the bias from the thread pointer to the beginning of the
+ thread descriptor. It has to be subtracted due to implementation
+ quirks in libthread_db. */
+ *base = (void *) ((char *)*base - idx);
+ return PS_OK;
+}
+
static void
cris_fill_gregset (struct regcache *regcache, void *buf)
{
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-06 8:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-30 13:13 [PATCH] Fix CRISv32 compilation Ricard Wanderlof
2013-09-02 17:29 ` Pedro Alves
[not found] ` <alpine.DEB.2.00.1309030857010.10770@lnxricardw.se.axis.com>
2013-09-03 12:03 ` Pedro Alves
2013-09-03 14:23 ` Ricard Wanderlof
2013-09-06 8:09 ` Ricard Wanderlof
2013-08-30 13:30 Ricard Wanderlof
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox