From: Jiong Wang <jiwang@tilera.com>
To: Yao Qi <yao@codesourcery.com>
Cc: <gdb-patches@sourceware.org>, Walter Lee <walt@tilera.com>,
<palves@redhat.com>
Subject: Re: [PATCH/tilegx] tilegx bug fixes & improvements
Date: Thu, 06 Dec 2012 15:20:00 -0000 [thread overview]
Message-ID: <50C0B790.9070509@tilera.com> (raw)
In-Reply-To: <50C067CC.2050303@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 1954 bytes --]
Hi Yao,
>> - if (alignlen & 0x4)
>> - stack_dest -= 4;
>> + stack_dest = (stack_dest + 7) & ~0x7;
>
> Your can use function 'align_up'.
fixed, and I do make a mistake here, should be align_down.
>> /* Now write data to the stack. The stack grows downwards. */
>> stack_dest -= typelen + slacklen;
>> write_memory (stack_dest, val, typelen + slacklen);
>> - do_cleanups (back_to);
>
> alloca is unsafe, and we prefer to use xmalloc/cleanup+xfree.
fixed.
>> + if (status == 0) {
>> + /* fix gdb.base/gdb1250
>> + * breakpoint is set before dynamic library loaded, thus
>> gdb
>> + * does a partial symbol name finding and sets the
>> breakpoint
>> + * in the plt stub. our 32-bundle prefetch window is too
>> large
>> + * for this situation to cause a memory access error.
>> + * For plt stub, we just need to return directly.
>> + *
>> + * x86 does not have this problem, because the first
>> instruction
>> + * in their plt stub is jump, which ends the analysis also.
>> + */
>
> The comment style is not gnu style.
fixed the comment style.
> The problems looks about plt. I find tilegx port doesn't have a plt
> stub unwinder. I am not sure creating a plt stub unwinder can fix
> this problem,
I am not quite understand the usage of plt stub unwinder here. i386
do not append plt stub unwinder also. from my understanding, those plt
stub can be unwinded as normal frame, like a leaf function, or have I
misunderstood something?
> but it should fix other fails in testsuite.
the left failures are mostly about type print issues under gdb.cp
and gdb.python
attachment is the patch to fix above problems
thanks for feedback
---
Regards,
Jiong. Wang
Tilera Corporation
--
Regards,
Salad
office: +86-010-82825915, ext:653
cell: +86-13810021970
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-glitches.patch --]
[-- Type: text/plain; charset="gb18030"; name="fix-glitches.patch", Size: 2723 bytes --]
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index f7e00d7..903bf20 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -324,23 +324,27 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
}
/* Align SP. */
- stack_dest = (stack_dest + 7) & ~0x7;
+ stack_dest = align_down(stack_dest, 8);
/* Loop backwards through remaining arguments and push them on
the stack, word aligned. */
for (j = nargs - 1; j >= i; j--)
{
gdb_byte *val;
+ struct cleanup *back_to;
+ const gdb_byte *contents = value_contents (args[j]);
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = ((typelen + 7) & (~7)) - typelen;
- val = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, contents, typelen);
memset (val + typelen, 0, slacklen);
/* Now write data to the stack. The stack grows downwards. */
stack_dest -= typelen + slacklen;
write_memory (stack_dest, val, typelen + slacklen);
+ do_cleanups (back_to);
}
/* Add 2 double words for linkage space to the stack. */
@@ -434,17 +438,16 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
instbuf, instbuf_size);
if (status == 0) {
/* fix gdb.base/gdb1250
- * breakpoint is set before dynamic library loaded, thus gdb
- * does a partial symbol name finding and sets the breakpoint
- * in the plt stub. our 32-bundle prefetch window is too large
- * for this situation to cause a memory access error.
- * For plt stub, we just need to return directly.
- *
- * x86 does not have this problem, because the first instruction
- * in their plt stub is jump, which ends the analysis also.
+ breakpoint is set before dynamic library loaded, thus gdb
+ does a partial symbol name finding and sets the breakpoint
+ in the plt stub. our 32-bundle prefetch window is too large
+ for this situation to cause a memory access error.
+ For plt stub, we just need to return directly.
+
+ x86 does not have this problem, because the first instruction
+ in their plt stub is jump, which ends the analysis also.
*/
- if (strcmp(find_pc_section(instbuf_start)->the_bfd_section->name,
- ".plt") == 0)
+ if (in_plt_section (instbuf_start, NULL))
return instbuf_start;
memory_error (status, next_addr);
}
next prev parent reply other threads:[~2012-12-06 15:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 7:00 Jiong Wang
2012-12-06 9:39 ` Yao Qi
2012-12-06 15:20 ` Jiong Wang [this message]
2012-12-07 2:40 ` Yao Qi
2012-12-07 2:42 ` Joel Brobecker
2012-12-07 3:12 ` Jiong Wang
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=50C0B790.9070509@tilera.com \
--to=jiwang@tilera.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=walt@tilera.com \
--cc=yao@codesourcery.com \
/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