summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-02 16:14:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-02 16:14:32 +0000
commit6a288deabc6e718add4552111a6fd2434c723431 (patch)
tree169089af3f1302088087d7be346943bfcdec3e85
parent613861d6c5dcf98f9b56112826adbf9f02d4f93a (diff)
* addr2line.c (uleb128): cast the value to unsigned long.
* addr2line.c (fill_lines): print error when lseek fails. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--addr2line.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fa167ddf2b..afcd6ac09d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c (uleb128): cast the value to unsigned long.
+
+ * addr2line.c (fill_lines): print error when lseek fails.
+
Thu Mar 3 00:36:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
* lib/rexml/encoding.rb (REXML::Encoding#encoding=): store @encoding
diff --git a/addr2line.c b/addr2line.c
index 6726f9fcf9..68e38cdb7b 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -85,7 +85,7 @@ uleb128(char **p) {
for (;;) {
unsigned char b = *(unsigned char *)(*p)++;
if (b < 0x80) {
- r += b << s;
+ r += (unsigned long)b << s;
break;
}
r += (b & 0x7f) << s;
@@ -442,6 +442,12 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
return;
}
filesize = lseek(fd, 0, SEEK_END);
+ if (filesize < 0) {
+ int e = errno;
+ close(fd);
+ fprintf(stderr, "lseek: %s\n", strerror(e));
+ return;
+ }
lseek(fd, 0, SEEK_SET);
/* async-signal unsafe */
file = (char *)mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);