Split bugreport() into its own file and added unit tests. am: 218e1ff759  -s ours
am: f18fbdf008

Change-Id: I050e5f9eda970a75d01735f4efcc5023095ad873