[PATCH] D81585: [AIX][XCOFF][Patch1] Provide decoding trace back table information API for xcoff object file for llvm-objdump -d

Digger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 06:18:09 PDT 2020


DiggerLin marked an inline comment as done.
DiggerLin added inline comments.


================
Comment at: llvm/unittests/Object/XCOFFObjectFileTest.cpp:162
+TEST(XCOFFObjectFileTest, XCOFFTracebackTableTruncatedAtMandatory) {
+  uint8_t V[] = {0x00, 0x00, 0x2A, 0x40, 0x80, 0x00};
+  uint64_t Size = sizeof(V);
----------------
DiggerLin wrote:
> jhenderson wrote:
> > Rather than repeatedly declaring an ever-increasing array, but otherwise identical array you should pull it out into a constant variable shared by the tests, and then use a different size in each case. Thus something like:
> > 
> > ```
> > const uint8_t BasicTable = { ... };
> > 
> > TEST(XCOFFObjectFileTest, XCOFFTracebackTableTruncatedAtMandatory) {
> >   Expected<XCOFFTracebackTable> TTOrErr = XCOFFTracebackTable::create(BasicTable, 0x6);
> >   EXPECT_THAT_ERROR(
> >       TTOrErr.takeError(),
> >       FailedWithMessage(
> >           "unexpected end of data at offset 0x6 while reading [0x0, 0x8)"));
> > }
> > 
> > TEST(XCOFFObjectFileTest, XCOFFTracebackTableTruncatedAtParamsType) {
> >   Expected<XCOFFTracebackTable> TTOrErr = XCOFFTracebackTable::create(BasicTable, 9);
> >   EXPECT_THAT_ERROR(
> >       TTOrErr.takeError(),
> >       FailedWithMessage(
> >           "unexpected end of data at offset 0x9 while reading [0x8, 0xc)"));
> > }
> > ```
> > 
> > etc.
> > 
> > You might even be able to use the table in some of your earlier tests too.
> I think I can not do that,  some bytes of the V[] is different.
if there are V[] is same , I will change as your suggestion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81585/new/

https://reviews.llvm.org/D81585



More information about the llvm-commits mailing list