Closed Bug 1078383 Opened 10 years ago Closed 10 years ago

Update gdbserver

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

x86
macOS
defect
Not set
normal

Tracking

(blocking-b2g:2.1+, b2g-v2.1 fixed, b2g-v2.2 fixed)

RESOLVED FIXED
2.1 S9 (21Nov)
blocking-b2g 2.1+
Tracking Status
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: gwagner, Assigned: cyu)

References

Details

Attachments

(4 files, 3 obsolete files)

Using ./run-gdb.sh currently fails with debug builds. We need to update gdbserver.
[Blocking Requested - why for this release]: We need gdb for 2.1
blocking-b2g: --- → 2.1?
Attached patch run-gdb-workaround.patch (deleted) — Splinter Review
Before we upgrade gdbserver, this patch to run-gdb.sh can work the problem around.
Thanks Cervantes.
Michael, can you take care of updating gdbserver?
Flags: needinfo?(mwu)
I recommend finding someone else.
Flags: needinfo?(mwu)
Someone has to own this bug and update gdbserver. Jed, Dave, Cervantes, any takers?
Flags: needinfo?(jld)
Flags: needinfo?(dhylands)
Flags: needinfo?(cyu)
I am interested in this.
Assignee: nobody → cyu
Flags: needinfo?(jld)
Flags: needinfo?(dhylands)
Flags: needinfo?(cyu)
So we need the fix included in gdbserver 7.7. gdbserver 7.7 and gdb 7.1 (that we currently use) doesn't work together. What's the best upgrade path to take?

1. Upgrade both gdb and gdbserver to 7.7, but NDK only has 7.6. We need to put the custom-built gdb/gdbserver to prebuilts.
2. Upgrade gdb to 7.6 from NDK, but build gdbserver ourselves. Currently I haven't seen major problems with this combination.
3. Backport the fix to 7.6 or 7.1. Backport to 7.6 should not be a problem, but I am not sure if it's possible to backport to 7.1.

Dave, what do you say?
Flags: needinfo?(dhylands)
Step 2 sounds like the simplest. Changing which hash we use from prebuilts is possible, but I don't think we can actually change anything in prebuilts (we get it from uptream).

Step 3 also seems feasible (if we can backport in a way that only affects gdbserver). gdbserver is actually quite simple (compared to gdb).

So I think we'll need to add steps to get our updated gdbserver into /system without grabbing it from prebuilts. But I think that just winds up being some Makefile magic.

Getting a gdb/gdbserver that works is the fist step. I can help out with getting it installed.
Flags: needinfo?(dhylands)
(In reply to Dave Hylands [:dhylands] from comment #8)
> So I think we'll need to add steps to get our updated gdbserver into /system
> without grabbing it from prebuilts. But I think that just winds up being
> some Makefile magic.

In bug 985775, I tried and failed to find the makefile magic in question.  I eventually settled for installing a "gdbserver.new" and making run-gdb.sh detect it; that never landed because we worked around the problem instead.

Speaking of bug 985775, it would be good if we could get rid of the 7.1 gdbservers that don't support POSIX signal features that we're actively using.  It was also be good if we could get rid of the 6.x gdbservers that don't even work (e.g., emulator-x86-kk) and the completely nonexistent gdbservers (e.g., emulator-x86, at least the last time I tried to use it).
Attached patch 0001-Bug-1078373-update-gdbserver-to-7.7.patch (obsolete) (deleted) — Splinter Review
The patch to update prebuilts/misc/android-arm/gdbserver binary to 7.7.

This is built from gdb-7.7 source from GNU using NDK r10b.
For flame-kk the update path is easier: gdb is already upgraded to 7.6, so we only need to upgrade gdbserver to 7.7. It looks like we need to fork prebuilts/misc from upstream before it has upgraded to 7.7.
Dave, what's your suggestion with prebuilts/misc and other configs than flame-kk?
Flags: needinfo?(dhylands)
I think it depends on what's needed. I guess we need to figure out where else would the gdbserver binary from the flame-kk prebuilt tree work?

For the ones that don't work, we probably need to evaluate the effort required to backport (and maybe it isn't worth backporting anything - I guess it really depends on what platforms are actively being used and having issues.
Flags: needinfo?(dhylands)
Developer blocking = 2.1+ (despite it not being a user-visible thing and me not being entirely clear why we can't just uplift).
blocking-b2g: 2.1? → 2.1+
Dave

Would you please clone https://github.com/CervantesYu/platform_prebuilts_misc_2 to mozilla-b2g? This contains 'gdbserver-7-7' branch for flame-kk. Then I will update the manifest for flame-kk.

For other JB-based devices we might need to use arm-linux-android-eabi-4.8, but only for its gdb-7.6 if we don't want to also upgrade the toolchain.
Flags: needinfo?(dhylands)
I don't have permission to do that. Perhaps mwu does?
Flags: needinfo?(dhylands) → needinfo?(mwu)
Fork created at https://github.com/mozilla-b2g/platform_prebuilts_misc . Use b2g-4.4.2_r1 as the branch for kk aosp based devices. For kk caf based devices, I recommend attempting to upstream it first (ask :m1 for review) since it is a generally useful fix/upgrade for all users. If it's not accepted upstream, we can point our manifest at our fork.

Why is your gdbserver binary twice the size of the old binary? Do you need to strip it?
Flags: needinfo?(mwu)
It's not stripped. I will strip it and send out the update.
Attached file GitHub Pull Request (obsolete) (deleted) —
Attachment #8505393 - Attachment is obsolete: true
Attachment #8509428 - Flags: review?(mwu)
Comment on attachment 8509428 [details]
GitHub Pull Request

The PR is on the wrong branch.
Attachment #8509428 - Flags: review?(mwu)
Michael, would you please open the target branch on mozilla-b2g/platform_prebuilts_misc? Thanks.
Flags: needinfo?(mwu)
I created the branch when I created the mirror. It's b2g-4.4.2_r1, as mentioned in comment 17.
Flags: needinfo?(mwu)
Attached file GitHub Pull Request (deleted) —
Pull request to mozilla-b2g/platform_prebuilts_misc/b2g-4.4.2_r1.
Attachment #8509428 - Attachment is obsolete: true
Did you want me to review that?

BTW, you'll also need to open a bug to mirror the new repo so emulator/nexus kk builds can pick it up. https://wiki.mozilla.org/ReleaseEngineering/RepositoryCreationRequest#Requester.27s_Actions:
Attachment #8510770 - Flags: review?(mwu)
(In reply to Michael Wu [:mwu] from comment #24)
> Did you want me to review that?
> 
Sorry for forgetting to set the review flag.

> BTW, you'll also need to open a bug to mirror the new repo so emulator/nexus
> kk builds can pick it up.
> https://wiki.mozilla.org/ReleaseEngineering/
> RepositoryCreationRequest#Requester.27s_Actions:

So we are using git.mozilla.org instead of the this one hosted on github.com/mozilla-b2g for the .repo manifests? I am getting confused.
(In reply to Cervantes Yu from comment #25)
> > BTW, you'll also need to open a bug to mirror the new repo so emulator/nexus
> > kk builds can pick it up.
> > https://wiki.mozilla.org/ReleaseEngineering/
> > RepositoryCreationRequest#Requester.27s_Actions:
> 
> So we are using git.mozilla.org instead of the this one hosted on
> github.com/mozilla-b2g for the .repo manifests? I am getting confused.

The manifests are automatically rewritten to pull from git.mozilla.org on the build machines.
The gdbserver binary works for me - thanks.

Can you update your commit message so it includes all the necessary details of how to reproduce the binary? Include the exact NDK used, additional packages (if any), and the commands you used to build.
Depends on: 1090855
I'll collect the build steps and update the commit messages.
How I build gdbserver (the hacky way)

With ndk-r10b under /opt/build/android-ndk-r10b/
and gdb-7.7 source under /opt/build/gdb-7.7/:

> cd /opt/build/gdb-7.7/gdb/gdbserver
> export CC="/opt/build/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/arm-linux-androideabi/bin/gcc --sysroot=/opt/build/android-ndk-r10b/platforms/android-19/arch-arm"
> ./configure --host=arm-linux-androideabi
> make
This fails on my machine for Elf64_auxv_t and Elf32_auxv_t not found:
linux-low.c:5227:15: error: 'Elf64_auxv_t' undeclared (first use in this function)
     ? sizeof (Elf64_auxv_t) : sizeof (Elf32_auxv_t);
               ^
I have to manually comment out
#define HAVE_ELF32_AUXV_T 1
#define HAVE_ELF64_AUXV_T 1
in config.h to make it build.
> /opt/build/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/arm-linux-androideabi/bin/strip gdbserver

The struct definition is in elf.h, there seems to be inconsistency between configure and build time. I need to find out how to build without this hacky modification.
Wasn't there scripts in the ndk to rebuild parts of the ndk?
You mean make-standalone-toolchain.sh in NDK? Yes, but we don't really have to go through that step. According to https://developer.android.com/tools/sdk/ndk/index.html we just need to invoke gcc with correct --sysroot argument.

android-19 sysroot has the above error. I used the combination of ndk8/android14 and gdbserver builds without the above error.
Ok. Can you update the commit message?
Depends on: 1093597
(In reply to Michael Wu [:mwu] from comment #32)
> Ok. Can you update the commit message?

The commit message is updated.
Attachment #8510770 - Flags: review?(mwu) → review+
We'll need manifest updates too to switch to this new repo and branch.
Can we get this landed soon?
Not without manifest updates and bug 1093597.
Attachment #8522888 - Flags: review?(mwu)
Attachment #8522890 - Flags: review?(mwu)
Comment on attachment 8522890 [details]
Pull request to merge manifest on v2.1

There's a typo in this patch. Please test your manifest changes before submitting them.
Attachment #8522890 - Flags: review?(mwu) → review-
Comment on attachment 8522888 [details]
Pull request to merge manifest on master

>https://github.com/mozilla-b2g/b2g-manifest/pull/243/files

FWIW, bugzilla didn't think this was a pull request attachment. The extra /files at the end probably confused it.
Attachment #8522888 - Flags: review?(mwu) → review+
Comment on attachment 8522890 [details]
Pull request to merge manifest on v2.1

The typo is fixed.
Attachment #8522890 - Flags: review- → review?(mwu)
Attachment #8522890 - Flags: review?(mwu) → review+
Attached file CPU usage when the bug is reproduced (obsolete) (deleted) —
Comment on attachment 8523639 [details]
CPU usage when the bug is reproduced

Sorry Wrong bug
Attachment #8523639 - Attachment is obsolete: true
Can we land this patch? Or we are still waiting for other fixes.
Flags: needinfo?(cyu)
Flags: needinfo?(cyu)
Keywords: checkin-needed
NI :cyu to help seek approval on this given on master.
Flags: needinfo?(cyu)
NI bhavana for approval since we don't have approval flags for gonk pull requests.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): https://sourceware.org/bugzilla/show_bug.cgi?id=15604 (it's a bug in gdbserver)
User impact if declined: No. It only affects developers debugging b2g using gdb.
Testing completed: Manually.
Risk to taking this patch (and alternatives if risky): No. It's invisible to end users.
Flags: needinfo?(cyu) → needinfo?(bbajaj)
(In reply to Cervantes Yu from comment #48)
> NI bhavana for approval since we don't have approval flags for gonk pull
> requests.
> 
> [Approval Request Comment]
> Bug caused by (feature/regressing bug #):
> https://sourceware.org/bugzilla/show_bug.cgi?id=15604 (it's a bug in
> gdbserver)
> User impact if declined: No. It only affects developers debugging b2g using
> gdb.
> Testing completed: Manually.
> Risk to taking this patch (and alternatives if risky): No. It's invisible to
> end users.
Thanks, please go ahead and land this with a=bajaj if you can, else NI :Tomcat for help checking-in.
Flags: needinfo?(bbajaj)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: